[Shadernoob Q#1] How to create a transparent 2d fog of war material!
Hello
.
I am attempting to create a 2d fog of war effect. I am looking for the darkness to sit on top of my levels and then to have planes that can cut through the shadow to reveal the level underneath. I am also looking for the cut through effect to have a nice gradient and to not be a hard line
.
I have these rooms:
.
Now I will add in the shadow and I will show the desired effect that I am trying to achieve
.
.
This MUST be a material that I can apply to sprties and planes because there will be many different elements that need to have this lighting effect
.
.
What I have tried:
.
.
I have made the shadow a customer vert/frag shader that had custom variables like player position and I rendered a hole that followed the player with the fuzziness around it to give it a nice gradient effect into the shadow. My issue with this is that I want to have many rooms that have this "lighting" effect and not just the player and I do not want to have to add custom variables to the shader every time I decide a new room needs to have this lightingthat would make any sane programmer vomit everywhere
.
Using ColorMask 0 on a visibility shader that sat behind the shadow plane - this did work but I was not able to get the fuzziness / gradient effect around the edges as this just killed but it is the closet I have gotten.
.
Any help at all would be much appreciated, just a wee hobbiest who is tired of smashing his head against my desk trying to get this to work ((((:
Your answer
Follow this Question
Related Questions
2D shader / lighting like Terraria or Starbound 2 Answers
How do you access light information in a 2D sprite shader? 0 Answers
Why Won't my 2D Animation's Normals Render Unless I Have an Animator 1 Answer
can i create 2d light and darkness in unity ?? 1 Answer
Shader lighting not turning on 0 Answers