cohtml.ViewRenderer
Inherits from IDisposable
Inherited by cohtml.ViewRendererRP
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| void | UpdateSize(uint width, uint height) |
| virtual abstract void | DrawFrameOnScreen() =0 Draws the view into the active render target. Must be implemented by derived renderer implementations. |
| virtual void | Dispose() |
| int | GetCohtmlOriginY() Returns the Y-axis origin convention used by Cohtml for texture UV coordinates. |
| int | GetUnityOriginY() Returns the Y-axis origin convention used by Unity for texture UV coordinates. |
| RenderTexture | CreateRenderTexture(string name, int width, int height, UnityEngine.Experimental.Rendering.GraphicsFormat format, int depth =0, bool enableRandomWrite =false) Creates and initializes a new RenderTexture with the specified dimensions and graphics format. |
| Shader | GetViewShader(CohtmlView view) |
| void | UpdateFlipKeyword(Material material, bool isFlipped) |
| void | SetInWorldMaterial(Material material, RenderTexture texture, bool isTransparent) |
| void | ApplyTransparencyBlendModes(Material material, bool isTransparent) Applies the appropriate blend mode and depth writing (ZWrite) settings to a given material based on whether it should be rendered as transparent or opaque. This updates the hidden _SrcBlend and _DstBlend shader properties used in the material’s shader. Transparent mode: SrcBlend = 5 (SrcAlpha), DstBlend = 10 (OneMinusSrcAlpha). Opaque mode: SrcBlend = 1 (One), DstBlend = 0 (Zero). |
Protected Functions
Section titled “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 void | ApplyCompositorTextures() =0 Renders all composition textures associated with the current CohtmlView onto the given render target. Used for the Surface Partitioning feature. |
| Mesh | SetupQuad() Creates a 1×1 quad mesh with UVs for fullscreen or partitioned UI rendering. |
Public Properties
Section titled “Public Properties”| Name | |
|---|---|
| CohtmlView | View |
Public Attributes
Section titled “Public Attributes”| Name | |
|---|---|
| const string | TextureName |
| const string | MaterialName |
| const string | BackgroundName |
| const string | GlobalBackdropOutputName |
| const string | GlobalBackdropMaskName |
| const string | IntermediateName |
| const string | CameraCopyName |
| IGlobalBackdropFilter | GlobalBackdropFilter |
| readonly int | CameraCopy |
| readonly int | MainTexId |
| readonly int | OverlayTexId |
| readonly int | UVOffsetId |
| readonly int | UVScaleId |
| readonly int | SrcBlendId |
| readonly int | DstBlendId |
| readonly int | ZWriteId |
| readonly int | TopLeft |
| readonly int | BottomLeft |
Protected Attributes
Section titled “Protected Attributes”| Name | |
|---|---|
| const string | CohtmlViewName |
| Mesh | m_QuadMesh |
| Matrix4x4 | m_PixelMatrix |
| MaterialPropertyBlock | m_MaterialPropertyBlock |
Public Functions Documentation
Section titled “Public Functions Documentation”function UpdateSize
Section titled “function UpdateSize”void UpdateSize( uint width, uint height)function DrawFrameOnScreen
Section titled “function DrawFrameOnScreen”virtual abstract void DrawFrameOnScreen() =0Draws 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
Section titled “function Dispose”virtual void Dispose()Reimplemented by: cohtml.ViewRendererRP.Dispose
function GetCohtmlOriginY
Section titled “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
Section titled “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
Section titled “function CreateRenderTexture”static RenderTexture CreateRenderTexture( string name, int width, int height, UnityEngine.Experimental.Rendering.GraphicsFormat format, int depth =0, 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.
- depth Optional. Number of bits in depth buffer.
- 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
Section titled “function GetViewShader”static Shader GetViewShader( CohtmlView view)function UpdateFlipKeyword
Section titled “function UpdateFlipKeyword”static void UpdateFlipKeyword( Material material, bool isFlipped)function SetInWorldMaterial
Section titled “function SetInWorldMaterial”static void SetInWorldMaterial( Material material, RenderTexture texture, bool isTransparent)function ApplyTransparencyBlendModes
Section titled “function ApplyTransparencyBlendModes”static void ApplyTransparencyBlendModes( Material material, bool isTransparent)Applies the appropriate blend mode and depth writing (ZWrite) settings to a given material based on whether it should be rendered as transparent or opaque. This updates the hidden _SrcBlend and _DstBlend shader properties used in the material’s shader. Transparent mode: SrcBlend = 5 (SrcAlpha), DstBlend = 10 (OneMinusSrcAlpha). Opaque mode: SrcBlend = 1 (One), DstBlend = 0 (Zero).
Parameters:
- material The target Material to update.
- isTransparent If true, configures the material for standard alpha blending and disables ZWrite (0). If false, configures it for opaque rendering and enables ZWrite (1).
Protected Functions Documentation
Section titled “Protected Functions Documentation”function ViewRenderer
Section titled “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
Section titled “function ApplyCompositorTextures”virtual abstract void ApplyCompositorTextures() =0Renders 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 SetupQuad
Section titled “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 Property Documentation
Section titled “Public Property Documentation”property View
Section titled “property View”CohtmlView View;Public Attributes Documentation
Section titled “Public Attributes Documentation”variable TextureName
Section titled “variable TextureName”const string TextureName = CohtmlViewName + "Texture";variable MaterialName
Section titled “variable MaterialName”const string MaterialName = CohtmlViewName + "Material";variable BackgroundName
Section titled “variable BackgroundName”const string BackgroundName = CohtmlViewName + "Background";variable GlobalBackdropOutputName
Section titled “variable GlobalBackdropOutputName”const string GlobalBackdropOutputName = CohtmlViewName + "GlobalBackdropOutput";variable GlobalBackdropMaskName
Section titled “variable GlobalBackdropMaskName”const string GlobalBackdropMaskName = CohtmlViewName + "GlobalBackdropMask";variable IntermediateName
Section titled “variable IntermediateName”const string IntermediateName = CohtmlViewName + "Intermediate";variable CameraCopyName
Section titled “variable CameraCopyName”const string CameraCopyName = CohtmlViewName + "CameraCopy";variable GlobalBackdropFilter
Section titled “variable GlobalBackdropFilter”IGlobalBackdropFilter GlobalBackdropFilter;variable CameraCopy
Section titled “variable CameraCopy”static readonly int CameraCopy = Shader.PropertyToID(CameraCopyName);variable MainTexId
Section titled “variable MainTexId”static readonly int MainTexId = Shader.PropertyToID("_MainTex");variable OverlayTexId
Section titled “variable OverlayTexId”static readonly int OverlayTexId = Shader.PropertyToID("_OverlayTex");variable UVOffsetId
Section titled “variable UVOffsetId”static readonly int UVOffsetId = Shader.PropertyToID("_UVOffset");variable UVScaleId
Section titled “variable UVScaleId”static readonly int UVScaleId = Shader.PropertyToID("_UVScale");variable SrcBlendId
Section titled “variable SrcBlendId”static readonly int SrcBlendId = Shader.PropertyToID("_SrcBlend");variable DstBlendId
Section titled “variable DstBlendId”static readonly int DstBlendId = Shader.PropertyToID("_DstBlend");variable ZWriteId
Section titled “variable ZWriteId”static readonly int ZWriteId = Shader.PropertyToID("_ZWrite");variable TopLeft
Section titled “variable TopLeft”static readonly int TopLeft = (int)renoir.ImageOrigin.TopLeft;variable BottomLeft
Section titled “variable BottomLeft”static readonly int BottomLeft = (int)renoir.ImageOrigin.BottomLeft;Protected Attributes Documentation
Section titled “Protected Attributes Documentation”variable CohtmlViewName
Section titled “variable CohtmlViewName”const string CohtmlViewName = "CoherentView_";variable m_QuadMesh
Section titled “variable m_QuadMesh”Mesh m_QuadMesh;variable m_PixelMatrix
Section titled “variable m_PixelMatrix”Matrix4x4 m_PixelMatrix;variable m_MaterialPropertyBlock
Section titled “variable m_MaterialPropertyBlock”MaterialPropertyBlock m_MaterialPropertyBlock;© 2026 Coherent Labs. All rights reserved.