Skip to content

Instantly share code, notes, and snippets.

@ArturoNereu
Created November 30, 2023 21:29
Show Gist options
  • Save ArturoNereu/8735d441a8eaefa027abbb707342833f to your computer and use it in GitHub Desktop.
Save ArturoNereu/8735d441a8eaefa027abbb707342833f to your computer and use it in GitHub Desktop.
Fullscreen Pass to allow the configuration of the Outline color and Width for Unity' URP 3D Sample: https://unity.com/demos/urp-3d-sample
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment