View Full Version : Interpolation (Gouraud)
03-16-2000, 06:20 AM
I use the Gouraud system for rendering light to my 3d set and the result is very poor. I think my normals are not correct. I see light on my polygons randomly. If i have a polygon on the (x,z) plane and i specify its normal like this glNormal3d(0.0,1.0,0.0) the reflection is perfect i have no problem so my light is ok but when i use the Gouraud system for more complex polygons i can't get the good effect. Here is an exemple of what i do.
I would like to know if i have to put negatives attributes to normal ex: (glNormal3d(x1,-y1,z1) depending on the side of the polygon i want to see and know what's wrong with my code. Thanks
i don't know what you want to render, but in the example i see you pass polygon vertices as normals... this way your normals won't be of unit length.
this will normalize any normal vector to unit length, so lighting will be good.
ps: if you've enabled lighting, a color directly specified with glColor() will be discarded, unless you've done a glEnable(GL_COLOR_MATERIAL)
03-16-2000, 06:44 AM
Yeah i know what you are telling me but i think you don't know th Gouraud interpolation system (and thats better cuz i thinks it suck hehe). I need to know my problem on this topic cause i don't want to calculate all my normal (i missed time).
03-16-2000, 06:46 AM
I forgot the glcolor is to be replaced with setmaterial sorry!
03-21-2000, 02:09 AM
Maybe i don't understand something, but why do u give the same argument to glNormal and glVertex ? (glNormal3d (x, y, z);
glVertex3d (x, y, z) http://www.opengl.org/discussion_boards/ubb/wink.gif
If it works, i will se it, but i don't think so ?
Why don't u calculate your owns normals ?
I do like that:
For each face i calculate the face normal (from the 3 points the face have)
then for each points of the 3d object, i calculate the average of the face normals which contains this point
and this is the normals of each point i give to glnormal3d
gouraud system works by linear interpolation of intensities across scanlines.
if you wish to use gouraud, wich opengl uses by default, you need to specify a color for every vertex.
if you don't use lighting.
instead, if you use lighting, then you have to specify a normal.
opengl will then apply lighting to the normal, and will find color components that then will be fed to the rasterizer.
if you specify a normal equal to the vertex, and you're rendering a triangle, the normal probably won't be perpendicular to the surface.
this way, you'll get wrong lighting.
there are cases where a normal IS equal to the vertex wich it belongs, like with unit spheres.
are you rendering planets or something like that?
however, when developing/debugging, to activate normalization could be helpful.
also is very useful to understand how T&L works, by reading the redbook.
about normal evaluation, you could precalculate them if the geometry is static, and store them into a database.
[This message has been edited by dmy (edited 03-21-2000).]
03-21-2000, 12:46 PM
Finaly i left the Gouraud interpolation and i've made my own fonction to calculate normals and my x-wing (because stars wars is the subject of this lab in an infography course) look good now. Some of my friends use Gouraud. 50% works and the other 50% doesn't work. The professor could not explain us very well why it doesnt work for everybody so i use my own method and it's better now. So thanks you all for the reply!
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.