Bartosz Boczula
Bartosz Boczula

Reputation: 349

Handling normals with indexed geometry

Is it possible to use Vertex Buffer with Index Buffer and apply normals? It seems that normal is more like an attribute of a face, than an attribute of a vertex. F.e. in a cube, each vertex have 3 normals, depending on the face.

Is there a smart way of using normals with indexed geometry? Or do I have to construct only Vertex Buffer and stop using index buffer?

Thank you in advance.

Upvotes: 1

Views: 1228

Answers (1)

Dmitriy Zapevalov
Dmitriy Zapevalov

Reputation: 1357

Yes it is possible and even better to use Indexed Faces. All Normals will be stored for each Vertex like Positions.

For Cube there will be more Vertices comparing with no-normal model. But For Sphere there will be the same vertices amount (common Normal for adjacent Faces).

It is better to calculate normals when you know the source geometry otherwise result could be not reliable. For example smooth Cylinder and Prism could have same positions.

Upvotes: 1

Related Questions