Advertisement Jump to content
Sign in to follow this  

how to calculate vertex normal?

This topic is 3656 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can anyone help me on how to calculate the vertex normal, for instance if i want to calculate the vertex normal of each vertex of a cylinder, also if one can provide me some good articles/tutorials regarding lights in direct3d, as i have understood it is one of the toughest topics in game programming, it would be very helpful.

Share this post

Link to post
Share on other sites
Say your cylinder is y-axis-aligned (y pointing up), I mean, with the two disks being parallel to the xz-plane (so their surface normals point up/down), and the main axis of the cylinder going through the point (0,0,0), then the normal for each vertex is just it's position on the xz-plane, and then normalised: n = v(x,0,z) / length (v (x,0,z)). Plugging y into that formula gives you spherical normals.

If you are creating the cylinder using sin/cos methods, then make it on the fly like:

normal.x = cos (angle)
normal.z = sin (angle)
normal.y = 0
x = radius * normal.x
y = <some height>
z = radius * normal.z

The normals of the disks are then (0,1,0) and (0,-1,0).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!