Version: 2020.3

CustomRenderTexture

class in UnityEngine

切换到手册

描述

Custom Render Textures are an extension to Render Textures that allow you to render directly to the Texture using a Shader.

Custom Render Textures are an extension to Render Textures that allow you to update a texture with a Shader, and then use it in a regular Material. This is useful for implementing all kinds of complex simulations, for instance: water caustics, ripple simulations for rain effects, or splatting liquids against a wall. Also provided is a scripting and Shader framework to help with more complicated configurations like partial or multi-pass updates, and varying update frequency.

变量

cubemapFaceMaskThe bit field that you can use to enable or disable update on each of the cubemap faces. The bit order from least to most significant bit is as follows: +X, -X, +Y, -Y, +Z, -Z.
doubleBufferedWhen this parameter is set to true, Unity double-buffers the Custom Render Texture so that you can access it during its own update.
initializationColorThe color that Unity uses to initialize a Custom Render Texture. Unity ignores this parameter if an initializationMaterial is set.
initializationMaterialThe Material that Unity uses to initialize a Custom Render Texture. Initialization texture and color are ignored if you have set this parameter.
initializationModeDetermine how Unity initializes a texture.
initializationSourceDetermine if Unity initializes the Custom Render Texture with a Texture and a Color or a Material.
initializationTextureThe Texture that Unity uses to initialize a Custom Render Texture, multiplied by the initialization color. Unity ignores this parameter if an initializationMaterial is set.
materialThe Material that Unity uses to initialize the content of a Custom Render Texture.
shaderPassThe Shader Pass Unity uses to update the Custom Render Texture.
updateModeDetermine how Unity updates the Custom Render Texture.
updatePeriodThe period in seconds that Unity updates real-time Custom Render Textures. A value of 0.0 means Unity updates real-time Custom Render Textures every frame.
updateZoneSpaceThe space in which Unity expresses update zones. You can set this to Normalized or Pixel space.
wrapUpdateZonesWhen this parameter is set to true, Unity wraps Update zones around the border of the Custom Render Texture. Otherwise, Unity clamps Update zones at the border of the Custom Render Texture.

构造函数

CustomRenderTexture创建一个新的自定义渲染纹理。

公共函数

ClearUpdateZones清除所有更新区域。
EnsureDoubleBufferConsistencyUpdates the internal Render Texture that a Custom Render Texture uses for double buffering, so that it matches the size and format of the Custom Render Texture.
GetDoubleBufferRenderTextureGets the Render Texture that this Custom Render Texture uses for double buffering.
GetUpdateZones返回更新区域列表。
InitializeInitializes the Custom Render Texture at the start of the next frame. Unity calls /Initialise()/ before /CustomRenderTexture.Update/.
SetUpdateZones为自定义渲染纹理设置更新区域列表。
UpdateTriggers an update of the Custom Render Texture.