- Home /
How do I do 2D rim lighting in shadergraph?
Hello. I would like a 2D rim lighting effect for pixel art game. I am trying to match the lighting affect of katana zeros dynamic lighting without normal maps I am using URP with 2D lights and specifically want to use shadergraph for this. I currently have a shadergraph that has these effects, but I haven't figured out how to get the rim highlight color to be the color of the light source. I would assign the color myself. This means if I was walking under a blue light, the highlight color wont change to match that blue. Here are some screenshots. And this is Katana zero. This is my shadergraph
Answer by thereadypunk · Jan 17 at 11:10 PM
I figured it out! I made many different materials of different colors. Then I used box triggers to swap the material if the material name contains "Rim".
Hello, could you send me a sample of the project or show me how it is done? I'm new doing that type of effects in urp, I really want to learn that katana zero effect
Answer by kevinkemal0705 · Feb 13 at 05:06 PM
@thereadypunk Hello, could you send me a sample of the project or show me how it is done? I'm new doing that type of effects in urp, I really want to learn that katana zero effect
@kevinkemal0705 I recommend you just use proper shaders written in code as mine doesn't support multiple lights, and the edge is not relative to the object and light source. But what I did was I made a shader graph to make a hard edge on top of my sprites. This edge will be any color I choose. Then I created a folder that has many versions with different colors. Lastly, I made a script that uses triggers to detect objects that have a material name that contains "Rim" Then I use a public material to set the material name of that object. This is a bit messy, but I hope you understand the general idea.