Shaders and Visual Effects
Programmer adds water to the scene—and gets a flat blue rectangle. Asset Store delivers something from 2018 with artifacts on mobile. Writing a proper water shader yourself is non-trivial: you need to understand how the depth buffer works, how to sample normals in multiple layers, how to organize foam at geometry intersections. Without this understanding, the shader either doesn't work or kills performance.
Shaders and VFX are an area where visual quality directly depends on render pipeline technical knowledge.
URP vs HDRP: Choice Defines Toolkit
URP (Universal Render Pipeline) — Optimized for broad platform range, including mobile. ShaderGraph in URP supports most nodes, but some features are limited (volumetric lighting only through custom solutions, Screen Space Reflections in limited form from version 14+).
HDRP (High Definition Render Pipeline) — PC and consoles, photorealistic rendering. Full feature set: Screen Space Reflections, Contact Shadows, Volumetric Fog, Decal Projectors, Water System (Unity 2022.2+). ShaderGraph in HDRP has additional pipeline-specific nodes (Diffusion Profile for SSS, Eye shader).
This is crucial: a shader written for HDRP won't work in URP and vice versa. Pipeline choice is fixed at project start.
ShaderGraph: Developing Custom Shaders
ShaderGraph is a node-based shader editor in Unity. Allows shader creation without writing HLSL code. But understanding what happens "under the hood" is necessary—otherwise the graph behaves unpredictably.
Water Shader in Detail
Water is a good example because it includes several independent techniques:
1. Moving Normals Two layers of normal map textures, sampled at different speeds and UV movement directions:
Time → Multiply (speed1) → Add → Sample Texture 2D (normalMap)
Time → Multiply (speed2) → Add → Sample Texture 2D (normalMap)
→ Normal Blend (both layers) → Normal (fragment shader)
Two differently-directed layers create a wave-running effect without tiling periodicity.
2. Depth and Foam
Via Scene Depth node (URP/HDRP only, Opaque texture must be enabled) we get depth below water. Difference between scene depth and water fragment position gives water depth:
- Small depth (intersection with shore, rocks) → foam. Via
SteporSmoothstepon this value, foam mask is created. - Large depth → more saturated blue, more opaque.
3. Refraction (Bottom Distortion)
Scene Color node + UV offset by normal map. The bottom "flows" through water. Important: Scene Color captures opaque objects, so water must render in Transparent queue, after all opaque geometry.
4. Fresnel and Reflections
Fresnel Effect node—near normal to camera, surface is more transparent; at steep angle, it reflects. This is physically correct for dielectrics. On top of Fresnel mask, cubemap reflection or Reflection Probe is added.
Vegetation Shader
Animating bushes and grass without physics simulation—through vertex shader. In ShaderGraph:
-
Positionnode (Object Space) → take XZ coordinates as phase shift. -
Time→Sinewith phase shift—different phase for each vertex. - Multiply by
Vertex Colorchannel R (white = sways, black = pinned to ground)—bush base doesn't move. -
Addto vertex position along XZ.
Result: grass sways in waves, base is pinned. For "wind on player run"—add CPU parameter _PlayerPosition, calculate direction and force in shader.
VFX Graph: GPU Particle System
VFX Graph is a particle system running entirely on GPU through Compute Shaders. Fundamental difference from Particle System (Shuriken): Shuriken runs on CPU, VFX Graph runs on GPU. This means managing millions of particles without CPU load.
VFX Graph Architecture
Graph divides into contexts:
- Spawn Context — Spawn conditions: burst, constant rate, event-triggered.
- Initialize Context — Initial particle attributes: position, velocity, size, color, lifetime.
- Update Context — Per-frame logic: gravity, turbulence, collisions, attractors.
- Output Context — How to draw particles: Quad, Mesh, Lit/Unlit, Distortion.
Example: Explosion with Shrapnel
Spawn: Single Burst (count: 200)
↓
Initialize:
Position: Sphere Volume (radius: 0.1) // explosion point
Velocity: Spherical direction * Random(5, 15) // speed spread
Size: Random(0.05, 0.3)
Lifetime: Random(0.5, 2.0)
Color: Gradient by lifetime (white → orange → gray)
↓
Update:
Gravity (force: -9.8)
Drag (coefficient: 0.2) // air resistance
Turbulence (intensity: 2.0) // chaos
Collision (SDF scene or Depth Buffer) // sparks from floor
↓
Output Quad (Unlit):
Texture: spark/burn point
Blend Mode: Additive
Turbulence via VFX Graph uses Noise Field—a 3D noise texture in space. Particles deviate through this field, creating organic smoke, fire, magic movement.
Flipbook animations in Output context—sprite animation for each particle (fire, explosion, smoke as frame sequence). Flipbook Size sets grid, Flipbook Index Blend smoothly blends frames.
Post-Processing
Post-processing is effects on the final image after main render. In Unity—through Volume system (Local/Global Volume).
Stack for typical action project:
| Effect | Purpose |
|---|---|
| Bloom | Glow of bright sources. Threshold and intensity—don't overdo. |
| Tonemapping | ACES filmic—standard for realistic projects. Neutral—for stylization. |
| Color Adjustments | Contrast, saturation correction, Color Filter for biome. |
| Vignette | Edge darkening—focuses attention center. |
| Motion Blur | Blur by motion vector. Disable on mobile. |
| Depth of Field | Bokeh. In VR—carefully: DOF breaks depth perception. |
| Screen Space Ambient Occlusion | SSAO / HBAO—darkening at geometry corners runtime. |
Amplify Shader Editor — ShaderGraph alternative for Unity, popular before ShaderGraph became stable. Some projects still use ASE due to more ready examples and old-version compatibility. Functionally comparable to ShaderGraph.
What We Deliver
- Custom shader development in ShaderGraph (URP / HDRP): water, vegetation, character effects, holograms, dissolve.
- VFX Graph effects: explosions, fire, smoke, magic, environment.
- Particle System (Shuriken) setup and optimization for mobile.
- Post-Processing stack building for project visual style.
- Shader porting between URP and HDRP on pipeline change.
- VFX optimization for target platform: GPU instancing, particle LOD, culling.





