Sign in to follow this  

project and scale 3D object to 2d screen space

Recommended Posts

hserver    142
I have a function that already project a 3d point into my screen whitch I want to share with you !

Public Function GetScreenCoordBy3DPoint(ByRef RetX As Single, ByRef RetY As Single, ByRef Px As Single, ByRef Py As Single, ByRef Pz As Single, ByRef RetdistZ As Single) As Object
Dim MatView As Matrix
Dim matProj As Matrix
Dim RetVec As Vector3
Dim Vec1 As Vector3
Vec1.X = Px
Vec1.Y = Py
Vec1.Z = Pz
Dim tViewPort As Direct3D.Viewport ' DxVBLibA.D3DVIEWPORT8
Dim IdentMat As Matrix
IdentMat = Matrix.Identity
MatView = D3DDevice9.GetTransform(Direct3D.TransformType.View)
matProj = D3DDevice9.GetTransform(Direct3D.TransformType.Projection)
'd3ddevice9.GetTransform D3DTS_WORLD, IdentMat
tViewPort = D3DDevice9.Viewport
RetVec = Vector3.Project(Vec1, tViewPort, matProj, MatView, IdentMat)
RetX = RetVec.X
RetY = RetVec.Y
RetdistZ = RetVec.Z
End Function
I want to render a 3d mesh and prevent its scaling when it go far from camera
any suggestion how should I scale it ??
sorry for bad EN

Share this post

Link to post
Share on other sites
Radikalizm    4807
You're looking for an [url=""]orthographic or orthogonal projection[/url]
An isometric projection would be a projection where a unit is of equal length for all three projected axes, and where the angle between two adjacent projected axes is exactly 120°. Edited by Radikalizm

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this