Jump to content
  • Advertisement
Sign in to follow this  
jdub

DX11 Question about Normals and Vertices

This topic is 2299 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

So I am currently learning dx11. The tutorial I am currently looking at shows the Vertex structure being defined as having a Normal vector associated with it. However, say that I have a cube with 8 vertices and 36 indices. Wouldn't it make more sense to assign a normal vector to each face (or triangle?) as a vertex may be a part of multiple triangles each pointing a different direction? Maybe there's something I'm missing here.....

Share this post


Link to post
Share on other sites
Advertisement
A cube has initially 8 vertices, but will end with 8*3 vertices because you'll have to duplicate the vertices at each corner with each of the 3 adjacent face normals.

Share this post


Link to post
Share on other sites
Typically you split vertices that have the same position, but require different normals or UV's. This comes from the fact that when rendering triangles on the GPU your vertex shader only works with per-vertex information, and can't pull in per-face information or output it in a meaningful way. It's actually possible to do this now with geometry shaders, but using a geometry shader can have a severe performance impact so it probably wouldn't be worth it.

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!