Two-sided surface normal..(D3D)

Started by
0 comments, last by jollyjeffers 17 years, 9 months ago
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?
Dave.
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement