Class TextModeCRTRendererFeature
Adds the TextMode CRT to a URP renderer as a camera effect. Add it to the renderer asset's Renderer Features, then switch it on per scene or area with a TextModeCRTVolume in a Volume profile, or per camera from code through TextModeCRTCameraEffects.
Implements
Inherited Members
Namespace: Scylla.TextMode.URP
Assembly: ScyllaTextMode.URP.dll
Syntax
[DisallowMultipleRendererFeature("TextMode CRT")]
public sealed class TextModeCRTRendererFeature : ScriptableRendererFeature, IDisposable
Remarks
Every camera keeps its own afterglow, so split screens and render-to-texture cameras do not mix their trails. A camera's state is released when it has not rendered for a few seconds.
The feature draws for game cameras, and for the Scene view when ShowInSceneView is set. Preview cameras, reflection probes and XR cameras are skipped, and so are all cameras while the TextMode module is disabled. A camera is only given the pass when it has a CRT to draw, either from code or from an active TextModeCRTVolume, because the pass forces URP to render into an intermediate texture. In a camera stack, the Volume path draws only on the camera that resolves the final target, and a camera shown from code cannot be an overlay camera.
Screen Space Overlay canvases are drawn after the camera and stay outside the CRT. Use a Screen Space Camera canvas for UI that should appear on the tube.
Under HDR output the picture after post-processing is in absolute nits and the display's color gamut. The CRT converts it to linear light relative to paper white before it runs and back afterwards, which also lets HDR mask mode use the display's headroom.
To set it up, follow these steps.
- Add the feature to every URP renderer asset that should show the CRT, either with the menu item Tools/Scylla/TextMode/Add CRT to URP Renderers or with Add Renderer Feature in the renderer asset's Inspector.
- Choose the injection point on the feature. After post-processing is the default.
- Switch the CRT on with a TextModeCRTVolume in a Volume, or per camera from code.
To show one camera through the CRT from code, ask the registered camera effect.
CanShow reports why a camera cannot draw, for example when URP is not the active
pipeline or the camera's renderer has no CRT feature.
var effect = TextModeCRTCameraEffects.Provider;
if (effect != null && effect.CanShow(camera, out var reason))
{
effect.Show(camera, preset.Settings, CRTQualityTier.Medium, false, 0);
}
else
{
Debug.Log("The CRT cannot draw: " + reason);
}
Fields
VERSION
Version of the URP camera effect package.
Declaration
public const string VERSION = "1.1.0"
Field Value
| Type | Description |
|---|---|
| string |
Properties
InjectionPoint
Gets or sets where in the frame the CRT is drawn. Setting it updates the render pass event of the pass right away, so it can be changed at runtime.
Declaration
public TextModeCRTInjectionPoint InjectionPoint { get; set; }
Property Value
| Type | Description |
|---|---|
| TextModeCRTInjectionPoint | The injection point. The default is AfterPostProcessing. |
ShowInSceneView
Gets or sets whether the CRT is also drawn in the Scene view. When it is off, the Scene view camera is skipped.
Declaration
public bool ShowInSceneView { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
|
Methods
AddRenderPasses(ScriptableRenderer, ref RenderingData)
Adds the pass to the camera's frame when the CRT draws for it, and releases the state of cameras that stopped rendering.
Declaration
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData)
Parameters
| Type | Name | Description |
|---|---|---|
| ScriptableRenderer | renderer | The renderer of the camera. |
| RenderingData | renderingData | The rendering data of the frame. |
Overrides
Create()
Creates the render pass, applies the injection point and registers the feature with the
URP camera effect so that CanShow can find it. Called by URP when the renderer is
created or changed.
Declaration
public override void Create()
Overrides
Dispose(bool)
Unregisters the feature from the URP camera effect, releases every camera's CRT state and destroys the HDR conversion material. Called by URP when the renderer is disposed.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing | Whether this is called from |