Cube Vertex Normals

Started by
15 comments, last by Todd Casey 23 years, 9 months ago
Using the vertex normal usually does not look good unless your angles are greater than 90 degrees. Wierd artifacts appear on a cube if you use vertex normals. You should create more vertices so you can have a surface normal for each face.

*** Triality ***
*** Triality ***
Advertisement
quote:Original post by Todd Casey

What is the difference between the normalized vertex and computing the vertex normal. Are those not the same thing (if not what is the difference)? Would both ways not involve normalizing the vector to get the vector normal?



No, they are not the same thing. Normalizing a vector means to make it into a unit vector i.e. a vector of length 1. A vertex normal is an extra bit of information carried in the vertex structure that tells the rasterizer how to compute the lighting for that point.

ro

Well that makes a lot more sense. I''ve seen for awhile the D3DVERTEX structure setup with the normal member set to something like (0, 0, 1). I have been putting the actual normal for that vertex in that field. So the correct way to setup the normal member in the D3DVERTEX structure is to give it the direction that the untransformed vertex is facing?

Todd
quote:Original post by Todd Casey

So the correct way to setup the normal member in the D3DVERTEX structure is to give it the direction that the untransformed vertex is facing?


if you mean the direction the coresponding face of the cube is facing (i.e. the surface normal) then yes. But if youre not going to use gouraud shading then you can use D3Ds flexible vertex format so that you dont have a normal in the vertex structure at all. I think D3D should calculate the surface normal by itself from the vertices you give it. I''m pretty sure of this. Do some research on the flexible vertex format.

Have fun,
ro

I really appriciate all of the information! I''ll check out the flexible vertex format! Thanks again.

Todd
Here is a screen shot to a little test application I made:

http://www.jack-bilt.com/todd/lighting.jpg

The cube on the left is using the normalized vertex whereas the cube on the right is using the vertex normal (the one on the left is using DrawIndexedPrimative() and the right is using DrawPrimative()). Which one is the proper one (for Gouraud shading mode)? The one on the right seems to be flat shaded am I correct? If you want to run the actual program you can grab it here:

http://www.jack-bilt.com/todd/Lighting.exe

It requires DirectX 7.0 and a 3D accelerator.

From what I have gotten from this thread I believe that the proper way everyone is saying it should be done is the way the cube on the right is done. I''m really confused if this is true because the right cube is simply flat shaded whereas the left cube is using vertex blending is it not? I guess what I have found is Gouraud shading mode can have filled triangles and then blended triangles is this correct? If this is true then which type to 3D games ususally use? Thanks again for everyone helping me through this!

Todd
I see how D3D is shading the two cubes. If all of the normals (of a triangle) are pointing in the same direction is uses flat shading but if the vertices are not pointing it interpolates between the vertices and creates the gouraud shading (assuming gouraud shading is enabled). Thanks again.

Todd

This topic is closed to new replies.

Advertisement