Brute Force - Sand Shader Documentation

4. Getting started


First thing you should do is load up the sand demo scene inside the asset package "Assets\BruteForce\Scenes\StandardSand"

You will see that some files have a Standard and URP version, choose accordingly.


Once the "01_Sand" or "01_SandURP" is loaded you will be prompted to play the scene for a quick introduction. This will help you understand the asset better and showcase all its basic features in a complete environment.

In the first showcase you can use Left Click to dig the sand, Right Click to change sand into rock, Middle Click to pull sand upward.


You can click the top arrows on the screen to switch sub-showcases and the left and right arrows to switch showcases.


Additionally you can use WASD to move the mini rover when showcased, it works great as a player template leaving an interactive trail on the sand.

Importing it in your project and Components


To append the sand assets in your projects you can either copy and import one of the working showcase as a starting template or you can use the setup prefab. Keep in mind that if you need the interactive feature you have to append the CameraEffects in your scene. I will go into details on what components you need in the prefab for the sand to work properly:

Camera Effect

The first main component you'll need if you want interactivity on your sand are the "Camera Effects" like a regular camera it will be used for rendering, but instead this one will render to a target texture namely: "RTSand" and "RTSandAdditional" and will have only ONE culling mask set to "TransparentFX", we only need to render the effects.

It needs to have a target texture set to a render texture and it also needs the script "BF_InteractiveEffects.cs" for the first one and "BF_InteractiveEffectsAdditional" for the second one (which is optional, more details below). This script will make sure your cameras will render to the render textures.

If you have a moving camera you'll need to set a transform to follow (preferably the camera). RTCamAdd MUST have your main camera as transform value.

If you don't know what the global names are do not change them.

If you do not need the interactive part of the shader you can disable the CameraEffects and the "Use RT" in the material pragmas for a small performance boost.

You can increase the size of the camera projection to increase the radius of the rendered effect at a precision cost (more details below), do not rotate the RTcamera.

Sand Material


You can drag and drop any sand materials to a mesh or any assets you want to use as ground, I will explain in more depth how the Sand Shader works in the next page so you can be able to customize or create a sand material for your projects.


Particle System Effects


To control the interactive effect of the sand you can use a particle system set on the TransparentFX layer, the important thing to note is that only the rendered color matters:

Red color will turn snow into rock, Blue color will dig the sand, Green color will pull up the sand.

You can use anything that can be rendered to achieve the desired effect: meshes, sprites, particle systems etc...

This means you can place a colored quad in the TransparentFX layer to have a permanent sand effect in your scene.

Alternatively you can edit the "Duration" and "Start Lifetime" parameters of the particle system to either shorten or extend the effect duration.

Increasing the Render Texture size


Depending on your project, you can increase the size of the Render Texture field so you would be able to see sand effects from much further away.

To do so you'll need to select your RTCam in your scene and increase the "Size" Camera variable, keep in mind that increasing this value will decrease the effect resolution.


To increase the effect resolution you can change the "Size" of the RenderTexture to 2048x2048 or 4096x4096 by selecting the "RTSand" in your project. Changing this value will greatly increase memory consumption.


Using the RTCamAdd to expand the Sand effect area

In addition to the RTCam I created an experimental additive RenderTexture effect which is much larger. This camera is optional but its use is highly recommended if you intend to use the effects on a large area.


When you assign the main camera to the "Main Camera" field in the BF_InteractiveEffectsAdditional script; the RTcamAdd will automatically change its position based on the main camera FOV.