Skip to main content
gamedev.net
🔒 Locked

lighting methods?

Started by Dotren Apr 20, 2003 at 11:47 PM 7 replies 550+ views
Original Post
Dotren
Dotren
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]
Dotren
Dotren
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
Dotren
Dotren
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]
shadow12345
shadow12345
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

Why don't alcoholics make good calculus teachers?Because they don't know their limits!Oh come on, Newton wasn't THAT smart...
Herr_O
Herr_O
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.
Dotren
Dotren
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
lele01
lele01
the example in: http://www.exsanity.freeola.com/opengl.html is write with delphi
Dotren
Dotren
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.