Skip to main content
GameDev.net gamedev.net
🔒 Locked

Silentcraft Hill ( 2D light tech-demo )

Started by AntonioR Jun 16, 2011 at 1:32 PM 12 replies 5.1k views
Original Post
AntonioR
AntonioR
In this video you can see my new 2D light system in action, I am very proud since I made it myself (DX9,C++).

It took me some time to make this level and record the video, but I think it was worth every second.
No gameplay, just atmosphere ... Silent Hill atmosphere.

[media]
[/media]
Notice the big light flickering... pretty cool effect if I might say


silentcrafthill.jpg
link161
link161
Very creepy. I like it, very atmospheric. The flicker is a nice touch and yes a very cool effect. I loved the creepers at the end lol I would be excited to see more.
AntonioR
AntonioR

Very creepy. I like it, very atmospheric. The flicker is a nice touch and yes a very cool effect. I loved the creepers at the end lol I would be excited to see more.


Thanks
KanonBaum
KanonBaum
Hey hey hey! I love this kind of stuff. So is this true 2D or is it 3D with a camera movement on a flat plane?
I'm that imaginary number in the parabola of life.
AntonioR
AntonioR

Hey hey hey! I love this kind of stuff. So is this true 2D or is it 3D with a camera movement on a flat plane?


It is genuine 2D
KanonBaum
KanonBaum
Neat! How does this lighting system work? I've been trying to figure this stuff out myself but didn't come near to producing decent results. (Blobby shadows with inaccurate distortion... blech!)

I'm definitely going to keep an eye on this!
I'm that imaginary number in the parabola of life.
AntonioR
AntonioR

Neat! How does this lighting system work? I've been trying to figure this stuff out myself but didn't come near to producing decent results. (Blobby shadows with inaccurate distortion... blech!)

I'm definitely going to keep an eye on this!


You need to know that this is not an advanced 2D dynamic light and there are no fancy shadows here.

This light technique uses a "darkness" texture that is rendered over the whole scene. Transparent areas of that texture allow parts of the scene to be visible, so you get a "light effect". Rest remains dark/black.

This is how it works:
- Render the scene.
- Clear the darkness texture so it is transparent.
- Render something on the darkness texture that is in ONE of the basic colors (I choose green).
It can be a one color texture, mesh , polygon... as long it is the same color.
- Render the darkness texture over the scene using a shader that converts pixels color value to alpha value.

The areas on the darkness texture that remain transparent will be rendered black (the darkness),
the areas that were "colored" will be transparent (the light).

This is my flashlight's light, a green texture:

flashlighte.png
EndersGames
EndersGames
yay i got it right. That is how i would have done it too
XXChester
XXChester
Very nice tech demo, the only thing that bothered me was that the light was shown behind the flash light...like you could see the character. I mean really it makes sense to see the character but maybe he should be duller than the rest of the light since he would really only be visible via a reflection.

Either way, neat little demo, keep up the good work.
KanonBaum
KanonBaum
I thought it looked bit more complicated. But still, it looks great! If you DO add accurate-looking shadows, I'd like to see how you produced them. But I'll still be looking at this.
I'm that imaginary number in the parabola of life.
EndersGames
EndersGames
Shadows could be just as easy.

You would just do a reverse of what you did already. but when a monster or other game element is in the cast of light, you just have shadow version of the cast going in the opposite direction of where the point of light is at. So when you move, the shadow's direction moves as well.

like the overhead light.

if the player is on the right of the of the overhead light. He would cast a shadow to the right.
if the player is under the light, his shadow would cast below him
and the same for being on the left.

All you need to do is check if game element is inside the lighted section.

the whole concept is pretty cool i think.
AntonioR
AntonioR
Thanks for the feedback. guys.
I am still a big noob, this was the first attempt to make some kind of light. It can always be better
WavyVirus
WavyVirus
You could also try using white light textures, rendering all lights on top of your (initially black) darkness texture with "additive" blend, then using "multiply" blend to draw the darkness texture over your scene.

This would allow lights of different colours simply by changing the light texture.



EDIT: forgot to mention that the video looks pretty good - especially the use of the lighting to create atmosphere. In the end, creatively using the lighting you have currently would be enough for some neat effects

AntonioR
AntonioR

You could also try using white light textures, rendering all lights on top of your (initially black) darkness texture with "additive" blend, then using "multiply" blend to draw the darkness texture over your scene.

This would allow lights of different colours simply by changing the light texture.

EDIT: forgot to mention that the video looks pretty good - especially the use of the lighting to create atmosphere. In the end, creatively using the lighting you have currently would be enough for some neat effects


Thanks for the comments and suggestion, but I don't know what "additive" or "multiply" blend is ?

Topic Locked

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

Sign in to reply to this topic.