Tech Blog :
Jully 2022
Unity 2022 BETA Test
Unity 2022 beta is available, and I want to take a look, focusing on HDRP
Some new feature I am excited to test :
-
The new Water system for Ocean, pool and Lake
-
The new Volumetric Materials using ShaderGraph to create custom clouds and fog shapes
-
The new FullScreen ShaderGraph master node for CustomPass and Post Process
-
The new Adaptive Probe Volumes
-
The new cinematic eye shader with caustics from Ennemies
-
And finally the new support for CustomRenderTexture within ShaderGraph, let's do some raindrop.
Getting started
To grabb the stuff, we need to start a New Project using HDRP and activate all the options regarding Water activation into the HDRP asset.
Install the High Definition Render Pipeline from the Package Manager, with a classic configuration, the HDRP Wizard act as a PopUp tab to help to setup the HDRP in the project correctly, I did use the DXR setup
for this chapter. Otherway we found it under Windows > Rendering > HDRP Wizard
I do Embed the Configuration Files and use only one HDRP Asset in the quality settings in the Project Settings, and then I use the wizard to fix all the resources for me, everything should be green as in the image below.

The new Water system is not finished yet, but the community can already use it and take a look with the Unity 2022 Beta version. Lets take a look :

The HDRP Asset can be found in the Assets folder or from the Project Settings tab.
Open the HDRP Asset, and look for the Water label, enable the stuff.
I choosed to check Script Interaction, because I want to test to make an object floating on the water

In the Project Settings, we now need to get into the HDRP Global Settings under Graphics Settings. Let's add Water Rendering in the Default Volume Profile, and enable it as in the left image below.
After that, scroll down and go into Frame Settings, deploy Camera > Rendering and check Water, just as in the right image below.


Once we have setup this option we are good to go, and then I can create an Ocean Objects using the GameObject > Water Surface > Ocean Sea or Lake into our scene.

Here I have a Presets file to apply settings to get this Ocean : Drive Link.
Here is the Sky & Fog Volume that apply the Cloud.
Before using it, make sure enable Cloud in the HDRP Asset and in the HDRP global Settings I show earlyer.
Ok, now our Scene is pretty but let's add a floating objects that have some "buoyancy" that go acoording to our Ocean, so I did take a look on the Unity Forum to found the Beta Features announcement tread, luckily a Unity dev did share a script in the tread, so here we are to Copy / Past it to our project named FitToWaterSurface.cs.
using UnityEngine;
using UnityEngine.Rendering.HighDefinition;
public class FitToWaterSurface : MonoBehaviour
{
public WaterSurface targetSurface = null;
public int numIterations = 8;
public float error = 0.01f;
// Internal search params
WaterSearchParameters searchParameters = new WaterSearchParameters();
WaterSearchResult searchResult = new WaterSearchResult();
// Update is called once per frame
void Update()
{
if (targetSurface != null)
{
// Build the search parameters
searchParameters.startPosition = searchResult.candidateLocation;
searchParameters.targetPosition = gameObject.transform.position;
searchParameters.error = error;
searchParameters.maxIterations = numIterations;
// Do the search
if (targetSurface.FindWaterSurfaceHeight(searchParameters, out searchResult))
{
gameObject.transform.position = new Vector3(gameObject.transform.position.x, searchResult.height, gameObject.transform.position.z);
}
}
}
}
Once this script added to the project, I did create a simple sphere, conserving the SphereCollider, I did added a rigidbody and our new Fit to Water Surface script.

I am pretty happy of this floating sphere... I would likely replace the sphere with a little boat, a piece of wood or a bottle with a coded message inside :)
Ho dear,
I was waiting this one a long time ago, the equivalent in Unreal Engine is pseudo-volume, the idea behind the Volumetric materials is to allow the user to author a Volumetric object (like a cloud) using a ShaderGraph shader.
Why do I love the idea? Because pseudo volume are already used and beloved by the unreal tech folk, in Unity and until now, we had no direct way to do this stuff using the HDRP's fog. I was thinking about a workaround using a 3D CustomRenderTexture written by a Shader, to inject noise, or use some simple sphere or gradient masking as parameters to tweak the texture before injecting it into a local Volumetric Fog.
Let's Verify first if we can create this type of Shader.. It appear to show under window Shader Graph > HDRP > Fog Volume Shader Graph

Lets create a Local Volumetric Fog object into the scene.. Window : GameObject > Rendering > Local Volumetric Fog

In the way to make my test I figure out that I need to be able to put a 3D Texture, as I lost the ability to use the texture slot when the local volumetric fog is set to Material instead of Texture.
But first I need to understand how to deal with UV, because every Texture need some UVs, So let's open the Shader and test some stuff with uv..
I added a Texture3D property connected to a SampleTexture3D node, this sampler is connected to a classic UV node set as uv0

And then I decide to add a Vector4 property to control both tiling and offset of the 3D noise texture, let's add a SamplerState to specify it as tilable texture anyway

Let's check if our Local Fog Volume Object now that I have setup the shader to use a 3DTexture into this newly created property.
Here is two 3DTextures that I used to try I my project, both are random noise generation from Photoshop (1) and Krita(2) :
Column = 32 Row = 1

Column = 16 Row = 1


Column = 16 Row = 1
I change the Local Volumetric Fog Shader to use the first one in the 3DTexture property. And now I can check the result

I don't have acces to the Tiling properties, so you may have an issue if the XY value of _TilingOffset is equal to 0 as default value in the shader, set them to one and you should see the texture as normal
- - >THIS PAGE HAS BEEN TURNED INTO A BLOG POST