Class TargetOutlineFeature
Draws TargetOutline's target: a ring of the outline colour and width round the object's visible silhouette.
public class TargetOutlineFeature : ScriptableRendererFeature, IDisposable
- Inheritance
-
ObjectScriptableObjectScriptableRendererFeatureTargetOutlineFeature
- Implements
- Inherited Members
-
ScriptableRendererFeature.OnCameraPreCull(ScriptableRenderer, in CameraData)ScriptableRendererFeature.Dispose()ScriptableRendererFeature.isActiveScriptableRendererFeature.useIntermediateTexturesScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.MemberwiseClone()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Three passes, after post-processing, so the colour lands exactly as chosen (no tonemapping, grading or bloom) and before the UI:
- Mask (RGBA8): each outlined renderer drawn flat, rgb its colour and alpha its width. Fragments behind the scene's depth are dropped, so only the visible parts are outlined.
- Nearest in the row (R8): for each pixel, the signed column offset to the nearest mask pixel in its row within the outline radius, or none.
- Ring: for each pixel outside the mask, the nearest mask pixel over the column (offset² + row²: the exact Euclidean nearest within the radius), blended onto the frame with an antialiased edge at the width that pixel carries.
The two full-screen passes do their work only inside the screen rectangle the outlined renderers' bounds cover, widened by the radius; everywhere else they return at once. With nothing outlined, no pass is added at all; with the target off screen, none is recorded.
Only the main camera (tagged MainCamera) and the scene view draw outlines: the minimap and other utility cameras do not.
Every texture is RGBA8 or R8 (Firefox's WebGPU cannot sample R16), and every read is a texel load at the pixel's own coordinate, so nothing depends on samplers or on which way up a target is stored.
Fields
EncodedWidth
The width the mask's alpha holds at 1, in pixels: room for MaxWidth at a render scale above 1.
public const float EncodedWidth = 16
Field Value
OutlineShader
[Tooltip("The outline shader (Hidden/FishMMO/TargetOutline). Referenced here so a build carries it: Shader.Find only finds a shader something in the build references. Left empty, it is found by name, which works in the editor alone.")]
public Shader OutlineShader
Field Value
- Shader
ShaderName
public const string ShaderName = "Hidden/FishMMO/TargetOutline"
Field Value
Methods
AddRenderPasses(ScriptableRenderer, ref RenderingData)
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
Parameters
rendererScriptableRendererrenderingDataRenderingData
Create()
public override void Create()
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposingbool