XaiJu
minionsart
minionsart

patreon


Shader Graph - Stylized Glass

(Making a video version of this tutorial, coming soon!)


Here's the Shader Graph version of the stylized glass. Graph is attached!, you also need the script further along

I'm showing the Unlit version, but you can use same nodes in a PBR graph.


Light Direction Specular

First we make the directional light based specular effect

At the time of writing there is still no "Light Direction" node, so we're going to send it manually through a tiny script:

Put this on your Directional Light to get the right value. (Link here if you don't want to write it yourself) 

Create a new Vector4 called "_LightDirectionVec" and set it to not be exposed
Make the default non-zero to stop it showing up as magenta

Normalize the light direction, and add a dot product node using light and the Object normals.

In direct light, it's a bit too strong, to make it less static and overpowering, we will subtract the view direction from it.


And then run it through a SmoothStep node using a new properties for the Cutoff and Smoothness


View Direction Specular

Very similar to the Light Direction specular.
This time use the View Direction node and the Object Normals for the dot product, and create a new set of properties for the Cutoff and Smoothness in the SmoothStep

Add both the directional and view specular together and multiply with a new Color property

Outer Rim

For the rim, create a new Fresnel node, with a new property for the Outer Rim Power. SmoothStep using 0.5 as a minimum and a new Vector1 Property for Smoothness.

Then multiply with a new Color property to tint it.

Inner Inverted Rim

(Actually very close to the view dir specular, but the controls are a little different)

Now do the same thing but invert the fresnel with a One Minus node, and set the SmoothStep up to use a max of 0.5, subtract a new Vector1 property (Smoothness) for the minimum. Again multiply with a new Color property for tinting.


Final

Finally add an extra Color property to everything. Adding instead of multiplying so it will actually show up, otherwise the alpha will make sure it's fully transparent.

The final few nodes to output should look like this, make sure the mode is set to Transparent. And you split out the result of everything added together into color and alpha.

Extra Toonramp effect:

If you want to have a bit of a shadow effect over the glass, you can multiply the Main Tint with a smoothstep of the Light Direction/World Normal Dot

Thanks for reading!

Shader Graph - Stylized Glass

More Creators