Trying to steal Vray's thunder.
I'm gonna wait for Steam version
Creating a glass material inside Unreal Engine 4 might seem a difficult task, especially if you are just beginning. Greg Amato shared a guide to building such a material that might serve multiple uses for you to master peculiarities of the Epic’s engine.
The tutorial will help you create a base glass material with three main types:
- Glass Tint
- Reinforced Glass
- Frosted Glass
Begin with setting your base material blend mode to Translucent and your Lighting Mode set to Surface TranslucencyVolume.
There are four global parameters we will use. Start by creating three Scalar parameters named Opacity, Roughness, and Specular. Create a constant and set the value to 1.
Connect this constant into Metalness of the base material.
If you like to stay organized, select the four new nodes and create a Comment box by pressing ‘C.’
Here is where we introduce the first of many Static Switch Parameters. These nodes allow the user to toggle between True and False, essentially enabling or disabling features within the material.
Create a Static Switch Parameter and name the node Use Normal Texture.
Create a Constant 3 Vector node and set the values to 0.5, 0.5, 1. This will be the flat normal value for the False state. Plug the output of the Constant 3 Vector into the False input of the Static Switch Parameter.
Create a Texture Sample node and convert it into a parameter. Be sure to place a default normal map into this node for it to be valid. For this example I created a developer texture that simulates a normal map using a flat normal value.
Connect the output of the Texture Sample into the True Input of the Static Switch Parameter.
Connect the output of the Static Switch Parameter into the Normal input of the material.
For Refraction we will use a very common setup for glass materials.
First, create two Scalar Parameters named Fresnel Falloff and IOR (Index of Refraction).
Create a Constant node with the value of 1.
Create a Fresnel node and a Lerp, or Linear Interpolate node.
For default settings of the Scalar Parameters, set Fresnell Falloff to 10.0 and IOR to 0.4.
Connect the output of Fresnel Falloff to the ExponentIn of the Fresnel node. Connect the output of Fresnel into the Alpha input of the Lerp.
Connect the Constant node output into the A input of the Lerp.
Connect the IOR Scalar Parameter into the B input of the Lerp.
The ouput of the Lerp will be used later on in the material as we create additional features that tie it all together.
Continue building the material with the full guide here.