Birthday Post! ShaderGraph conversions (WorldPosition Textureswap/Appear/Disappear)

Hey everyone! 

Today is my birthday so I want to do an extra post and just give away some Shader Graph conversions for older effects :)

Graph Files are attached to this post~ (They are unlit, but you can make them a PBR master if you want, in that case, add the edge outline to the Emission slot for a nice glowing edge )

World Position Shaders

Original Effect Post: Texture Swap & Examples with Disappear and Appear 

Here are 3 shaders that work very very similar, 

First we need a script that sends the Position and Radius of the effect to shaders.

 Shader.SetGlobalVector("_Position", transform.position);
 Shader.SetGlobalFloat("_Radius", radius);

C# Script : PasteBin Link 

Drop this on the object you want the effect on. The radius is set for all shaders with "_Radius"

Getting the Interactor Position and Radius 

Only 2 lines in code, and even in Graph form it's pretty simple:

Use a World Position Node, and a new Vector3 Property with Reference _Position, (same as the c# script), connect both to a Distance Node and we have the first line.

For the second line, divide the result of above with a new Vector1 with Reference _Radius (from the c# script), then run the result through a Saturate, and a One Minus node

Here is the important part that all the following 3 effects all use.

Noise

To make the effect look a bit nicer, add some triplanar Noise.

Add a new Texture Property for the noise ,and hook it into the Triplanar node, you can also add a Vector1 Property to control the Noise Scale.

Multiply with the Radius result 

(Try out this VFX Texture generator to make interesting noise textures!) 

 Appear 


 First add the main texture property and sample texture 2D nodes. 

 To make things appear based on the radius we need use a step node, slot the Noise Radius Result into the IN part of the Edge node, and a new Vector1 Property called Radius Noise Offset into the Edge, this offset vector1 will control the amount of noise visible in the radius. 

Hook the result to the Alpha of the master node, then multiply this result with the Main Texture for the Color.

For the Alpha to work you need to add a new Vector1 of 0.5 into the AlphaClipThreshold

Extra Edge

To make the effect look a bit more magical, let's add a coloured edge around the radius.

Add a second Step node, only before plugging in the noise radius, Subtract a new Vector1 Property called Edge Width. And this time, the (subtracted) noise result goes in the Edge slot of the Step Node, and the Radius Noise Offset into the In slot, reversing the result of the previous step we made, and with a small extra edge.

If you now multply the two step results together, you get a small white edge.

Colourize the edge by Multiplying with a new Color Property, and finally adding it to the textured result

Full Appear Graph Image : Imgur Link 

Disappear 


For a disappearing act, simple reverse the logic for textures and the Alpha.

The Alpha is the result of the Second step, and the Texture is also multiplied by the result of the Second Step, that's it!

Full Disappear Graph Image : Imgur Link 

Texture Swap

(I duplicated the Appear graph to start this one)

To swap 2 textures, nothing is slotted into the alpha channel,

Instead make another Texture 2D Property for your secondary texture, and multiply with the Second Step. Then add it to the Main Texture + Edge result.

Full Texture Swap Graph Image : Imgur Link 


Thanks for reading and have fun!

Tier Benefits
Recent Posts