Multi-platform graphics with URP

Arturo Nereu

Unity Technologies

x.com/ArturoNereu

Session Takeaways

  • Understand URP's features.
  • Learn about the new URP 3D Template.
  • Have fun!

Universal Render Pipeline

Universal Render Pipeline

  • Maximum Platform Reach
  • Extendable and Customizable
  • Lighting
  • Cinematic Effects
  • Artist-friendly
  • Production ready

 

URP Platform Support

Title Text

PBR

Physically

Based

Rendering

Brass_Mat

Concrete_01_Mat

Glass_Mat

WoodenPlanks_Mat

Lit Shader

RenderTexture

Shader Graph

Properties

Window > Rendering > Light Explorer

Forward

  • Per-object light limit.
  • Easy to customize.
  • Support for vertex lighting.

Deferred

  • No per-object limit for opaques.
  • Harder to customize.
  • Scales well with many lights.

Forward+

  • No per-object light limit.
  • Easy to customize.
  • Scales well with many lights.
  • Has increased CPU overhead.

Rendering Paths

Waterfall_Graph.shadergraph

WaterfallRipple_Graph.shadergraph

Shader Graphs/VegetationSSS_Graph.shadergraph

Shader Graphs/VegetationSSS_Graph.shadergraph

Shaders/Water.shadergraph

#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
#include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"


void Reflection_half(	half3 reflectVector, 
						float3 positionWS, 
                        half perceptualRoughness, 
                        half occlusion, 
                        float2 normalizedScreenSpaceUV, 
                        out half3 output)
{
    output = // output computation
}

void Raymarch_half(	float3 origin,
					float3 direction, 
                    half steps, 
                    half stepSize, 
                    half thickness, 
                    out half2 sampleUV, 
                    out half valid, 
                    out half outOfBounds, 
                    out half debug)
{
    // void
}

Water.hlsl

Oasis_Tent_Volume_Profile.asset

Oasis Fog (GO)

Outdoor Volume

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class OasisFog : FullscreenEffectBase<OasisFogPass>
{
}

public class OasisFogPass : FullscreenPassBase
{
    public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    {
		// ...
    }
}

Quality Level: PC_HIGH

Quality Level: PC_LOW

Edit > Project Settings > Quality

PC_High (Universal Render Pipeline Asset)

PC_High_Renderer

PC_High_ScreenRenderer

Outdoor Volume

OutlineEffect

using UnityEngine;
using UnityEngine.Rendering;

[VolumeComponentMenu("Sample Scene/Outline")]
public class OutlineVolumeComponent : VolumeComponent
{
    public BoolParameter Enabled = new BoolParameter(false);

    public ColorParameter outlineColor = new ColorParameter(Color.white, true, false, false);
    public ClampedFloatParameter outlineWidth = new ClampedFloatParameter(0,0, 10.0f);
}

OutlineVolumeComponent.cs

https://gist.github.com/ArturoNereu/57fe8bb98de2134756d8eeb9f34029e3

using UnityEngine.Rendering;
using UnityEngine.Rendering.Universal;

public class CockpitOutline : FullscreenEffectBase<CockpitOutlinePass>
{
}

public class CockpitOutlinePass : FullscreenPassBase
{
    public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
    {
        var volumeComponent = VolumeManager.instance.stack.GetComponent<OutlineVolumeComponent>();

        bool enabled = volumeComponent.Enabled.value;

        material.SetColor("_Color", volumeComponent.outlineColor.value);
        material.SetFloat("_OutlineWidth", volumeComponent.outlineWidth.value);
        
        if (!enabled) return;
        base.Execute(context, ref renderingData);
    }
}

CockpitOutline.cs

https://gist.github.com/ArturoNereu/8735d441a8eaefa027abbb707342833f

Assets/Scenes/Cockpit/Shaders/Planet.shadergraph

URP Sample/Cockpit/Fighter/Cockpit.shadergraph

URP Sample/Cockpit/Fighter/ToonLightingSubgraph.shadersubgraph

URP Updates in Unity 6

  • GPU Resident Drawer
  • Shadergraph UI integration
  • Code-less shader globals
  • Time of day
  • Shadergraph Heatmap
  • Spatial-Temporal Post-processing(STP)


  • Tile-based rendering
  • Volume Framework Enhancements
  • HDR Display
  • FOVeated Rendering for XR
  • URP Adaptive Probe Volumes
  • Improved compatibility and onboarding

References

Thank you!

Arturo Nereu

x.com/ArturoNereu