Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Dotren

lighting methods?

This topic is 5537 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've got three main situations where I'm going to need some sort of lighting method for my demo (space sim). 1) Sun - The sun will be a far off sphere, probably with a corona, but I want it to cast light on the entire sceen in realtime, so that when ships fly around in 3D you can see portions facing the sun being lit. 2) Engines - each ship will have a series of engines and thrusters that will be "fired" at some point or another and I'd like to have a lighting effect here. 3) Weapons - The fighters will be shooting plasma bursts which will either be spheres or plains with transparency maps. The thing is, I'd like them to cast light a certain distance so when they get near a hull you can see their light shine on the hull. Now, being new to OpenGL I have no idea how to do this. I've seen several methods of dynamic lighting, or faking dynamic lighting but I'm not sure which to use and, most importantly, where to find a good tutorial on any given implementation. I did find a site that had a few spheres in a room rotating and translating around, each casting off light onto the walls as they approached but naturally the source format is not C++ which is what I need So, if anyone could point out a good implementation to use to get the above 3 effects complete as well as a good tutorial on that implementaion I'd be most thankful Thanks, Dotren [edited by - Dotren on April 20, 2003 12:48:16 AM]

Share this post


Link to post
Share on other sites
Advertisement
Come to think of it the engine or "thruster" lighting isn''t that important but the sun and especially the weapon lighting is something I want to do.

Any ideas?

Thanks,
Dotren

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
The sun effect is simple - just set up a light at the same position of the sun and set the color and intensity to whatever your imagination desires. For the exact commands needed to set up a light get hold of a copy of the red book.

Thrusters and Laser blasts are a bit more difficult - you can only have 8 "real" lights in a scene at any one time so that means you''re going to have to use lightmaps or some other "fake" way of creating the effects you want.

Share this post


Link to post
Share on other sites
How do you do dynamic lightmaps with constantly moving sources? And for that matter, how do you define a "light", i.e. can you define any object as the light source even though it isn't a light? I'm considering making the ammo seen in space as just several plains put together texture mapped with a bright transparency map. Ideally I'd make each one of those a "source" of light and as they speed past evading ships, lightmaps appear and move along the hull according to the ammo going past.

I think if I did the sun as a lightmap it should be easier..basically any polygon facing the sun should be "lit" in a fairly uniform way with a lightmap corresponding with the sun's color.

*Edit* A great example of this is the dynamic light tutorial at:
http://www.exsanity.freeola.com/opengl.html

The problem is it isn't in C++ ... in fact I'm not really sure what it is

Thanks,
Dotren

[edited by - Dotren on April 22, 2003 7:46:43 PM]

Share this post


Link to post
Share on other sites
buy an opengl book.

OpenGL Game Programming
http://www.amazon.com/exec/obidos/tg/detail/-/0761533303/qid=1051070281/sr=8-1/ref=sr_8_1/104-6023767-2723159?v=glance&s=books&n=507846

Share this post


Link to post
Share on other sites
I would use ordinary glLights and skip lightmaps. You can have more than eight lights in a scene, it''s only eight lights per polygon. Soo if you need 16 or 32 lights (that''s alot) just render the polygon again with the new light settings and use addative blending (GL_ONE,GL_ONE).

But lighting can cripple your application. I''d probably skip the lighting on objects far away and only have the sun light them. There are other speed-ups also, like not updating the lighting for static objects. ugh! This is a huge topic

-----------------------------
Sometimes a Guru meditation must be followed by a Vulcan neck grip.

Share this post


Link to post
Share on other sites
Thanks for the tips so far all. I have been really considering that book and may just go get it today (have seen it at the local bookstore).

Dotren

Share this post


Link to post
Share on other sites
Thanks lele01... I''m really considering digging through it and seeing if theres enough of it I can figure out to code in C++. I believe its using lightmaps.

Dotren

Share this post


Link to post
Share on other sites

  • 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!