Pages: [1] 2 3
  Print  
Author Topic: [NEWS] Lighting the Way  (Read 41183 times)
astrospoon
Shoot
*
Posts: 18


View Profile Email
« on: March 28, 2010, 10:10:24 PM »

Derek wasn't lying in that last post. Things are indeed moving along quite well as we continue to work on the Xbox 360 version. It has been quite exciting to see the project evolve from just a few sprites displaying on the screen to a game that is unmistakably Spelunky.

I guess this is supposed to be my official introduction or something! I'm Andy, the guy helping Derek with Spelunky. As there are only two of us, I'm wearing many hats on the project, but one of my main jobs is as graphics programmer.  

I thought it would be kind of neat to give a quick run-down of how the dynamic lighting works in Spelunky. This isn't going to be too technical because 1) I'm not sure how interesting that would actually be; and 2) I'm not sure how accurate I would be explaining the technical aspect. (I mean really, I did spend the last five years as a reclusive wooden toy designer...)



First, the normal maps are rendered to a texture. For those not in the know, the normal map tilts the surface of each pixel so the light will bounce off them at different angles. So the lavender color you see above indicates a flat surface facing the screen, while all the colored edges indicate different tilts at different angles.  

If you are wondering why there isn't much detail in Spelunky Man, it's because the graphics card actually generates simple normal maps for all the active entities in the game. This not only saves time (because we don't have to generate normal maps for every frame of animation of all the sprites) but it also ensures that the lighting won't make the surface details of each sprite hard to see. It does allow for a nice rim lighting effect on the sprites, so they still are able to blend nicely into the scene.
« Last Edit: March 29, 2010, 12:21:49 AM by astrospoon » Logged
astrospoon
Shoot
*
Posts: 18


View Profile Email
« Reply #1 on: March 29, 2010, 12:21:28 AM »



Once we know how each pixel is tipped, we can figure out how much light will reflect back towards the camera based on its angle. This allows us to render the lights correctly.



Before we actually use the lighting though, we need to know where the shadows are. For each light we render out a projection of each object that is in range of that light. Basically, we are drawing a blacked-out version of each object that is near the light.  Based on its position and distance from the light, we distort the drawing. Just like how when you make shadow puppets, your hands look huge on the wall.



It is here that all of the lights are combined (This example only uses one light). As they are combined, the falloff for the edges of the lights are added based on the size of the light.

You might be wondering why these shadow pictures are so pixelated. That is because all of the shadow rendering is done at a much smaller resolution so that it is faster. We are going to blur the shadows later anyway, so it isn't a big deal.



Presto! The shadows and lighting are combined, and can now be used to render the final scene. You'll notice the nice blur is applied to the shadows when we do this.



Now we render the background only, with the lighting and shadows. You might be wondering why the area outside the light isn't black in this image. That is because of the ambient light. The ambient light is light that is applied evenly to everything, and prevents anything in the scene from falling into total blackness.

In the actual game, we don't render ALL of the background like this either. We actually skip rendering anything in the background that is going to be covered up by the next step, but this makes a nicer screen shot.



Lastly, the foreground elements are rendered using the lighting without the shadows to complete the scene.

Of course, we can change the colors of the lighting for something cooler:



Or something wilder:



It was important to us to take advantage of the effects possible on the Xbox 360, while at the same time keeping the painterly style of Derek's artwork. I think we ended up with a very cool aesthetic. But if you disagree, let us know! Not everything is locked in stone at this point. The normal maps, for instance, are just quick and dirty hacks right now to get something in the game. (Heck, I already rewrote the renderer since the last set of screen shots!) We've been reading the feedback from the previous batch of screenshots and changing things accordingly.

As we get farther along on the project, Derek and I are planning on spending a lot of time tweaking the lighting in the levels. We are hoping to better differentiate between levels in the same area and areas of each level. The goal is to create more moody, varied environments for the player to explore. But it also should have some real effects on game play as well. This is especially evident in the dark levels, So I thought I would end here with a little peek at one of them:

Logged
Ultros
Bean
*
Posts: 114


NetMonster_Maniac@hotmail.com UltrosCMC ultroscmc
View Profile
« Reply #2 on: March 29, 2010, 12:55:40 AM »

Ooh, pretty.  I like how the water looks in that last pic, and it's neat hearing about the processes behind how things are being rendered.
Logged
ChevyRay
Seedling
*
Posts: 3


It's your birthday party, darling!

happytrash@hotmail.com
View Profile WWW Email
« Reply #3 on: March 29, 2010, 03:09:41 AM »

Good man!

I love it when devs are open about the development process like this; I really look forward to seeing this in motion you guys. Kiss
Logged

Hayden
Guest
« Reply #4 on: March 29, 2010, 04:22:27 AM »

We've been reading the feedback from the previous batch of screenshots and changing things accordingly.

Oh my god, thank you. Cheesy
I'm so glad to hear that there's some people who listen to their customers. Smiley

Personally, I LOVE the water effect. It looks epic. Smiley

Anyway, nice to get a full introduction from the guy that Derek has been talking about a lot. Smiley
Logged
chargen
Seedling
*
Posts: 1


View Profile
« Reply #5 on: March 29, 2010, 08:24:29 AM »

Dang it, Derek stole Andy Hull! And here I was thinking I would be getting another book for my kids any day now.

Seriously, this is great news: two talented artists working together on an inspired title like this. And I had no idea that Andy knew all this graphics programming business.

I can't wait to see the torchlights moving through these fancypants normal-mapped cave tiles. Does the shadow in the background get projecting when you walk past a light source?
Logged
edmundito
Seedling
*
Posts: 2


View Profile WWW
« Reply #6 on: March 29, 2010, 08:41:16 AM »

Wow, didn't know those little details were put into it. It's not as easy to see in the screenshots, but I bet it looks great in motion!

Since we're getting a little techie here, I was wondering if the game is being created with XNA or directly with the XDK. Can you make a game for the LIVE Arcade with XNA, anyway?
Logged
q0099
Mosskid
*
Posts: 914



View Profile
« Reply #7 on: March 29, 2010, 10:11:33 AM »

Ok, little pack of "disagree"

- make objects, which player can directly interact with, more, lets say, contrast. Like, on early screensots I couldn't tell that web, liana or gold are intractable object or just part of background. Maybe different color pallets or more contrast outline would help.

- you made a nice ground-divide algorithm (which is very good way to make random levels looks even more random). It could perfectly fit in temple levels. But caves or jungles? Maybe not so geometrical shapes, maybe not so direct edges? Some overlapping elements?

But, it all was argues about early screenshots.

And, yes, normal maps rules! I want to see how they would work with lava (air distortion, lighting, etc.).

P.S.: I totally like how you made in-background connections between some near-standing blocks.
« Last Edit: March 29, 2010, 12:15:48 PM by q0099 » Logged

Take the time to make some sense of what you want to say and cast your words away upon the waves.
Arucard
Mossy
*
Posts: 2811


Hey! Is that CANDY?!?!?

Arucard.Tepes
View Profile Email
« Reply #8 on: March 29, 2010, 11:18:49 AM »

The light distance in the dark level looks a little short, but I know it's just a preview anyway. It will be interesting to see the final product of mapping and how it gives a semi-3D effect to what was previously and entirely 2D simple pixel game.

I'm also interested in particle effects. Derek said there would be splashes when jumping in water and the like. Will there be dust floating in caverns, or a steam like distortion when crossing lava?
Logged

Oh, they look like monsters to you?

There's a light in the darkness of everybody's life.
marsgreekgod
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #9 on: March 29, 2010, 12:44:02 PM »

not bad! not bad! water is quite nice!

how are the flares working?
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Derek
Mossmouth
Mossy
*
Posts: 1291



View Profile Email
« Reply #10 on: March 29, 2010, 04:40:23 PM »

Does the shadow in the background get projecting when you walk past a light source?

Yep, the shadows move with the light!

Since we're getting a little techie here, I was wondering if the game is being created with XNA or directly with the XDK. Can you make a game for the LIVE Arcade with XNA, anyway?

Not XNA!  And I don't know if you can make an XBLA game with XNA.  I was under the impression that you couldn't, but I could be wrong.

I'm also interested in particle effects. Derek said there would be splashes when jumping in water and the like. Will there be dust floating in caverns, or a steam like distortion when crossing lava?

Yeah, I'd like to have little bits of dirt fall off the ceiling and stuff like that.  We'll go as nuts with it as we can get away with. Grin

how are the flares working?

They work more or less the same way they do in the original game.
Logged
edmundito
Seedling
*
Posts: 2


View Profile WWW
« Reply #11 on: March 29, 2010, 07:38:11 PM »

Derek, I recall attending this talk a couple of years ago about a game called Schizoid that is allegedly the first xbla game made with XNA. I remember them talking about using C# and everything. This is the only evidence I can find about it however:

http://en.wikipedia.org/wiki/Schizoid_(video_game)#Development_history

Maybe the rules have changed since then though!
Logged
antymattar
Shoot
*
Posts: 16


View Profile Email
« Reply #12 on: April 01, 2010, 10:24:30 AM »

Yes!!! but spelunky is missing the elements of easines. it neads health jars and stuf like that!
Logged
marsgreekgod
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #13 on: April 01, 2010, 10:39:30 AM »

Yes!!! but spelunky is missing the elements of easines. it neads health jars and stuf like that!
no thanks
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
grieck
Mossy
*
Posts: 1042



View Profile Email
« Reply #14 on: April 01, 2010, 12:57:27 PM »

Yes!!! but spelunky is missing the elements of easines. it neads health jars and stuf like that!
no thanks

I second MGG, doing that just wouldn't make it Spelunky anymore.
Logged
Pages: [1] 2 3
  Print  
 
Jump to: