View Full Version : about normals of vertex
11-22-2011, 02:51 AM
If i got a mesh consits of multiple poloygons,some vertices are shared by some poloygons,can i assign the different normals to the same vertex???
11-22-2011, 02:58 AM
Yes, in that case you duplicate the vertex and set desired normal to each copy.
See recent thread http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=306317#Post3063 17 and don't miss the link from remdul pointing to http://www.bytehazard.com/code/vertnorm.html
11-22-2011, 03:39 AM
Can i submit the vertex and normal data array to OPENGL,use fewer data represents vertex,and more data represents normals since a vertex correspond to multiple normals
11-22-2011, 07:40 AM
it all depends on how you would interleave your data in your VBOs and your IBOs I guess.
11-22-2011, 08:14 AM
No you can't. You must have for each vertex its normal. This will be the same for texture coordinates, colors and other vertex attributes. And this whether you use indicies or not.
11-24-2011, 02:28 AM
Theoretically, you could achieve a fixed normal:vertex ratio with glVertexAttribDivisor(). You could share each normal to exactly 3 vertices for example. However this fixed ratio is in use for a whole draw call, which makes it difficult to be useful for normal sharing. Also you need to use glVertexAttribPointer() etc., and needs at least OpenGL version 3.3.
Vertex duplication is general and effective solution, just go for it.
If you want, you can add an abstraction layer above OpenGL buffers, where you can set attributes per "point" (same vertex location) and per "corner" (corner of specific polygon). When baking these to OpenGL buffers you can merge corners which are equal (or close enough) to a single vertex. Corners with differing attribute values must have the whole vertex duplicated.
11-24-2011, 04:30 AM
It is covered in the Wiki
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.