Jump to content
  • Advertisement

Archived

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

MARS_999

Normals and GL_TRIANGLE_STRIP

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

Ok I am trying to setup my engine to do lighting on the terrain and now have to calculate normals. I am not sure but since I am using GL_TRIANGLE_STRIP and have 4 vertexs calculating a normal using 3 points and two vectors isn''t going to work is it? I mean only half the so called quad would have light right? If this is the case do I have to do the calculations on the 4th point and third vector? Thanks for the help.

Share this post


Link to post
Share on other sites
Advertisement
there are two good reasons not to.

-opengl vertex lighting doesnt look too good
-for a lot of geometry its pretty slow (for me at least, might be my mistake)
-calculating the average normal for every vertex is a pain (though you''ll do that one way or another and there a great shortcuts for grids)
-normals will take up another 3 floats per vertex (in my case not acceptable to require 80mb just for terrain geometry)

-using a normal map allows per pixel lighting
-normal map has 3byte per vertex instead of 12
-per pixel lighting looks far better
-per pixel lighting is only slightly slower than no lighting

btw. again it doesnt matter if you use strips or lists, thats just changing the order of visiting vertices and in no way what they contain.

Share this post


Link to post
Share on other sites
Trienco I don''t have any knowledge about per pixel programming. I am assuming you''re saying using normals on every polygon in a terrain engine would be suicide for speed? What are you referring to when you say a normal map? Thanks for all your help.

Share this post


Link to post
Share on other sites
a normal map would still contain all normals, with red as x, green as y and blue as z. your pixelshader/register combiner/whatever would just have to calculate the dotproduct of this normal and the light direction, multiply the result with the light color and the texture.
bonus: different levels of detail wont have different looking lighting.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
per pixel lighting requires at least a geforce 3/radeon 8500 to run , for my , at this time it''s still an expensive card, MARS , the order of vertices drawn with tri strips goes like this :

triangle 0 : v0,v1,v2
triangle 1 : v2,v1,v3
to find the normals per face get the cross product from the difference of each 2 vectors per face, as for the normal per vertex you will need to average the normals of the faces sharing that vertex that''s simply just normalizing the sum of those normals.
feel free to mail me at bytebrain@k.ro for more feedback

Share this post


Link to post
Share on other sites
Trienco: How can you have perpixel lighting ( using a normal map ) WITHOUT using vertex normals? Infact, you''d have to save at least one other vector ( tangent ) to do it, as you''d have to transform the light vector into tangent space before you perform the dot product.

Unless you''re talking about stretching a texture over the terrain, and doing a "bump" on that ( ie, so one pixel equals one vertex ), in which case it won''t look as good as standard lighting because the accuracy just isn''t as good.

Death of one is a tragedy, death of a million is just a statistic.

Share this post


Link to post
Share on other sites
Trienco:

I am curious, what video card can you possibly be using which supports normal maps yet is "slow" when rendering vertices containing normals?

Share this post


Link to post
Share on other sites
hm. that might be the reason.. im having scenes with 50k-200k

do you have a demo of that? i cant imagine 8 lights making no difference.

its a basic gf3 btw. but i thought gf2 also had register combiners. after all per pixel lighting was their great hype when they introduced it *confused*

Share this post


Link to post
Share on other sites
I guess I need to ask this since I am becoming confused. I have my terrain engine up and running, it also has textured polygons. Now if I add in lighting which I need normals for right? Will lighting still work after I have applied textures? If so how is going to look? Does anyone have a screenshot with lighting and a textured terrain engine? What I am trying to do is, allow the user to see that their is valleys and hills without having to zoom in really close to see them. As of right now its difficult to see them without getting in real close. Thanks

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!