Normal Map shading problems

It isn’t radius, because it is actual on all sizes of model and all radiuses of light probe.

do you normalize your light direction?

Yes, I do

and it is actual for the point light

Well, I’ll test it… I can’t tell just like that. So any scale different than 1,1,1 has this issue?

No, only if scale is bigger then 1,1,1

scale 1,1,1
Imgur
scale 50,50,50
Imgur

… the buggy doesn’t use PBR lighting…

I changed its material

ok, well something must not be normalized properly in the shader. I’ll look into it

You don’t have this problem, if you transform the geometry, but you have this problem, if you transform node.

The normals and tangents aren’t normalized thats what is causing this.
I’ll make a pull request.

1 Like

Don’t bother I got it.

1 Like

I pushed a fix. Thanks for the help @Perjin

1 Like

Actually you were close, the normals and tangents have to be normalized in the vertex shader.

1 Like

Let’s have the discussion here then instead of in the PR comments:
Not sure it’s a good idea tbh.
Normalizing in the vertex shader is always problematic as the interpolated value once in the frag shader will no longer be normalized, unless all normals of the triangle are pointing in the same direction. I know it’s slower to normalize in the frag shader on a pixel basis but it’s more accurate.

1 Like

Yes thats true but the mikk tangent space normal maps are computed against unnormalized normals, normalizing in the fragment shader causes slightly off shading.

1 Like

Mhh ok so that’s a feature :stuck_out_tongue: ? I mean it’s done like this so that you can normalize in the vertex shader and gain some perf or that’s pure… luck?

1 Like

Yes a feature.
Comment in the original mikktspace.h:

// where vNt is the tangent space normal. The normal map sampler must likewise use the
// interpolated and “unnormalized” tangent, bitangent and vertex normal to be compliant with the pixel shader.

2 Likes