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?
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.
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
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.
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
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.
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.
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.
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
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.
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.
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.