Created
November 30, 2023 21:29
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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