Lighting is a bitch...

Published July 11, 2006
Advertisement
Hey everyone!

I didn't get much done today, but I did manage to get lighting working the way I want it to, and in the process I got a pretty cool screen, so read on!

Lighting
As many of you saw in the video I released a couple days ago, the A22 Engine allows for the time of day to be set, and the lighting of the level is affected accordingly. Well, initially I thought I would be able to get away with a semi-transparent quad rendered over the entire scene. This works just fine until you want things to be unaffected by the darkness, such as fire. Well, then I thought, "I'll just render the fire over the quad, and everything will be ok!"... no, everything was not okay. You see, the fires you see in game are particle emitters, emitting sprites the start off as fire, then turn into smoke, and then fade away. I ran into a big problem, because when the smoke fades away, it gets to a point where you can't see the sprite, but its alpha is still greater than 0, so it passes the alpha test, and it gets rendered as though the quad never existed, meaning they would be visible as bright blue smoke puffs, which didn't look very good. So yesterday, I actually sat down and used OpenGL's built in lighting to handle it, which was a royal pain in the ass for some reason. But anyways, the lighting works fine now, and now things(ie. fire) can "glow" in the dark and not be dimmed.

Lighted Buildings
As ukdm suggested in an earlier post, a big boost to the "coolness" of having night levels, is the ability to have "glowing" windows and lights. Well, little did you guys know, but we've actually been working on this! We have these overlay textures for each building with yellow lights and whatever we want to show up at night, and once the ambient light level drops below a specified amount, these overlays are dropped over the buildings creating the effect you see in todays screenshot. Hurray ingenuity!

Well, I guess I'll give you guys a screenshot of the new light model, with cool fires and lit buildings, its pretty cool IMHO.



Also, notice the new Radar. I was unaware that the earlier version of the radar that Mark gave me was not the final version, but we have a new one now, and it looks pretty cool.

Thats all for now, let us know what you think! Peace Out!
Previous Entry Sweet....
Next Entry Un Grande Entry-o
0 likes 9 comments

Comments

Programmer16
Awesome doesn't begin to describe it, but that's all I can come up with.
July 11, 2006 03:20 AM
Sir Sapo
Thanks!
July 11, 2006 03:39 AM
Samsonite
Thats awesome! Very nice work! I escpecialy like the window glow, thats great!

Oh, and how do you do lights in OpenGL? I did some yesterday with my isometric 3D demo, but I can't control the strength of a light, and the positions are all f***ed up...[grin]
July 11, 2006 06:29 AM
Gaheris
Yay, Marks new radar is just the way I wanted it to be: not as dark and with a neat bevelled border around the screen. Thanks a lot Mark! However, what's what "Caution" sign doing there? Will it flash whenever there is a missile targeting your plane? That would be awesome.

Great work on the lightning by the way, will you add street lamps which emit light? How about some flare ammunition for the flaks as well as search lights. That would be awesome, don't you think?
Night and day cycles are great, but have you considered that the sky doesn't simply change from dark blue/black to light blue, but rather has some red/yellow colors in the morning and evening too? Maybe you could event add some kind of gradient for the sky background, lighter colors at the bottom and darker on the top.

Well, those are just some ideas, your game is already great the way it is. Thanks for sharing.
July 11, 2006 10:27 AM
Sir Sapo
Quote:
Thats awesome! Very nice work! I escpecialy like the window glow, thats great!

Oh, and how do you do lights in OpenGL? I did some yesterday with my isometric 3D demo, but I can't control the strength of a light, and the positions are all f***ed up...[grin]


Well, I spent about 5 hours struggling with the samw problem you have been describing before I found a way that works. I actually don't use any lights at all, I just set the ambient light to as bright as possible, and then set up a Material the will light up the way I want, the code looks something like this


glEnable(GL_LIGHTING);
float ambient[] = {1.0,1.0,1.0,1.0}; 
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);

/*lightlevel is a float that can be from 0 to 100 and represent... the lightlevel, 100 being bright as day, and 0 being completely dark*/
float lightcol[] = {(lightlevel/100.0),(lightlevel/100.0),(lightlevel/100.0),1.0};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightcol);





Sorry if that doesn't help, I'd be glad to help you figure out the problem if you need help.

Quote:Yay, Marks new radar is just the way I wanted it to be: not as dark and with a neat bevelled border around the screen. Thanks a lot Mark! However, what's what "Caution" sign doing there? Will it flash whenever there is a missile targeting your plane? That would be awesome.

