[Runtime Bug]: Normal blending causing the light visibility ray to get cast down below the plane of the triangle
Describe the bug
when casting a light onto a smooth rounded surface you will notice these jagged polygons around the transition from light to shadow. It's seen in every remix media released from the original portal release to hl2.
Mark looked at this on discord and said "In this case, I believe it's normal blending causing the light visibility ray to get cast down below the plane of the triangle, which we just detect as a collision with itself. OV apparently has some fixes for this already implemented, so this is probably just a matter of tracking down what they did and porting it over."
it's already tracked as REMIX-4100
How do you reproduce the bug?
just render something you expect to be smooth and look at where the light turns to shadow. moving the light around helps
What is the expected behavior?
The runtime should...ideally smooth out the transition between light and shadow
Version
x.x.x
Logs
no logs
Crash dumps
no crash dumps
Media
as the light moves around this guy you can see the error build up and move along the surface
https://github.com/user-attachments/assets/c1ba58f5-b6a7-4eda-b60c-65f6c9d022f0
eman made this sphere with smooth normals, you can see the errors clearly
normal lines on his right hand, right elbow, should and yellow badge
its all over the body here
Filed as REMIX-4100.
Though do note this is generally just an indication that your geometry is not high poly enough. Normal maps and "smooth shading" normal interpolation are fundamentally incompatible with physically correct rendering (e.g. ray tracing), so the more they deviate from the underlying geometry the more issues will arise no matter what. Of course it's easier said than done to just have super high geometric detail on everything, but in the more egregious cases it may be an indicator that it's just a bit too low poly to expect good results from.
There are ways to work around these harsh edges in direct lighting specifically which we probably can implement to avoid this common case as it's one of the more obvious failures when normals are pushed too far (we already employ a workaround for the issues it causes for indirect lighting), but those workarounds will cause their own sorts of artifacts in other less common cases as a tradeoff. Such workarounds also won't do anything to solve the other issues low poly geometry causes either, for instance poor looking object silhouettes/shadows or heavier reliance on bent normals for indirect lighting, only more geometry detail can do that.
Cheers for looking into this. Any help would be greatly appreciated. Unfortunately in my cases I can't do skinned mesh replacement and therefore have to rely on original mod tools and that means dealing with the games original polygon limits.
I'll also note the screenshot of half life with the error on his arm is from Nvidias half life project and that does support skinned mesh replacement 😋
Filed as REMIX-4100.
Though do note this is generally just an indication that your geometry is not high poly enough. Normal maps and "smooth shading" normal interpolation are fundamentally incompatible with physically correct rendering (e.g. ray tracing), so the more they deviate from the underlying geometry the more issues will arise no matter what. Of course it's easier said than done to just have super high geometric detail on everything, but in the more egregious cases it may be an indicator that it's just a bit too low poly to expect good results from.
There are ways to work around these harsh edges in direct lighting specifically which we probably can implement to avoid this common case as it's one of the more obvious failures when normals are pushed too far (we already employ a workaround for the issues it causes for indirect lighting), but those workarounds will cause their own sorts of artifacts in other less common cases as a tradeoff. Such workarounds also won't do anything to solve the other issues low poly geometry causes either, for instance poor looking object silhouettes/shadows or heavier reliance on bent normals for indirect lighting, only more geometry detail can do that.