Jump to content
  • Advertisement
Sign in to follow this  
deavik

OpenGL GTA 3 smooth objects

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

Take a look at this screen from GTA 3: click. Look carefully at the car (Kuruma). See how the roof is smooth and curved? How do they manage to do that without an insanely high number of polygons? They use DirectX and we are OpenGL followers but the principle must be the same. Their models can't have a huge number of polys as even with 10 cars in the scene at once it does not drop frame rates. So how so they do it?

Share this post


Link to post
Share on other sites
Advertisement
I don't know,

But i am always amazed at how they make that game, and the preceeding ones.

I too would like to know.

ace

Share this post


Link to post
Share on other sites
I really don't know much about 3d rendering but that looks like basic (untextured) gouraud shading to me.

Share this post


Link to post
Share on other sites
Probably 4 polys tops, along with gouraud shading, smooth normals, and the specular highlights to top it off. Really quite simple.

Share this post


Link to post
Share on other sites
Hey you're right! I did a google and it turned up interesting results from wiki. So what is the algorithm for gourad shading? I have the face normals calculated, I don't know how to calculate vertex normals.

EDIT:

Promit, it's very simple to you putting it one after the other, but it's all hebrew to me as far as coding goes. What are "smooth normals"? And the specular hilight - how do I code?

Share this post


Link to post
Share on other sites
Quote:
Original post by Promit
Probably 4 polys tops, along with gouraud shading, smooth normals, and the specular highlights to top it off. Really quite simple.


Wow, im surprised i actually know what you are on about, haha.

I can try and explain for you deavik

4 Poly-tops: not entirely sure, but probably 2 quads end on end?
gauroud shading: a smoothe shading equation for smooth blending accross a surface

smooth normals: rather than the normals being perpendicular to the surface they are interpolated with the normals on adjacent surface so more rounded lighting is achieved without obvious differences.

Specular highlighting is the component of the phong lighting model where you get to a specific angle and the surface glares at you.

Correct me if im wrong.

ace

Share this post


Link to post
Share on other sites
Vertex normals are calculated by finding all the faces that use the vertex and add those faces' normals together and divide the resulting vector by the number of faces.

Note, this will give you the smooth normals you're looking for. In practis, normals are mofified by gfx artists in a 3D program ... Then *they* decide which vertices should have hard/smooth/user defined normals.

Share this post


Link to post
Share on other sites
Quote:
Original post by deavik
Hey you're right! I did a google and it turned up interesting results from wiki. So what is the algorithm for gourad shading? I have the face normals calculated, I don't know how to calculate vertex normals.

EDIT:

Promit, it's very simple to you putting it one after the other, but it's all hebrew to me as far as coding goes. What are "smooth normals"? And the specular hilight - how do I code?

A vertex normal is just the normalized sum of the normals for all faces it is part of.

For specular highlights: Check out glMaterial (specifically GL_SPECULAR and GL_SHININESS) and the corresponding settings for the light sources (glLight)

Share this post


Link to post
Share on other sites
OK, I got the part about what smooth normals are. How do I use them? Let's say I find out which faces are using a particular vertex (which I have no idea how I am going to do yet), I average out their normals, then what? Does it go like this:

glNormal3f(..,..,..)
glVertex3f(..,..,..)
glNormal3f(..,..,..)
glVertex3f(..,..,..)
..........

And also, after I have got the smooth normals, what is the gouraud shading algorithm?

One other thing - there were 7 replies to this post within 24 minutes. Amazing!

Share this post


Link to post
Share on other sites
Yes, that's how you do it. Goraud shading, which basically means that the vertex colors (including the result from lighting) are interpolated over the triangles, is applied automatically.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!