Jump to content
  • Advertisement
Sign in to follow this  
rm2000

OpenGL Lighting suggestions

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

I have read quite a bit (especially through searching the forum) on the issue of lightmapping. One thing I read is that 3DSMax will actually bake lighting into an object or scene so I wouldn't have to manually implement lightmapping. Here is the thing. I understand the process of applying a lightmap to a single quad. But if I have an arena made up of a group of triangles, I am not sure how to stretch a lightmap texture over a larger section. I can't seem to find details about this that make any sense, honestly. I have that there are new technologies, if I am correct, such as pixel shaders and such. Right now I pretty much just have a level load with the textures bound via glBindTexture to the UV coordinates and I'm not sure what is the best way to go. I used the basic OpenGL lights but they are sort of ho-hum. While I want the game to look decent, I don't want to make a person run the latest and greatest hardware. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
OpenGL lighting looks decent as long as you are loading normals for your vertices. The only thing is you will be using per vertex lighting and not per pixel. To do per pixel you will have to use a normal map and the combiner functions in FFP or a shader of your choice. Lightmaps might be ok for static geometry, but if you plan on having objects that move the static lighting will look wrong when they turn around and the darkened side still follows the object and not where the lighting is coming from... If you want decent lighting and most hardware to run it use OpenGL's built in lighting with normals.

Share this post


Link to post
Share on other sites
Just to clarify MARS_999, you are talking about vertex lighting when you say it looks decent?

So far I am just using:

glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse);
glLightfv(GL_LIGHT1, GL_SPECULAR,LightSpec);
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition);
glEnable(GL_LIGHTING);

which gives me kind of generic results. My scene is pretty much static so you are saying that I can use vertex shading (using glColor3f) and still get something nice looking? From what I was understanding to do that for every triangle in my scene would really slow it down. Is that so?

Share this post


Link to post
Share on other sites
A comparison that I have so far of my demo

With basic OpenGL lighting
With no lighting




Just looking for other ideas.

Share this post


Link to post
Share on other sites
No what I was thinking is you upload all the normals for your vertices, and then you use openGL lighting and you have no need for glColor3f() as the normals will light each vertex correclty. Also why are you using glLight1? Do you have a need for more than one light? Because the defaults for light1-7 are not the same as 0.

Share this post


Link to post
Share on other sites
Well the level (as of now) is 3DS and it computes the normals as it is being loaded. Not sure why I used LIGHT_1, I just put all of my settings into LIGHT_1. I didn't think there was a difference...

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!