Jump to content
  • Advertisement
Sign in to follow this  
grunt123

need help on 3D=2D conversion

This topic is 4099 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Given a point in 3D space (world space), how do i convert this point to screen coordinate (2D). Also, I need to get z value of this converted 2D point so that this point can be depth-tested.

Share this post


Link to post
Share on other sites
Advertisement
You'll want to transform your 3D point using a perspective transformation matrix. If you're not using OpenGL or DirectX, you can just do a search on Google to find how you can build a matrix yourself.

Share this post


Link to post
Share on other sites
I'll try to explain what i want to do. I want to render lens flare/corono effect. corona effect is placed in the game world in 3D. I can do world/view/project/viewport transformation on the 3D points of the effect and get 2D screen coordinate. (along with z value) The problem is that when i want to render the effect (in 2D now) using the result values, i want the effect to be properly occuluded by game objects. I'm using orthographic projection for 2D rendering and not sure what to put for z value.

thanks

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!