Sign in to follow this  
Alundra

TwoSided lighting, not the best result with a sphere

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

 

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

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