I quickly coded a small demo that renders a normal-mapped torus using both previous functions. Vec3 perturb_normal(vec3 N, vec3 V, vec2 texcoord). Mat3 cotangent_frame(vec3 N, vec3 p, vec2 uv) The article explains in detail the math behind TBN space and near the end of the article, we discover the magic functions to compute in real time a perturbed normal vector from a normal map: Yesterday, I found in my tweets a link on this article: Followup: Normal Mapping Without Precomputed Tangents. MSI Kombustor, lighting glitch in tessellated object The same method is also the source of the white line that appears on some tessellated objects like on the following picture: This method is fast but is approximative as you can show on the following picture: wee see a kind of pattern due to the imprecision of that method: When precomputed tangent vectors are not present, I usually use the following method to compute them in the vertex shader: Tangent vectors (or TBN for Tangent Binormal Normal) are useful in many situations like bump/normal mapping and the TBN vectors are usually precomputed from texture coordinates and stored as a vertex attribute. I just released the first version of GLSL Hacker and the support of precomputed tangent vectors is among the zillion of features that are missing in this first version. What a nice opportunity to stick to the latest news of the graphics programming world.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |