By: Aarav Kumar (2025)
Visualizing water and fluid data in a volumetric way (by representing it as it exists in the real world) can make data more intuitive and immersive. This tutorial can help you get a basic foundation on how to build a Unity project that dynamically represents water levels or fluid movement based on real-world data.
Note that Unity provides an advanced and dynamic water system in its HDRP mode, which is very effective in displaying water and requires comparatively lesser effort from the user to implement. However, if you want your project to be compatible with Android devices, you cannot build in this mode, and must use URP (Universal Render Pipeline) instead.
This tutorial will help you build a URP project with realistic water rendering and data-driven transformations, and will leverage Meta’s building blocks for Unity to allow for a passthrough experience with controller and input tracking (though this is not necessary).
Go to the following links and follow the instructions to get a base Unity project setup for XR interactions with MetaXR
Seting up Unity for XR Development: https://developers.meta.com/horizon/documentation/unity/unity-project-setup/
Setting up Your Device for XR Development: https://developers.meta.com/horizon/documentation/unity/unity-env-device-setup/
Make sure to "Fix All" outstanding issues for the Android platform (by navigating to Meta > Tools > Project Setup Tool) before you continue.
Delete any camera object (if it appears in your scene) for now, as this will be installed later in the tutorial.
From the top menu, navigate to Meta > Tools > Building Blocks.
Make sure to delete the default camera that appears under your scene hierarchy (as we will create our own, specifically for Meta Quest). Search for the "Camera Rig" building block, and click the "add" button to add it to your scene (or drag and drop it into your scene directly). You can also add additional building blocks to your scene, as required for your particular project:
If you want controller tracking, add the Controller Tracking building block
If you want to allow passthrough (AR) interactions, add the Passthrough building block
If you want to add controller input interactions, add the Controller Buttons Mapper building block
The water object will take the structure/shape of a standard object in our project. In this case, we will be using a cube, but feel free to use another shape as you wish. To add a cube in your scene, look for the + icon to add an asset (under the hierarchy window), and navigate to 3D Object > Cube to make a cube in your scene.
Then, in your scene view, look for the Move Tool (should be an icon with an arrow in each direction, right under the hand icon). Select the move tool and then select the cube in your scene view to move it in front of the Camera Rig element, so that it is visible to the user when they launch the app. You can check the direction of the Camera Rig by selecting it in the hierarchy.
Now, we can begin applying shaders to our water object to give it the texture, appearance, and movement of an actual block of water (or whatever fluid you are trying to represent). To do this, we must first understand what a shader is in Unity and how it works.
In Unity, a shader is a program that tells the GPU how to render an object. It controls how surfaces interact with light, colors, and effects like transparency or reflections. Shaders take input data (like object position, lighting, and textures) and process it to determine the final look of each pixel on the screen. For a water visualization, shaders are essential in creating realistic fluid appearances, simulating depth, and handling refractions or waves. Unity primarily uses vertex shaders (which handle object shape and movement) and fragment shaders (which define color and material properties).
Unity’s Shader Graph allows us to create shaders visually without writing code. This is especially useful for water effects, as we can blend colors, add distortion, and control transparency dynamically. In this tutorial, we’ll use a shader built in Shader Graph to create a flowing water effect that updates with data changes.
For more complex simulations like splashes or flowing currents, Unity’s VFX Graph can generate GPU-powered particle effects. While not required for basic water visualization, VFX Graph can enhance realism by adding mist, foam, or interactive fluid dynamics.
By using Shader Graph and VFX Graph, we can create shaders that:
Adjust water transparency based on depth.
Simulate realistic refractions and distortions.
Dynamically change water levels based on real-world data.
Add subtle animations for a more natural appearance.
We can then create materials that use these shaders and customize their properties, and add these materials to our water object(s) to give them the water-like appearance we desire.
For this tutorial, we will simply be downloading a free pre-made water shader and material (there are many avaiable online - easiest to find on the Unity Asset Store), which we will apply to our water object and fine tune. However, if you want more precise control over the appearance, texture, and movement of your water object, you can create your own water / fluid shader and material from scratch. There are links for both options below.
Option 1: https://assetstore.unity.com/packages/2d/textures-materials/water/simple-water-shader-urp-191449
Option 2: https://assetstore.unity.com/packages/vfx/shaders/urp-stylized-water-shader-proto-series-187485
Steps to download
Make sure you are signed into your Unity account on the Unity Asset Store page
On the asset page for the asset you have selected, click "Add to My Assets"
Once the asset is added, an option for "Open in Unity" will appear -- click on it (if you get a pop-up, select "Open Unity")
At this point, your Unity Package Manager should open up (if it doesn't you can go to it manually), with your asset added to it. Once on the asset (it should already by on the asset by default), click Download, and once that completes, click "Import to project" to add the asset to your currently open project. Import everything from the package (don't uncheck any of the checkmarks)
Adding the water material to your water object:
In your project tab hierarchy (bottom left window on Unity), you should now see a folder with the name of the asset you downloaded under Assets. Search for the water material within that folder (it will likely be located under a folder called "Materials").
Once you find it, click and drag the material directly onto your water object in your Unity scene, and you should see your object render with the material instantly.
Fine tuning the shader:
If you wish, you can fine tune the properties of your material and its underlying shader to better match your vision. Under you Scene Hierarchy (leftmost tab), select the object which you applied the water material to. You should see the added material in the Inspector. If not already expanded, expand the view of the material's options (click the arrow).
Here, you should see various options for controlling water movement, depth, and appearance. You can play around with each to see what effect it has, and adjust them as you like.
If you want to modify the underlying shader itself (i.e. add or remove certain components), you can do so by clicking the "Edit" buton next to the "Shader" option for the material. This will take you to the underlying shader implementation (ShaderGraph, VFXGraph, or a script), to which you can manually add/remove nodes or links.
Click the arrow to expand the material options.
Click edit to alter the underlying shader itself.
Demo for adding the material to the cube, and fine tuning material properites.
You can follow these tutorials (or others) to make your own custom water (or other fluid) shaders and materials to match your project specifications
URP Water Shader tutorial by Unity itself: https://www.youtube.com/watch?v=gRq-IdShxpU
Stylized water with Shader Graph tutorial: https://www.youtube.com/watch?v=MHdDUqJHJxM
Stylized water with Shader Graph (with refraction + waves + foam + smoothness): https://www.youtube.com/watch?v=1yevpCAA_rU
Water Shader with Amplify: https://www.youtube.com/watch?v=zD6GV6bZenM
To make our water visualization dynamic, we can modify the water object's position, scale, or shader properties based on external data, by incorporating a C# script into our object directly.
Some examples of what this may be useful for:
Rising water levels based on historical or real-time data (see my Project 1).
Changing transparency to reflect water clarity or pollution levels.
Altering wave intensity to represent storm conditions.
Steps to Add a Script for Data-Driven Changes:
In Unity, select your water object in the Hierarchy.
In the Inspector, click Add Component and choose New Script.
Name the script (e.g. WaterLevelController).
Open the script in Visual Studio or another C# editor.
Implement logic to update water properties based on data input.
For a sample implementation, you can reference this script, which is taken from my project 1 activity and dynamically adjusts the water level based on input data, allowing real-time or historical visualization of fluid changes.