The demo is available in three versions: OpenGL 2.1, OpenGL 3.2 and OpenGL 4.2. You can find the complete GLSL Hacker demo in the GLSL_Normal_Mapping/ folder of the Code Sample Pack. I think I won’t add precomputed tangent vector support in GLSL Hacker for the moment. The normal mapping works fine and the result is good. Normal mapping + Phong, OSX + Intel HD 4000 integrated GPU The GLSL code works fine under Windows (GTX 680 + R310.90), OSX 10.8 (GeForce GT 650M or Intel HD 4000) and Linux (Mint 13 + GTX 680 + R313.18): 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 |