Lighting up terrain...
Hi Send me the code you use to calculate normals(full code that is the one calculating the trinangular normals & then the function calculating the vertex normals) also tell me what type of light you are using. then i can do something for you. see you then Bye.
manni
I will post my normal calculations in a bit, i have to finish re-writing them
Should i post them all?..becuase it is kinda long. I have to calcualte for 9 different types individualy (4 corners, 4 sides, everything else)
and to zedzeek, i am using win2k, but the disk cache checkbox is disabled for me
Edited by - jackthemeangiant on November 11, 2001 7:44:39 PM
Should i post them all?..becuase it is kinda long. I have to calcualte for 9 different types individualy (4 corners, 4 sides, everything else)
and to zedzeek, i am using win2k, but the disk cache checkbox is disabled for me
Edited by - jackthemeangiant on November 11, 2001 7:44:39 PM
I have uploaded a copy of my program, drawing the terrain in wireframe, and drawing the normals in red:
http://jackthemeangiant.l33t.ca/invaders/Invaders.rar
Press the tilde key to bring down the console, then type
"/loadmap map" without the "'s
To me, they look correct, but anyways, here is my code for calculating normals:
First of all, here is my map structure:
then it is alocated here, and map data is loaded:
now this is how I calculate the normals:
Edited by - jackthemeangiant on November 11, 2001 8:15:18 PM
http://jackthemeangiant.l33t.ca/invaders/Invaders.rar
Press the tilde key to bring down the console, then type
"/loadmap map" without the "'s
To me, they look correct, but anyways, here is my code for calculating normals:
First of all, here is my map structure:
|
then it is alocated here, and map data is loaded:
|
now this is how I calculate the normals:
|
Edited by - jackthemeangiant on November 11, 2001 8:15:18 PM
November 11, 2001 08:47 PM
Alright,
zedzeek, I tried what you said to try making ambient light 0,0,0,0 + use a directional light not a positional one. and this is what is looks like
http://jackthemeangiant.l33t.ca/valley%20of%20normals.jpg
the problem is that the light isn''t reaching all of the map.
I don''t know if I am expecting the wrong thing from gl_lighting. I bascily want a very nice looking terrain engine, like the one that used to be on glVelocity''s site Xterminate i think it was called (btw what happend to that site).
zedzeek, I tried what you said to try making ambient light 0,0,0,0 + use a directional light not a positional one. and this is what is looks like
http://jackthemeangiant.l33t.ca/valley%20of%20normals.jpg
the problem is that the light isn''t reaching all of the map.
I don''t know if I am expecting the wrong thing from gl_lighting. I bascily want a very nice looking terrain engine, like the one that used to be on glVelocity''s site Xterminate i think it was called (btw what happend to that site).
basically only the high parts are getting lit, which does suggest incorrect normals
u can also try glEnable( GL_NORMALIZE );
u can also try glEnable( GL_NORMALIZE );
From the appearence of the normals in the newly posted screen shots it seems as if they are all not of the same magnitude(that is unit magnitude) so try this
1)Don''t normalize the normals your self.
2)Use glEnable(GL_NORMALIZE) (before drawing the terrain) to let openGL normalize the normals itself then disable it after drawing the terrain using glDisable(GL_NORMALIZE).
Try this may be this works.Good Luck :-)
manni
1)Don''t normalize the normals your self.
2)Use glEnable(GL_NORMALIZE) (before drawing the terrain) to let openGL normalize the normals itself then disable it after drawing the terrain using glDisable(GL_NORMALIZE).
Try this may be this works.Good Luck :-)
manni
manni
Alright, now I think I am getting somewhere =)
this is using GL_NORMALIZE
http://jackthemeangiant.l33t.ca/w00t.jpg
Does this picture look more correct?
if it is, then what is wrong with my normalizing code?
Edited by - jackthemeangiant on November 11, 2001 12:30:30 AM
this is using GL_NORMALIZE
http://jackthemeangiant.l33t.ca/w00t.jpg
Does this picture look more correct?
if it is, then what is wrong with my normalizing code?
|
Edited by - jackthemeangiant on November 11, 2001 12:30:30 AM
try using the same light source you are using in the first screen shot you posted. One more thing before setting the light position the Model View Matrix must be Identity so that your original light position is not get disturbed. Tope it will work Good luck
manni

manni
manni
Well, from the normalization code that you posted, I''d guess that your normals will most likely never have the correct length of one unit, because you are using an integer for the magnitude. An integer does not have the precision that you need for normalizing the vectors. You should use a float or a double instead. Aside from that, the code looks right, although you could probably get rid of the test for a magnitude of 0 since the only vector that would give you such a magnitude would be the 0 vector (0,0,0).
j.w.
j.w.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement