Version: 2021.3


struct in UnityEngine



This struct contains all the information required to create a RenderTexture. It can be copied, cached, and reused to easily create RenderTextures that all share the same properties. Avoid using the default constructor as it does not initialize some flags with the recommended values.


bindMS如果为 true 且 msaaSamples 大于 1,则默认不解析渲染纹理。如果需要将渲染纹理绑定为着色器中的多采样纹理,请使用此属性。
colorFormatThe format of the RenderTarget is expressed as a RenderTextureFormat. Internally, this format is stored as a GraphicsFormat compatible with the current system (see SystemInfo.GetCompatibleFormat). Therefore, if you set a format and immediately get it again, it may return a different result from the one just set.
depthBufferBitsThe precision of the render texture's depth buffer in bits (0, 16, 24 and 32 are supported).
depthStencilFormatThe desired format of the depth/stencil buffer.
enableRandomWrite在 Shader Model 5.0 级别着色器上启用随机访问写入该渲染纹理。另请参阅:RenderTexture.enableRandomWrite。
flags一组 RenderTextureCreationFlags,控制纹理的创建方式。
graphicsFormatThe color format for the RenderTexture. You can set this format to None to achieve depth-only rendering.
mipCount用户定义的 Mipmap 数量。
msaaSamplesRenderTexture 的多采样抗锯齿级别。另请参阅:RenderTexture.antiAliasing。
shadowSamplingMode确定当 RenderTexture 用作阴影贴图时的采样方式。另请参阅:ShadowSamplingMode,以了解更多详细信息。
sRGB此标志会使渲染纹理使用 sRGB 读/写转换。
stencilFormatThe format of the stencil data that you can encapsulate within a RenderTexture.Specifying this property creates a stencil element for the RenderTexture and sets its format. This allows for stencil data to be bound as a Texture to all shader types for the platforms that support it. This property does not specify the format of the stencil buffer, which is constrained by the depth buffer format specified in RenderTexture.depth.Currently, most platforms only support R8_UInt (DirectX11, DirectX12), while PS4 also supports R8_UNorm.
useDynamicScale设置为 true 可在此渲染纹理上启用动态分辨率缩放。另请参阅:RenderTexture.useDynamicScale。
volumeDepth3D 渲染纹理的体积范围。
vrUsage如果该 RenderTexture 是在立体渲染中使用的 VR 眼睛纹理,则该属性决定将进行哪些特殊渲染(如果有)。不必手动设置此属性,它会使用 eyeTextureDesc 或其他返回 RenderTextureDescriptor 的 VR 函数返回的值。


RenderTextureDescriptor使用默认值或特定宽度、高度和格式创建 RenderTextureDescriptor。