Lighting up terrain...
I am creating a terrain engine generated from a heightmap, and I just finished the code to calculate all the vertex normals.
But I am fairly inexperienced with OpenGL Lighting, and when I enable a GL_LIGHT, and set up the diffuse and ambient properties, it just doesn't look right at all...
I basically want the terrain, to look like terrain, with light coming from a particular spot(a sun). When I tried it, it was either all white, or the tops of my mountains were all white, or the light didn't reach one end of the terrain.
I have read the chapter on Lighting in the Red book numerous times, but I am still stuck.
Please help me =)
Thanks
Edited by - jackthemeangiant on November 10, 2001 3:10:04 PM
the problem sounds very much like your supplying the incorrect normals.
theres a lot of info/demos/tuts on the net on how to calculate the correct normals
if u have the red book check out appendix E.
first find the normals to all the tris/quads + NOT the vertex normals once u have that info u can work out the vertex normals later
theres a lot of info/demos/tuts on the net on how to calculate the correct normals
if u have the red book check out appendix E.
first find the normals to all the tris/quads + NOT the vertex normals once u have that info u can work out the vertex normals later
Could you post your code or portions of it, perhaps screenshots of the improperly lit landscape? Maybe with a bit more info we can help you better.
Here is a screen shot:
http://jackthemeangiant.l33t.ca/invaders/lightingattempt.jpg
I can post some code if you like, but I am not sure what part you would like to see...
Thanks
http://jackthemeangiant.l33t.ca/invaders/lightingattempt.jpg
I can post some code if you like, but I am not sure what part you would like to see...
Thanks
For starters, just post the light initialization code.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Alright, I can post it later tonight...
My stupid computer crashed when i had VS6 open, and the file with all my normal calcualtions ans lighting in it became corrupted....and i have to re-write it....
My stupid computer crashed when i had VS6 open, and the file with all my normal calcualtions ans lighting in it became corrupted....and i have to re-write it....
wow.... that sux.
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
jack even though it still looks like the normals to me.
try making ambient light 0,0,0,0 + use a directional light not a positional one.
about the corrupt file from vc (i take it youre using win2000/XP)
right click on the harddisk select properties->hardware->properties->diskproperties and uncheck disk cache enabled.
u will need to do ths every time u reboot the machine.
ive been bitten a few times by crashes in win2000, when the current open c++ file has been turn into junk. grrrrr
try making ambient light 0,0,0,0 + use a directional light not a positional one.
about the corrupt file from vc (i take it youre using win2000/XP)
right click on the harddisk select properties->hardware->properties->diskproperties and uncheck disk cache enabled.
u will need to do ths every time u reboot the machine.
ive been bitten a few times by crashes in win2000, when the current open c++ file has been turn into junk. grrrrr
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement