Displaying normals

Started by
1 comment, last by n3Xus 15 years, 8 months ago
Hi, Im looking at the task of display my normals in game, for debugging purposes, like this, http://caad.arch.ethz.ch/info/maya/manual/UserGuide/ModelingPoly/images/PolyIntro.fm.anc12.gif Now for the vertex normals, its pretty easy, just read them in, and display a direction vector from the vertex location. But whats the best way to display the triangle/face normal? i know tho calculation to average the vertex normals out for the face, but how would you position the direction vector, starting off from the center of the triangle? thanks
Advertisement
I can't think of an easy way to display the face normals. What do you need this for? When you see that the vertex normals are fine then so will be the face normals, because they will be interpolated from the vertex normals.

Another way to display the normals is not by drawing lines, but by outputting the normals in a pixel shader, so red parts of the model would be the (1,0,0) normal, blue ones (0,1,0) and green ones (0,0,1). The good thing about this is that they will be interpolated by the vertex shader for each pixel in the scene.
I would avarge the position of all vertices that the face has (or google for a math function to get the triangle center point) than simply add the normal vector to that position

This topic is closed to new replies.

Advertisement