Multi-platform graphics with URP
Arturo Nereu
Unity Technologies
x.com/ArturoNereu
Session Takeaways
Universal Render Pipeline
Universal Render Pipeline
URP Platform Support
Physically
Based
Rendering
Brass_Mat
Concrete_01_Mat
Glass_Mat
WoodenPlanks_Mat
RenderTexture
Shader Graph
Properties
Window > Rendering > Light Explorer
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
References
Thank you!
Arturo Nereu
x.com/ArturoNereu