Finished Erosion Shader

Made the finishing touches to my shader – a glowing edge! This is great for fire or sci-fi effects.

I gave this thickness and softness controls to allow for different looks depending on user need. The softness takes a 0 – 1 value and lerps it between 0 and the thickness value. We then smoothstep between this and the thickness. The lower the smoothness, the larger variant we’ll have between the emissive values.

You’ll notice that this relationship doesn’t make sense from a user perspective – surely it should be the other way around! For simplicity’s sake. I’ve done it this way around and then just swapped the values around on the input slider. Saves me doing remapping or a whole bunch of one minuses!

 float emissive_edge (float alpha_erosion) { 
    //when alpha is less than thickness, make pixel emissive 
    //when alpha is less than softness, make it fully emissive 
    float softness = lerp(0, _Thickness, _Softness); 
    return smoothstep(softness, _Thickness, alpha_erosion); 



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s