cohtml.ViewRenderer

Inherits from IDisposable

Inherited by cohtml.ViewRendererRP

Public Functions

Name
voidUpdateSize(uint width, uint height)
virtual abstract voidDrawFrameOnScreen() =0
Draws the view into the active render target. Must be implemented by derived renderer implementations.
virtual voidDispose()
intGetCohtmlOriginY()
Returns the Y-axis origin convention used by Cohtml for texture UV coordinates.
intGetUnityOriginY()
Returns the Y-axis origin convention used by Unity for texture UV coordinates.
RenderTextureCreateRenderTexture(string name, int width, int height, UnityEngine.Experimental.Rendering.GraphicsFormat format, bool enableRandomWrite =false)
Creates and initializes a new RenderTexture with the specified dimensions and graphics format.
ShaderGetViewShader(CohtmlView view)

Protected Functions

Name
ViewRenderer(CohtmlView view)
Initializes the renderer with the specified view. Sets up optional partitioning resources, compute shaders, and filtering materials depending on the current view configuration.
virtual abstract voidApplyCompositorTextures() =0
Renders all composition textures associated with the current CohtmlView onto the given render target. Used for the Surface Partitioning feature.
virtual abstract voidApplyGlobalBackdropFilter() =0
Applies the global backdrop filter to the target output before drawing UI elements.
MeshSetupQuad()
Creates a 1×1 quad mesh with UVs for fullscreen or partitioned UI rendering.

Public Attributes

Name
const stringTextureName
const stringMaterialName
const stringBackgroundName
const stringGlobalBackdropName
const stringGlobalBackdropMaskName
const stringIntermediateName
const stringCameraCopyName

Protected Attributes

Name
const stringCohtmlViewName
Meshm_QuadMesh
Matrix4x4m_PixelMatrix
MaterialPropertyBlockm_MaterialPropertyBlock
floatThreadGroupDivisor
intm_VerticalKernelIndex
intm_HorizontalKernelIndex
Vector3Intm_ThreadGroups
ComputeShaderm_HorizontalBlurShader
ComputeShaderm_VerticalBlurShader
Materialm_BackdropFilterMaterial

Public Functions Documentation

function UpdateSize

void UpdateSize(
    uint width,
    uint height
)

function DrawFrameOnScreen

virtual abstract void DrawFrameOnScreen() =0

Draws the view into the active render target. Must be implemented by derived renderer implementations.

Reimplemented by: cohtml.ViewRendererRP.DrawFrameOnScreen

Depending on configuration, this may:

  • Apply composition textures (UISurfacePartitioning)
  • Execute C# backend rendering specific operations
  • Apply global backdrop filter feature
  • Render the final view texture onto the target

function Dispose

virtual void Dispose()

Reimplemented by: cohtml.ViewRendererRP.Dispose

function GetCohtmlOriginY

static int GetCohtmlOriginY()

Returns the Y-axis origin convention used by Cohtml for texture UV coordinates.

Return: 1 if Cohtml uses a top-left Y origin; otherwise 0.

function GetUnityOriginY

static int GetUnityOriginY()

Returns the Y-axis origin convention used by Unity for texture UV coordinates.

Return: 1 if Unity uses a top-left Y origin; otherwise 0.

function CreateRenderTexture

static RenderTexture CreateRenderTexture(
    string name,
    int width,
    int height,
    UnityEngine.Experimental.Rendering.GraphicsFormat format,
    bool enableRandomWrite =false
)

Creates and initializes a new RenderTexture with the specified dimensions and graphics format.

Parameters:

  • name The name to assign to the RenderTexture for debugging purposes.
  • width The width of the texture in pixels.
  • height The height of the texture in pixels.
  • format The graphics format of the texture.
  • enableRandomWrite Optional. Set to true to enable random write access (UAV). Defaults to false.

Return: The successfully created RenderTexture, or null if the creation failed (e.g., due to an unsupported format or memory limits).

function GetViewShader

static Shader GetViewShader(
    CohtmlView view
)

Protected Functions Documentation

function ViewRenderer

ViewRenderer(
    CohtmlView view
)

Initializes the renderer with the specified view. Sets up optional partitioning resources, compute shaders, and filtering materials depending on the current view configuration.

Parameters:

  • view The CohtmlView instance controlling rendering behavior.

function ApplyCompositorTextures

virtual abstract void ApplyCompositorTextures() =0

Renders all composition textures associated with the current CohtmlView onto the given render target. Used for the Surface Partitioning feature.

Reimplemented by: cohtml.ViewRendererRP.ApplyCompositorTextures

function ApplyGlobalBackdropFilter

virtual abstract void ApplyGlobalBackdropFilter() =0

Applies the global backdrop filter to the target output before drawing UI elements.

Reimplemented by: cohtml.ViewRendererRP.ApplyGlobalBackdropFilter

function SetupQuad

static Mesh SetupQuad()

Creates a 1×1 quad mesh with UVs for fullscreen or partitioned UI rendering.

Return: A newly created quad mesh.

Public Attributes Documentation

variable TextureName

const string TextureName = CohtmlViewName + "Texture";

variable MaterialName

const string MaterialName = CohtmlViewName + "Material";

variable BackgroundName

const string BackgroundName = CohtmlViewName + "Background";

variable GlobalBackdropName

const string GlobalBackdropName = CohtmlViewName + "GlobalBackdropOutput";

variable GlobalBackdropMaskName

const string GlobalBackdropMaskName = CohtmlViewName + "GlobalBackdropMask";

variable IntermediateName

const string IntermediateName = CohtmlViewName + "Intermediate";

variable CameraCopyName

const string CameraCopyName = CohtmlViewName + "CameraCopy";

Protected Attributes Documentation

variable CohtmlViewName

const string CohtmlViewName = "CoherentView_";

variable m_QuadMesh

Mesh m_QuadMesh;

variable m_PixelMatrix

Matrix4x4 m_PixelMatrix;

variable m_MaterialPropertyBlock

MaterialPropertyBlock m_MaterialPropertyBlock;

variable ThreadGroupDivisor

float ThreadGroupDivisor = 16.0f;

variable m_VerticalKernelIndex

int m_VerticalKernelIndex;

variable m_HorizontalKernelIndex

int m_HorizontalKernelIndex;

variable m_ThreadGroups

Vector3Int m_ThreadGroups;

variable m_HorizontalBlurShader

ComputeShader m_HorizontalBlurShader;

variable m_VerticalBlurShader

ComputeShader m_VerticalBlurShader;

variable m_BackdropFilterMaterial

Material m_BackdropFilterMaterial;