TwoSided lighting, not the best result with a sphere

Started by
2 comments, last by Krypt0n 7 years ago

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

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.

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

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.

This topic is closed to new replies.

Advertisement