Advertisement

Specular shimmer on edges of normal mapped object

Started by December 15, 2019 09:22 AM
3 comments, last by cozzie 4 years, 11 months ago

Hi all,

I've got a shader which does normal mapping in a standard way, and adds specular highlights as you'd expect as well. I would post the code, but I don't think there's anthing particularly special about it.

I like the effect, but there's a little problem when I'm looking at an object with the light directly behind it. The edges of smoother parts of the model appear to have a shimmering effect where specular highlights wrap around the edge, as seen on the legs and other areas of the model below:

Does anyone know if there's a quick fix for this?

Thanks!

Maybe normals that point away because of approximation error from triangle interpolation cause some kind of math bug in your code?

Advertisement

You could try using Blinn-Phong rather than (what appears to be) Phong:

vec3 reflectVec = reflect(-lightDir, normal);
vec3 spec = pow(max(dot(reflectVec, viewVec), 0.0), 5.0);

Another (albeit significantly more complex) way you could resolve this artifact is by using some form of anti-aliasing. Some techniques don't handle "specular aliasing" as this artifact is referred to, but techniques like Temporal Anti-Aliasing do.

I recall having this effect a number of times. In my case the cause were normals that didn't all point in the same direction. I'm not sure if there's a quick fix for it. Either anti-aliasing as mentioned (but I doubt that), or maybe a different shadowing approach. Should these pixels actually be lit or in shadow?

Crealysm game & engine development: http://www.crealysm.com

Looking for a passionate, disciplined and structured producer? PM me

This topic is closed to new replies.

Advertisement