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

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