bump mapping in deferred renderer

Started by
13 comments, last by Yours3!f 11 years, 11 months ago

Your last screenshot looks like it's probably right.

BTW, these two are the same thing: vertex_output.tbn = transpose(mat3( tangent.x, bitangent.x, normal.x,
tangent.y, bitangent.y, normal.y,
tangent.z, bitangent.z, normal.z ));//manually transpose, then (un)transpose

vertex_output.tbn = mat3(tangent, bitangent, normal);



yeah I just noticed that, so no matrix transpose or inverse at all --> very cheap smile.png
and thanks for confirming AND for the help smile.png
Advertisement
vertex_output.tbn = mat3(tangent, bitangent, normal);
Should you renormalize that at fragment shader? Now values are linearly interpolated but how valid the transformation is? If you send unnormalized tangent, bitanget and normal and then normalize those at fragment shader and create matrix there you might get better results. But havent tested it myself so I can't say is there any real difference.

vertex_output.tbn = mat3(tangent, bitangent, normal);
Should you renormalize that at fragment shader? Now values are linearly interpolated but how valid the transformation is? If you send unnormalized tangent, bitanget and normal and then normalize those at fragment shader and create matrix there you might get better results. But havent tested it myself so I can't say is there any real difference.


ummm as far as I know you only need to normalize them at pixel shader stage if they're unnormalized... but I'm already sending them normalized so interpolation gives correct results. (I'm not sure about this, but I remember something like this...)
and I think thats why I do normalization in the vertex shader, in case the normals arent normalized. (which may happen if you scale the object)
but you should try it out :)
Interpolated normals does not stay normalized. This is basic thing that is done for every lightmodel. Normal is renormalized at pixel shader.

Try to lerp between [1,0,0] and [0,1,0] and you clearly see the unormalized results.
But problem is more like. Is it needed for normal mapping? Or is the problem too small to be notified.

Interpolated normals does not stay normalized. This is basic thing that is done for every lightmodel. Normal is renormalized at pixel shader.

Try to lerp between [1,0,0] and [0,1,0] and you clearly see the unormalized results.
But problem is more like. Is it needed for normal mapping? Or is the problem too small to be notified.


well, then they that should be done at pixel shader stage...

[s]well, I haven't noticed any visible errors, so I guess the error is neglible.[/s]
when I simply displayed the normals, some error is visible, that is when you normalize in the vertex shader the normals in the end are not unit vectors, but they have a little bit less length, which makes lighting a little darker. (see the cubes on the pictures)

This topic is closed to new replies.

Advertisement