Original Post
I need some feedback and advice! We have a deferred rendering system, which allows for animated objects, and are hoping to add tangent space normals to it.
The renderer currently sends the following per-pixel to the post renderer:
Diffuse Color
World Space Normals
Specular Intensity and Exponent
World Space Position
The way I see it, there are two methods of doing this:
1. Calculate tangent and bi-tangent per frame of each mesh's animation, using the new object space position of the vertices and their UV co-ordinates. This seems very much the traditional method of doing things. The normal can be calculated as the cross product of the tangent and bi-tangent.
2. Render the UV co-ordinates of each vertex to a render target. Then use the world space co-ordinate texture to calculate the tangent per fragment in each frame (in screen space). Use a cross product of the global normal texture and the tangent to calculate the bi-tangent.
From either method, use the tangent and bitangent to apply the tangent space normal map.
I'm thinking that the second method, although requiring the generation of a UV texture, would still be faster as the calculations are done on the GPU, as opposed to the CPU for the first method. But is it worth the extra texture for the speed boost I'd gain?
Thoughts appreciated!
Sput
The renderer currently sends the following per-pixel to the post renderer:
Diffuse Color
World Space Normals
Specular Intensity and Exponent
World Space Position
The way I see it, there are two methods of doing this:
1. Calculate tangent and bi-tangent per frame of each mesh's animation, using the new object space position of the vertices and their UV co-ordinates. This seems very much the traditional method of doing things. The normal can be calculated as the cross product of the tangent and bi-tangent.
2. Render the UV co-ordinates of each vertex to a render target. Then use the world space co-ordinate texture to calculate the tangent per fragment in each frame (in screen space). Use a cross product of the global normal texture and the tangent to calculate the bi-tangent.
From either method, use the tangent and bitangent to apply the tangent space normal map.
I'm thinking that the second method, although requiring the generation of a UV texture, would still be faster as the calculations are done on the GPU, as opposed to the CPU for the first method. But is it worth the extra texture for the speed boost I'd gain?
Thoughts appreciated!
Sput