Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Lighting 2D surface from 3D geometry with D3D

This topic is 6490 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

I''m drawing a 2D image onto the screen with Direct3D, using a triangle strip, and I want to be able to light this based on a mesh I have that approximates the thing represented by the 2D image. I am planning on using vertex lighting. I figure one way I could do this is to render the mesh out with the vertices I want to be light being RGB 255-255-255, and dark 0-0-0 to create a lightmap, and then rendering my 2D image using this lightmap. However, this does not seem to be a very efficient way to do things, given that I would like my lighting to be dynamic, and therefore I would need to re-render my lightmaps every frame in many cases, not to mention the extra memory usage. It''s also a combination of the worst of both worlds from vertex and lightmap lighting from what I understand. Another possible way would be to try to distort my texture so that the mesh could be rendered itself, and not render as a simple 2D triangle strip. However, I see this option being a lot of work and likely degrading the quality of the image as well. The image wouldn''t easily map onto the mesh unfortunately. I think my most likely solution, unless I get any better ideas or suggestions, would be to try to render out the mesh but set the texture coordinates on the vertices so that the texture is effectively rendered in 2d. I guess I just need some calculations to be able to work out those coordinates, which would depend on the perspective. I''m a newbie when it comes to 3D, so there may be an easy way to do this that I''ve missed... if anyone has any ideas I''d be glad to hear them. Thanks Starfall

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!