Introduction
- Category: Materials
- Update: 1.1 (27-10-2020)
- Unreal Engine: 4.18 - 4.21
- Platforms: VR, PC, Console, HTML
Description
Volumetric Glass is an advanced and efficient master material designed for rendering volumetrics and glass. The package is useful for creating sci-fi stylized environments like water tanks, aquariums, and underwater tunnels even glass in submarines. The package is perfectly balanced between quality and efficiency. Designed and optimized specially for Mobile, Virtual Reality, and stylized PC/Console games.
Features
- Two types of material underwater volume and shaped glass
- GPU friendly and very efficient can be used on mobile as well as in the VR
- Multiple shapes (box, sphere, ellipse, cylinder, mesh)
- Spline based tunnel blueprint
- GPU friendly very efficient (only 150 instructions)
- Over 70 parameters to setup: light shafts, volumetric, scattering, glass color, fog density, wet color, reflections, etc.
- Animated clip plane surface
- Vertex color based texture masking
- Example map contains underwater world and sci-fi laboratory
- High-quality fast scattering
- Fast box projected reflections
- Custom multi-channeled point lights
- Easy for integrating with other water surfaces like Aquatic Surface.
Documentation
Get Started
The most important think about the Volumetric Glass is that the package is divided into two materials specialized for use in different cases:
- Glass Volume (Materials/M_GlassVolume) – Supports rendering of glasses from the inside of the fluid volume. Represents underwater windows, tunnels, glasses, and world rendered from the inside of the water. Material is called M_GlassVolume.
- Glass Shape (Materials/M_GlassShape) – Supports rendering shapes from the outside of the fluid volume. Useful for water tanks sci-fi stylization, volumetric fog used as an environmental effect.
Both materials should be instanced before using on the meshes. To create material instance from the base material click right button on the chosen material and select “Create Material Instance” option.
Glass Shape
Glass Shape material can be used on different geometric objects like a box, cylinder ellipse.
Basically, the system requires to use of meshes with unified size (100cm,100cm,100cm) and pivot in the center. The mesh can be scaled properly in actor properties. Example shapes can be found in the Package/Meshes folder.
Example of use:
- Chose the shape and place on the map. For example SM_Box
- Create a material instance from M_GlassShape
- Open newly created material instance and set up the parameters. Find the Shape tab and select the shape that you want to use:
- Setup the Reflection Texture cubemap in the material. It should be the texture cached from the scene using the Scene Capture Actor. If you don’t know how to prepare a cubemap read the Capture Reflections chapter.
- Apply glass material on your glass on the meshes and see the magic 🙂
It is not possible to use Box/Sphere shaped meshes on the characters props or customization elements because it is not geometric compatible. There is additional UseShapedMesh mode in the M_GlassShape material that implements approximated shape for the undefined shapes.
Base parameters
M_GlassVolume |
|
Use Fog Exp2 | Use exponential fog or linear if false. |
Fog Base | Base depth of the fog effect. |
Fog Density | The density of the fog effect. |
Fog Color | Color of the deep fog. |
Use Wet Color | Enable wet color functionality. |
Wet Color | The color multiplier applied to geometry inside the shape. |
Use Translucency | Whether the translucent effect should be active. |
Clipping plane surface
Clip plane surface is the effect of clipping the geometry by plane filled by an animated fluid surface.
Clip plane | |
Use Shape Clip Plane | Whether the clipping plane effect should be active |
Shape Clip Plane | Equation of clipping plane RGB-normal, A-translation |
Use Surface Normal Map | Use the surface normal map |
Surface Normal Map Texture | The texture used as a normal-map. |
Surface Normal Map UV |
UV scale and translation in an animation of normal maps on two layers.
|
Surface Normal Scale | Surface normal z value multiplier before normalization. Allow changing height ow wave. |
Surface Normal Flatness | Surface normal flatness. Allow changing height ow wave. |
Use Surface Normal Scale | Whether to use Flatness or Scale |
Use Surface Normal Map | Use the surface normal map |
Use Clip Plane Reflection | Allow using clip plane reflection effect |
Use Water Line | Allow rendering waterline on the glass. (experimental) |
Lighting
System supports multiple methods of lighting the meshes:
- coloring edges of the mesh at lower depth (simple and fast) Use Light Color Edge = true
- simplified directional diffuse light UseLighting = true
- advanced subsurface scattering (very complex slowest) UseSubsurfaceScattering = true
All of these methods can be used separately or combined at the same time. The only single light source can affect the glass and it can be point light or directional light.
Use Directional Light | True – Use Directional Light | False – Use Point Light |
Use Channel = true |
Reads the directional lighting values from global settings Materials/UtilsPC_VolumetricGlass DirLightChannel0 |
Reads the directional lighting values from global settings Materials/UtilsPC_VolumetricGlass PointLightChannel0-2. Point light channels can be controlled by the BP_ScatteringLight blueprint placed on the level with the selected channels to set. |
Use Channel = false | Reads the directional lighting values from local variable Light Direction in the material. |
Reads the directional lighting values from the local variable Light Position in the material. |
Lighting |
|
Diffuse Power | Diffuse lighting color. |
Light Color | Color of light inside the volume. |
Use Directional Light |
Whether to use directional or point light. |
Light Direction | If Use Directional Light = true then uses this value as light direction. Length of vector changes fading. |
Light Location | If Use Directional Light = false then this is the default location of the light relative to the actor. Alpha channel contains Attenuation. |
Use Light Color Edge | Use the light color as the edge of the shape. The shape will be lightened in depth. The scale of depth can be changed in the alpha channel of the Light Color parameter. |
Use Channel 0/1/2 | Select which channel will be used as a global point light. |
Scattering
Scattering |
|
Scattering Ambient | Scattering ambient value |
Scattering Depth | Scattering depth scale |
Scattering Depth Block | Scattering blocked by mesh depth inside the volume |
Scattering Distortion | Light distortion inside the scattering inside the volume |
Scattering Power | Exponential power scattering effect inside the volume |
Scattering Sale | The scale of scattering effect inside the volume |
Use Lighting | Whether the lighting and scattering effect should be active. |
Glass Volume
First, you have to place the BP_GlassVolume blueprint on the scene. BP_GlassVolume represents the shape of the fog volume that will be used for volumetric glass.
- Volume is visible only throw the glasses that use specialized material called M_GlassVolume.
- Create a material instance from M_GlassVolume and set up the parameters.
- Apply glass material on your glass meshes and see the magic 🙂
Base parameters
M_GlassVolume |
|
Use Fog Exp2 | Use exponential fog or linear if false. |
Fog Base | Base depth of the fog effect. |
Fog Density | The density of the fog effect. |
Fog Color | Color of the deep fog. |
Fog Scattering Clamp | Maximum scattering power. |
Fog Scattering Scale | Scale config of the scattering color effect. |
Fog Scattering Shift | Shift config of the scattering color effect. |
Fog Scattering Width | Width config of the scattering color effect. |
Light shafts
Glass material supports simplified optimized light shaft effect settings and configuration listed below.
Light shafts |
|
LightShaftColor | Light shaft color in scattering. |
LightShaftDistance | The distance of the light shaft effect from the camera. |
LightShaftIntensity | The intensity of the light shaft effect. |
LightShaftPosition | Camera position scale when moving light shaft. |
LightShaftSpeed | Light shaft animation speed. |
LightShaftTexture | The texture used as a light shaft. |
UseLightShaft |
Activates light shaft effect. |
Tunnel Spline
BP_TunelSplineActor is an additional blueprint useful for creating underwater tunnels. To start using this actor just place the BP_TunelSplineActor on the scene and setup parameters.
BP_TunelSplineActor |
|
Static Mesh | Looped mesh used for tube |
Forward Axis | The forward axis of the mesh. |
Translucency Sort Priority | The priority of mesh rendering. Can fix some translucency bugs. |
Hold Alt+Drag the point of spline to create duplicate of spline point.
Capture Reflections
The Volumetric Glass system renders reflections based on the cube maps cached from the scene. It is really efficient method but requires some additional effort to cache the reflection.
- Place Blueprints/BP_SceneCaptureCube on your map and set up a proper position to capture the scene (center f the room would be great).
- Open Material/Textures and find the render target (RT_SceneCapture).
- Click right on the RT_SceneCapture and select “create static texture” newly created texture is ready to use in the volumetric glass system.
Reflections Settings
The reflection effect is based on a prerendered cubemap. Volumetric glass supports two types of reflection mapping. Spherical reflections and box projection mapping.
- Spherical mapping – Very fast but inaccurate. Works out of the box.
- Box projection mapping – Very accurate in box-shaped rooms. Requires additional room size pieces of information in the materials.
Box projection mapping | |
UseBoxProjection | Allows using box projection mapping. If disabled then the system uses standard spherical cube-map projection. |
ReflectionBoxExtend | half size of the room cached in the reflection map. |
ReflectionBoxPosition | Position camera where the reflection was cached. |
UseReflectionBoxLocal | Forces system to use reflection box capture in local space of actor position. Useful when the mesh is connected to the same actor as the reflection capture component. |
Other reflection parameters:
Reflections |
|
ReflectionColor | Color of reflection allows adjusting the cubemap to underwater conditions. Alpha channel represents the power of fresnel. |
ReflectionTexture | Prebaked cubemap reflection texture should be cached in the place where the glass is rendered. |
Use Shlick Reflection | Enables physical-based Shlicks fresnel calculations. Otherwise uses a fast simplified dot(camera, normal) fresnel. |
UseReflectionBoxLocal | When true then ReflectionBoxPosition will be added to the actor position. |
Glass Settings
Volumetric glass materials support advanced glass surface configuration that allows customizing appearance to specific requirements. Glass surface is rendered before the volume and can cover the objects behind the glass.
M_GlassVolume |
|
Glass Color | Color of glass mesh (with translucency). |
UseGlassTexture | Allow using glass texture instead of flat color. |
UseGlassTextureColor | Glass texture color multiplier. |
GlassTexture | Glass texture used when UseGlassTexture = true |
GlassTextureU | Scale glass texture on U axis |
GlassTextureV | Scale glass texture on V axis |
UseGlassTexturVertexAlpha | Uses vertex color alpha channel as a multiplier for glass texture. Broken glass example. |