Advertisement

GL_TRIANGLE_STRIP and normals

Started by June 12, 2003 03:37 PM
8 comments, last by clutch 21 years, 8 months ago
What is the best way to compute normals for triangle strips? What I have now is broken and I am hoping a pointer in the right direction will do me good.
http://nate.scuzzy.net/docs/normals/

========================
Leyder Dylan (dylan.leyder@slug-production.be.tf
http://www.slug-production.be.tf/
========================Leyder Dylan (dylan.leyder@slug-production.be.tf http://users.skynet.be/fa550206/Slug-Production/Index.htm/
Advertisement
Depends...

Is each triangle supposed to look flat, or are the normals supposed to be interpolated as if the strip was curvy?

-solo (my site)
-solo (my site)
Right now if they look flat, that is just fine with me. I will work out averaging them later. Since I am a beginner, I figured I would make logical progressive steps, but this one has me stumped!
Here is my messed up normal problem now.

Thanks for the pointer to what normals are, but I know what they are, I thought I knew how to compute them, but I messed up somewhere, probably due to my thinking.

Mainly I am getting height data off of a raw 8 bit file and drawing triangle strips. The data comes off wonderfully. Infact I navigate through it. However, I think I need to re-examine how I come about with my normals in triangle strips.

I was just hoping to maybe find some quick items. After I can get all the flat surfaces to look right, I will go about and average each vertex with those around it to give it a smooth look.

Anyway, here is the screenshot



Warning, I am near my bandwidth limit, sorry if you can't see it.

[edited by - clutch on June 12, 2003 6:03:32 PM]
Hmmm... looks like maybe every other normal is backwards.

Maybe this is why (from NeHe's lesson 19)



Notice 1 is a left turn and 2 is a right turn so if you are computing them based on the previous and next vert you'll get it backwards every other time. Just guessing, of course... it could be something else.


-solo (my site)

[edited by - 5010 on June 12, 2003 6:19:30 PM]
-solo (my site)
Advertisement
That is interesting, I will have to give it a try.

Thanks
clutch
Thanks for all your help, I finally realized what I did. I sent my normals function all the height information and not the vertex information. As soon as I fix this correctly, I will post a final screen shot of my basic terrain engine.

Thanks again for all the help.
If you are working with heightmap terrain use finite distance approach of generating per-vertex normals. It gives better results and is about 10x faster to generate them.

You should never let your fears become the boundaries of your dreams.
You should never let your fears become the boundaries of your dreams.
Thanks for the follow up, I will have to see what I can find out there.

A quick question before I go look though.

Right now you can fly through my terrain model (no collision done yet) and the code moves the model, not the camera. Is this going to matter?

Thanks,
clutch

This topic is closed to new replies.

Advertisement