Interactive Snow w/ Tessellation for URP

Hi all,

Here is the URP version of Interactive Snow shader I made a while ago

You will need two files for this, a .hlsl file for the tessallation part, and a .shader file.


Sources (commented):

SnowTessellation.hlsl(Updated, fixed shadows) : Pastebin Link
InteractiveSnowHLSL.shader(Updated) : Pastebin Link 

Setup:

  • You need an orthographic camera pointing down. Size 15-ish.
  • Add this script  to it to feed the position and rendertexture to the shader
  • Create a new RenderTexture and drag it in the RT slot, add your Player Transform to the Interactor slot.
  • Make a new Layer for the orthgraphic camera to look at, where your particles will live. Make sure your main camera doesn't see this layer.
  • Add the SnowTessellation.hlsl and InteractiveSnowHLSL.shader file, and put them in the same folder.
  • Create new material and assign it to the plane you want the snow on.
  • Attach distance spawning particles (See below) to your player that are on the new Layer.

Tessellation

(From none to high tessellation)

For the tesselation explanation, check out the post I made a few months ago:

Basic Tessellation Setup for URP 

Distance Tessellation


Tessellation is based on distance, only close the camera will be higher poly. The max distance can be controlled with _MaxTessDistance

Vertex Color Tessellation

The tessellation is also based on vertex color, so parts without red are always low poly.

The Snow Path

This is done with a RenderTexture and an orthograpic camera above the player. The player will have particles attached that spawn over distance. Make sure these particles are on a new Layer that only the orthographic camera can see.

Particles:

As a child of your interacting meshes, set a new particle system with Start Speed 0.

Start Lifetime is how long you want to snow to stay, I've set it to between 10 and 15.

Set the Start Size to be about as wide as the mesh thats deforming the snow. with a slight random variation in it

In Emission, the particles need to spawn 10 Over Distance, and to make sure there is always an indent, also set Rate over Time to between 1 and 2

Shape is simply set to a tiny 0.1 Edge

Set the Color over Lifetime to fade to alpha 0 in a green gradient (Make sure it's pure green to avoid mixing with other particle effects!)

Finally in the Renderer;

Set the Render Mode to Horizontal Billboard

Set the Material to a standard white circle, with the Legacy Shaders/Particles/Additive (Soft) shader (or equivalent of the soft additive mode) I'm using a simple soft circle

Link to full image of particle system

It should look similar to this now, like a blobby trail. The variation in size makes it a little more natural looking

Snowfall

A little extra: quick setup for some snow particles falling down

  • General: Start size between 0.5 & 0.7, Increase max particle to 2000-ish
  • Emission: Rate of Time 200
  • Shape: Box , Emit from Volume, scale of x-50 y-50
  • Velocity over Lifetime: Worldspace, Orbital X/z between 0.1 & -0.1
  • Renderer: Billboard Standard Particle shader
  • Optionally turn on Collision

Link to full image of Particle System

Settings from Gif:


Have fun~

Become a patron to

132
Unlock 132 exclusive posts
Be part of the community
Connect via private message