Jump to content
  • Advertisement
Sign in to follow this  
Alundra

TwoSided lighting, not the best result with a sphere

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

Hi,
I use TwoSided lighting for window for example using this technique with culling disabled :

float4 ps_main( Interpolator i, bool bIsFrontFace : SV_IsFrontFace ) : COLOR0
{
   float3 normal = bIsFrontFace ? i.normal : -i.normal;
}

Works well for plane mesh but with a sphere you have a bad result so I was curious and experimented things.
Using two render switching the culling mode clockwise/counter-clockwise gives a better result for a sphere.
Is it possible to have a good result for a sphere using the one-draw-call method ?
Or maybe in case of a sphere it's needed to have another mode ?
Thanks

 

Share this post


Link to post
Share on other sites
Advertisement

 

Hi,
I use TwoSided lighting for window for example using this technique with culling disabled :

float4 ps_main( Interpolator i, bool bIsFrontFace : SV_IsFrontFace ) : COLOR0
{
   float3 normal = bIsFrontFace ? i.normal : -i.normal;
}

Works well for plane mesh but with a sphere you have a bad result so I was curious and experimented things.

 

Are you 100% sure you have a problem with the shading? Isn't it maybe some transparency sorting?

"bad" is not a good explanation for a problem ;). Post maybe a screenshot of the issue.

Share this post


Link to post
Share on other sites

Good point, I didn't think of that but you are surely right there since I don't use any OIT actually and now you say that, it's coherent with the result I think.
6o43.png

Share this post


Link to post
Share on other sites

if you disable depth testing and set the transparency to be additive, it should look consistent (not correct, but always consistent). that way you'd know it's just the transparency sorting.

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!