Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

perrs

What's the deal with Triangle Strips and normals

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

What''s the deal with Triangle Strips in dx8? I mean, I understand how they work but what about normal vectors. If I understand correct all vertices needs a normal vector when you want to use lighting. And that normal vector should correspond to the face''s (which the vertex is a corner of) normal. Correct? But when you render with Triangle Strips, one vertex can be corner for several faces. How can the vertex normal be correct for all the faces? Isn''t it only possible to use Triangle Lists then, or is there a "fancy" way around this? I mean, Triangle Lists takes op alot of space and memory. Thanks in advance. Per Rasmussen. P.S. What is the best/smallest way to store models?

Share this post


Link to post
Share on other sites
Advertisement
Usually, you want a vertex normal to be the average of all the face normals of the faces that use that vertex. This will create smooth shading. This is good for smooth objects like spheres, but bad for cubes. One way to solve this problem is with degenerate triangles.

Share this post


Link to post
Share on other sites
OK, let me see if I can explain this well...

Imagine we are talking about two sides of a cube and we want to use a triangle strip AND we want to use degenerate triangles (this may not be the best way, but we''ll run with it...)

Imagine the two sides are folded flat with 6 vertices total:

1....3....5
. . . . .
.. .. .
2....4....6

now, triangle 234 has a different normal than triangle 345, but both triangles share vertices 3 and 4. What to do?!? redo the strip as follows:

1....35...7
. . . . .
.. .. .
2....46...8

Now, set the normals of 3 and 4 to the normal for triangle 234 and set 5 and 6 to the normals for triangle 567.

There exists 2 triangles 345 and 456 that are effectively invisible and will feature interpolated shading, but again, they''re invisible. They''re only there to make the normals work.

In this case, this may not be the optimal solution because you are introducing more data, but you asked...

For highly tesselated models (basically, anything other than very simple geometry) the "vertex normal as the average of all shared face normals" way works like a charm.

Model storage:

It depends - file storage or vertex buffer storage.
vertex buffer - it depends on the format you need...
file - you can do anything you want depending on your needs and willingness to write file parsers. The binary .X files are fairly compact and easy to parse.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!