- Home /
I need help with 2D light effect by mask or something, please!
Hi there!
I'm struggling to find a solution to solve how to handle "faked" lights as you can see in the image attached. I'm thinking in grabbing a texture (render to texture) from a transparent layer (for example "queue"= "transparent+17") and render it in other in front of that ("queue" = "transparent+20). The idea is to "avoid" a plane with a color that tints the whole scene (p.e. at transparen+18 -) to get the original color behind and apply to it (fragment shader) the light flare texture and a geryscale mask with that form to lerp with the plane color too. But I can't tag the grabPass in a transparent layer different than the shader (That's one of my problems). Perhaps I'm thinking in a wrong way or someone can tell me another way to handle this problem.
Thank you very much! !
Answer by Fattie · May 16, 2013 at 12:29 PM
try this ... note you do need a damn transparent shader, of course:
get 2dToolkit
drop PNG in to collection
make sprite in your scene
add point light
sit camera in front of image. sit light behind image
use any transparent shader
using your mouse, move the light back and fore and you will see it shining through the sprite with incredible beauty
this image shows the light is behind the sprite, and when you move it around it moves the stained-glass lighting of the sprite
Is this what you meant?
Note for future readers -- if you simply cast the light on to the FRONT OF the sprite (example, you don't have transparent shaders available) you can get a largely similar effect, really.
Hi Fattie,
I tried yesterday at late hour your proposal, however, the point light illu$$anonymous$$ate just a little area in the sprite. Anyway, that's not the problem. I'm trying to find a cartoony effect similar to what I show you there and with your approach I can have it (even with a cookie texture in the light). I really appreciate your help (and could be a good solution) but it doesn't fit what I'm looking for (Indeed, it's is for sure texture render related and image combining). Sorry for answering a day late and any inconvenience I could cause to you.
Thank you!
"the point light illu$$anonymous$$ate just a little area in the sprite"
huh?
make the light much larger. move it further away, and increase the intensity and the light's radiius.
Yes, that's exactly what I did but nothing happened. The area illu$$anonymous$$ated was the same. I followed the exact steps but using the sprites I have in the scene ins$$anonymous$$d using new ones. Perhaps I have a problem with the sprite properties in 2D toolkit (they are transparent too). I'll give it a try again later and I'll post the results again.
What shader are you using ?
click on the sprite. click on the material. over on the left click on the material. now look at what shader you are using, lemme know
don't use the 2DT$$anonymous$$ shader for now
use Transparent/Diffuse
(Funnily enough ! by a bizarre coincidence, the T$$anonymous$$ guys are adding "see through glass effects" in the next version! can you believe it??)
Hi again,
The material is the same you point in your picture. When I get the point light near the illu$$anonymous$$ated area gets a maximum and then I can't illu$$anonymous$$ate more area. In the game the sprites are BlendVertex from 2DT$$anonymous$$. If Tk guys will make something similar to what I need it will be awesome!
Your answer
![](https://koobas.hobune.stream/wayback/20220613102352im_/https://answers.unity.com/themes/thub/images/avi.jpg)