Jump to content
  • Advertisement
Sign in to follow this  
MegAkozAK

LIGHTING PROBLEM please help me

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

Hi! I've got some problem with lighting more complicated models. The same lighting used in scene affects some objects in normal way for exp. wheels on the picture and( what you looking at is a ford mustang :) ) but the body of the car looks bad... http://www.michal.wlod.pl/1.jpg HELP :(

Share this post


Link to post
Share on other sites
Advertisement
static GLfloat LightAmb[] = {0.7f, 0.7f, 0.7f, 1.0f};
static GLfloat LightDif[] = {1.0f, 1.0f, 1.0f, 1.0f};
static GLfloat LightPos[] = {40.0f, 40.0f, 60.0f, 1.0f};

glLightfv(GL_LIGHT0, GL_AMBIENT, LightAmb);
glLightfv(GL_LIGHT0, GL_DIFFUSE, LightDif);
glLightfv(GL_LIGHT0, GL_POSITION, LightPos);

glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);

draw model();

Share this post


Link to post
Share on other sites
It could be your normals that are wrong
try
glEnable(GL_AUTO_NORMAL);
before u draw your model
if it looks right then (it won't be smooth shaded though) your normals are probably wrong

also make sure to enable the depth buffer
glEnable(GL_DEPTH_TEST);

Share this post


Link to post
Share on other sites
I don't think AUTO_NORMAL could be used for anything that is not related to bezier patches and NURBs, GL_NORMALIZE and GL_SCALE_NORMAL on the other hand should do the trick quite well :)

Share this post


Link to post
Share on other sites
DB is active thing that u post me changes nothing. About model it was imported from 3d max and with just a fog it looks quite normal to me... i post the model here :)

http://www.michal.wlod.pl/ggg.cpp

Share this post


Link to post
Share on other sites
now, i could be wrong here. but just from the pic being presented, it looks like the normals are fine and you just have blending enabled.

EDIT: after looking at the code, yeah normalize and invest in Right Hemisphere's Deep Explorer program, which generates simular functions but optimizes the drawing.

[Edited by - anist on May 21, 2005 10:10:27 PM]

Share this post


Link to post
Share on other sites
Check out his normals dude:

glNormal3f( (float)-10348.4 , (float)-1342.74 , (float)63.8284 ) ;

He simply need to enable the GL_NORMALIZE flag.

PS: Not to sound too harsh but I think the way you display your model is very inefficient yet original [lol]
Let me know if you're seeking a robust 3DS loader [smile]

Share this post


Link to post
Share on other sites
Can't help ya out at all on those normals as Im still screwing around with normals myself but that robust 3DS loader sounds interesting. Id be interested as well if you would satisfy my curiousity =)

~Brandon Haston~

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!