Sign in to follow this  
yanyee

OpenGL How to Set Two-side Lighting in Direct3D?

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this