Jump to content
  • Advertisement
Sign in to follow this  
yanyee

OpenGL How to Set Two-side Lighting in Direct3D?

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

In OpenGL, there is a parameter to determine whether one- or two-sided lighting calculations are done for polygons when setting a light. But I couldn't find a similar function in direct3D so far. Who can tell me about how to set a two-side calculations light? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Because the hardware can do it in one pass basically for free, instead of doubling the number of triangles you're pushing. But, with a fixed pipeline, you'll need to do the latter.

Share this post


Link to post
Share on other sites
Creating two lights facing in opposite directions doesn't works. But to flip the order of triangle vertices and normals and then to redraw once does work well. But this method costs too resource and debases the performance.

Share this post


Link to post
Share on other sites
The only way to have 1-pass, 2-sided lighting is to use the vface input in a shader. It's a fast method and should be used.

"Why do people try to throw shaders at everything?"
maybe because video cards use shaders to render things...

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.

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!