Unity - 2d Shader ,edge highlight on objects ,colliders or 2d textures
Hi Guys and Girls. I need your guidance on this. Platforms are not visible but similar to GOnner and the player reveals the edges of the world around him. So what I am looking to do is the following. The 2 object is the platforms that you interact with. But they are not visible. Only the red sections on the platform etc will show to the player when he is close to them.
Please help me brainstorm this.
I was thinking of raycasting to the objects around to reveal but this will be performance heavy? Hit Shader then Revealing it but 2d?
The video below does a similar thing but with animation that looks great.
Please help me brainstorm this.
I was thinking of raycasting to the objects around to reveal but this will be performance heavy? Hit Shader then Revealing it but 2d?
The video below does a similar thing but with animation that looks great.
Comments
Here is a quick and (very) janky version of it.
Here's the shader code
and the script to set the screen effect...
Now naturally this looks pretty bad! You can add fade to the effect which is a mild improvement or you can animate it! But that only really changes the "Reveal Circle". If you want nicely animating platforms like in GoNNER you'll need a more sophisticated solution which will probably be far off from this.
Also keep in mind that this simple solution will discard everything not in the range. Not too nice having most of your game screen black. You can use a number of ways to avoid that, the easiest being multiple cameras and rendering "always visible" things to a separate camera.
I'd probably look at some edge detection algorithm, and feed it your level geometry. It's no longer included in Unity by default, but you can find it on the asset store and it supposedly still works. That + bloom + sorting your cameras could look quite nice!
What I do like is the half a second delay before it goes away.
https://deon-smit.itch.io/effect-test
Going to see if I cant find a shader that can show edges on 2d Sprites and somehow using what
@Gnoblar_agency showed.
Then When player is close to each fragment it gets activated. When het gets out of range the fragment get disabled after 1 second. This is a start, not exactly what I want but a start.
Knowing Ditto personally, I doubt he actually used a shader :P. He's quite the punk programmer - he probably doing individual objects with animations. So that's impressive that you got it working in one!
Do you feel like writing a bit more about the "real-time fracture of a 2d Sprite" stuff? \:D/
So I played around with this till early hours.. So what I got now is.... (Some prototype thing with no textures )
A field of View that revealed objects to 20 Alpha of its color. It also activates the RED blocks ,an area reveal objects that permanently reveals objects but not yet the backdrop. This Field of view gives a mask to the shader of the backdrop hiding the rest.
The area around the player is still based on what I showed in the previous gif.
Like you know a made a post Rage Quit which was a hard clone of other game. Now like @critic said I feel that I have a base for some sort of game. What game.... I DON'T KNOW yet..... Ideas is welcome.
Maybe the player has 2 forms. Ghost and human. Ghost has aura reveal around it. Player has a flash light.
Regards