The Daily Click ::. Forums ::. Klik Coding Help ::. Lighting system using black square actives
 

Post Reply  Post Oekaki 
 

Posted By Message

7Soul



Registered
  12/08/2008
Points
  167
10th September, 2010 at 05:48:40 -

I was trying to make a lighting system similar to the one used on Diablo 1, and in that game (dont remember the name) where you shoot fire with your torch, and the fire illuminates the enviroment
My screen size is small, so creating a lot of actives dont slow the game down, but i only menaged to make it work with 1 light source. Anyone knows how could this work with multiple light sources?

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
11th September, 2010 at 05:18:35 -

This may be kind of ignoring your problem by suggesting an unrelated solution... but if you're looking for a nice sharp way to create a light source, what you could try to do is:
First, make sure you're on the hardware accelerated build of MMF2. This is only necessary because of the pixel shader we're interested in.
Second, create a new later on top of your main layer. Make this layers coefficient x:0 y:0 so it doesn't scroll with the screen.
Third, span a white color, or something inverse of the color you want... like bright orange if you want dark blue. Think complimentary colors.
Now set this layer to "Subtraction". This will make everything on this layer subtract from the layer below... so for a bright orange, you'd be taking bright orange away from the colors below it, leaving a nice deep dark blue. Black will subtract nothing, while white will subtract everything.

Now, create black objects ontop of your colored background on the layer. Your subtraction layer will subtract all the color and not the black area, causing everything below that layer to appear darker, except the black area where no color is subtracted.

I hope this wasn't too descriptive, I tried to explain it as much as I could. If you want, I can make an example.
Hope this works out for you.

 
http://www.facebook.com/truediamondgame

Jon C-B

I create vaporware

Registered
  23/04/2008
Points
  237

I'm an alien!VIP MemberWii OwnerI donated an open source project Santa Hat
11th September, 2010 at 20:18:47 -

I managed to do it perfectly from what you said, thats pretty cool! Also if youre doing white as the screen coverer then making a black to white radial gradient looks really good

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
11th September, 2010 at 20:28:14 -


Originally Posted by Jon C-B
I managed to do it perfectly from what you said, thats pretty cool! Also if youre doing white as the screen coverer then making a black to white radial gradient looks really good



That's exactly how I did the lighting in Arcane Tale.

 
http://www.facebook.com/truediamondgame

7Soul



Registered
  12/08/2008
Points
  167
11th September, 2010 at 20:43:37 -

The thing is, my game is NES style, so im running the game on 256 color mode using a palette of only ~60 colors, and using that method you said really ruins the magic but thanks

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
11th September, 2010 at 21:31:40 -


Originally Posted by 7Soul
The thing is, my game is NES style, so im running the game on 256 color mode using a palette of only ~60 colors, and using that method you said really ruins the magic but thanks



Not if you make your subtraction layer completely white so its black and the light black so it's completely light. If you don't add any sort of anti-alias, theres no risk of the pixel shader accidentally creating more colors then your target palette, and if you're careful about how you use the effect, you can very effectively maintain the classic NES style.
Remember, older consoles has some techniques to do stuff (not this specifically) that we can't as easily accomplish today. Ironic, isn't it?
So don't feel bad for using more advanced techniques to accomplish an older console feel.

 
http://www.facebook.com/truediamondgame

7Soul



Registered
  12/08/2008
Points
  167
12th September, 2010 at 01:12:20 -

But then i'll have only completly black and completly (...not black), or only 2~3 types of transparency, since the palette has only 2~3 shades of gray.
I'm saying that because i've tried that before, but with a round sphere as the light, and i could only have completely lit, 2 levels of transparency and everything else black. What i want is the screen covered in black, and a little more transparent as it gets close to the character or other light sources.

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
12th September, 2010 at 03:02:07 -

All I'm saying is in your position, I'd try it. Because honestly, if you're aiming for NES, you're not even going to have transparency. You're going to have to do interpolation.

 
http://www.facebook.com/truediamondgame

7Soul



Registered
  12/08/2008
Points
  167
12th September, 2010 at 03:16:35 -

As you said "Remember, older consoles has some techniques to do stuff (not this specifically) that we can't as easily accomplish today. Ironic, isn't it?" so let's imagine this is a system that swaps the colors to a darker tone as you get away from a specific tile and thats really what it looks like

I appreciate your help, but im looking for other information, and this isn't something really important so im not in a hurry to get this working

 
n/a

Silveraura

God's God

Registered
  08/08/2002
Points
  6747

Game of the Week WinnerKlikCast StarAlien In Training!VIP Member360 OwnerWii OwnerSonic SpeedThe Cake is a LieComputerChristmas Tree!
I am an April Fool
12th September, 2010 at 04:36:18 -

If that's what you're looking for, then my effect still works perfectly fine. If you're not interested though, I'll let it go. I hope my information is useful to at least someone. Let me know if anyone finds this useful.

 
http://www.facebook.com/truediamondgame

Marko

I like you You like you

Registered
  08/05/2008
Points
  2804

Has Donated, Thank You!Game of the Week WinnerVIP Member360 OwnerDos Rules!Happy FellahCrazy EvilI am an April FoolGingerbread House
12th September, 2010 at 08:21:07 -

...it was useful/ingteresting to me, Brandon

 
Image

Subliminal Dreams. . ., daily gaming news and the home of Mooneyman Studios!
www.mooneyman-studios.webs.com

Rick Shaw



Registered
  30/04/2008
Points
  158
17th September, 2010 at 22:40:39 -


Originally Posted by 7Soul
The thing is, my game is NES style, so im running the game on 256 color mode using a palette of only ~60 colors, and using that method you said really ruins the magic but thanks



You might already have settled on something different, and I'm not 100% sure why this doesn't work for you, but...

If I wanted a retro-looking lighting effect, I would design the light in photoshop (e.g.) and then put it through a posterization filter that would down-sample the allowed colors from a pure gradient to something more like a 5- or 6-step gradient of greys.

Incidentally, I am doing exactly this with my game, which has a small resolution / limited palette, but I decided that the shadow effect looked good enough to forsake a pure retro look. Your tastes may vary, of course.

 
n/a

Rick Shaw



Registered
  30/04/2008
Points
  158
17th September, 2010 at 22:40:41 -


Originally Posted by 7Soul
The thing is, my game is NES style, so im running the game on 256 color mode using a palette of only ~60 colors, and using that method you said really ruins the magic but thanks



You might already have settled on something different, and I'm not 100% sure why this doesn't work for you, but...

If I wanted a retro-looking lighting effect, I would design the light in photoshop (e.g.) and then put it through a posterization filter that would down-sample the allowed colors from a pure gradient to something more like a 5- or 6-step gradient of greys.

Incidentally, I am doing exactly this with my game, which has a small resolution / limited palette, but I decided that the shadow effect looked good enough to forsake a pure retro look. Your tastes may vary, of course.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click