Great work on the lightning by the way, will you add street lamps which emit light? How about some flare ammunition for the flaks as well as search lights. That would be awesome, don't you think?
Night and day cycles are great, but have you considered that the sky doesn't simply change from dark blue/black to light blue, but rather has some red/yellow colors in the morning and evening too? Maybe you could event add some kind of gradient for the sky background, lighter colors at the bottom and darker on the top.

Well, those are just some ideas, your game is already great the way it is. Thanks for sharing.


Thanks, the caution sign actually changes from "Clear" when nothing is tracking you, then "Caution" when you are being tracked, and the "WARNING" when a missile is in the air. You can see in the left side of the screen, a SAM site has me targeted, hence the "Caution".

The great thing about the lighting overlays is that we can pretty much do anything we want, so yeah I would count on streetlamps and whatnot. As for searchlights, Mark and I have something cool in store for those... The flak amunition does actually light up like the windows, and changes color to green which is extremely bright in the night levels, which is cool. As for flare amunition, not so sure about how I'd code that, but we're thinking about the player having flares(anti-IR missiles, not light up the night), and that would be cool if they lit up the night too!

The sky right now is just a simple colored quad, so as soon as Mark draws up a background, we'll be able to do exactly what you just described[grin]

Thanks for the comments everyone!
July 11, 2006 11:53 AM
Sir Sapo
Quote:
Thats awesome! Very nice work! I escpecialy like the window glow, thats great!

Oh, and how do you do lights in OpenGL? I did some yesterday with my isometric 3D demo, but I can't control the strength of a light, and the positions are all f***ed up...[grin]


Well, I spent about 5 hours struggling with the samw problem you have been describing before I found a way that works. I actually don't use any lights at all, I just set the ambient light to as bright as possible, and then set up a Material that will light up the way I want, the code looks something like this


glEnable(GL_LIGHTING);
float ambient[] = {1.0,1.0,1.0,1.0}; 
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient);

/*lightlevel is a float that can be from 0 to 100 and represent... the lightlevel, 100 being bright as day, and 0 being completely dark*/
float lightcol[] = {(lightlevel/100.0),(lightlevel/100.0),(lightlevel/100.0),1.0};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, lightcol);






Sorry if that doesn't help, I'd be glad to help you figure out the problem if you need help.

Quote:Yay, Marks new radar is just the way I wanted it to be: not as dark and with a neat bevelled border around the screen. Thanks a lot Mark! However, what's what "Caution" sign doing there? Will it flash whenever there is a missile targeting your plane? That would be awesome.

Great work on the lightning by the way, will you add street lamps which emit light? How about some flare ammunition for the flaks as well as search lights. That would be awesome, don't you think?
Night and day cycles are great, but have you considered that the sky doesn't simply change from dark blue/black to light blue, but rather has some red/yellow colors in the morning and evening too? Maybe you could event add some kind of gradient for the sky background, lighter colors at the bottom and darker on the top.

Well, those are just some ideas, your game is already great the way it is. Thanks for sharing.


Thanks, the caution sign actually changes from "Clear" when nothing is tracking you, then "Caution" when you are being tracked, and the "WARNING" when a missile is in the air. You can see in the left side of the screen, a SAM site has me targeted, hence the "Caution".

The great thing about the lighting overlays is that we can pretty much do anything we want, so yeah I would count on streetlamps and whatnot. As for searchlights, Mark and I have something cool in store for those... The flak amunition does actually light up like the windows, and changes color to green which is extremely bright in the night levels, which is cool. As for flare amunition, not so sure about how I'd code that, but we're thinking about the player having flares(anti-IR missiles, not light up the night), and that would be cool if they lit up the night too!

The sky right now is just a simple colored quad, so as soon as Mark draws up a background, we'll be able to do exactly what you just described[grin]

Thanks for the comments everyone!
July 11, 2006 11:55 AM
-justin-
really awesome, great job!

i dunno what kind of enemies you have, or if this has been suggested, but you could totally (with your lighting feature, which i still dont get how it's done :P) have some spotlights that could move around

anyway keep it up! definately progressing a lot better than me ^^
July 11, 2006 01:09 PM
Manaxter
It would be good to add some sort of muzzle flash or something at night, and like justin said, have some searchlights (though that doesn't really sit with your timeframe!)

Cheers
Jacob
July 12, 2006 01:01 AM
benryves
Gorgeous. This project keeps looking better and better. [smile]
July 12, 2006 07:24 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

!

1181 views

'Roids

1483 views

Post Dva

1265 views

Untitled

1100 views

I'm a sad panda...

2105 views

Untitled

1003 views

Progress

1048 views

Angels 2X!!!!!

1470 views

T3H Progress!

1294 views

ZOMG!!!!

1174 views
Advertisement