Jump to content
  • Advertisement
Sign in to follow this  
DangerDave

Two-sided surface normal..(D3D)

This topic is 4490 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 sure this must be a simple addition to the Direct3D setup.. Is there a simple RenderState or FVF setting or something that will allow surfaces to be lit from the reverse direction, as well as the direction specified by the vertex normal - so a triangle is lit from both sides? EDIT: Also, is there a function I can call to automatically calculate vertex normals for me from a triangle list?

Share this post


Link to post
Share on other sites
Advertisement
I'm pretty sure you can't do this with fixed-function: you need to use a vertex shader to get 2-sided lighting without duplicating geometry. If you go all the way upto vs_3_0 you can even get the VFACE register to help out...

As for computing normals, can't be done easily on the GPU, but you can use D3DXComputeNormals() to generate the data and store it in the vertex buffer as usual. D3DRS_NORMALIZENORMALS might be useful if you're going to be doing lots of scaling..

hth
Jack

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!