Skip to main content

RenderTexture

info

RenderTexture inherits from Texture

Render textures are textures that can be rendered to.

Members

Properties

NameDescription
RenderTexture.antiAliasingThe antialiasing level for the RenderTexture.
RenderTexture.autoGenerateMipsMipmap levels are generated automatically when this flag is set.
RenderTexture.bindTextureMSIf true and antiAliasing is greater than 1, the render texture will not be resolved by default. Use this if the render texture needs to be bound as a multisampled texture in a shader.
RenderTexture.colorBufferColor buffer of the render texture (Read Only).
RenderTexture.depthThe precision of the render texture's depth buffer in bits (0, 16, 24/32 are supported).
RenderTexture.depthBufferDepth/stencil buffer of the render texture (Read Only).
RenderTexture.descriptorThis 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.
RenderTexture.dimensionDimensionality (type) of the render texture.
RenderTexture.enableRandomWriteEnable random access write into this render texture on Shader Model 5.0 level shaders.
RenderTexture.graphicsFormatThe color format of the render texture.
RenderTexture.heightThe height of the render texture in pixels.
RenderTexture.memorylessModeThe render texture memoryless mode property.
RenderTexture.sRGBDoes this render texture use sRGB read/write conversions? (Read Only).
RenderTexture.stencilFormatThe format of the stencil data that you can encapsulate within a RenderTexture.
RenderTexture.useDynamicScaleIs the render texture marked to be scaled by the Dynamic Resolution system.
RenderTexture.useMipMapRender texture has mipmaps when this flag is set.
RenderTexture.volumeDepthVolume extent of a 3D render texture or number of slices of array texture.

Static Properties

NameDescription
RenderTexture.activeCurrently active render texture.

Constructor

NameDescription
RenderTexture(width, height, depth)
RenderTexture(textureToCopy)
RenderTexture(desc)

Methods

NameDescription
RenderTexture.Create()Actually creates the RenderTexture.
RenderTexture.DiscardContents()Hint the GPU driver that the contents of the RenderTexture will not be used.
RenderTexture.DiscardContents(discardColor, discardDepth)Hint the GPU driver that the contents of the RenderTexture will not be used.
RenderTexture.GenerateMips()Generate mipmap levels of a render texture.
RenderTexture.GetNativeDepthBufferPtr()Retrieve a native (underlying graphics API) pointer to the depth buffer resource.
RenderTexture.IsCreated()Is the render texture actually created?
RenderTexture.MarkRestoreExpected()Indicate that there's a RenderTexture restore operation expected.
RenderTexture.Release()Releases the RenderTexture.
RenderTexture.ResolveAntiAliasedSurface()Force an antialiased render texture to be resolved.
RenderTexture.ResolveAntiAliasedSurface(target)Force an antialiased render texture to be resolved.
RenderTexture.SetGlobalShaderProperty(propertyName)Assigns this RenderTexture as a global shader property named propertyName.

Static Methods

NameDescription
RenderTexture.GetTemporary(desc)Allocate a temporary render texture.
RenderTexture.ReleaseTemporary(temp)Release a temporary texture allocated with GetTemporary.
RenderTexture.SupportsStencil()Does a RenderTexture have stencil buffer?

Inherited Members

Inherited Properties

NameDescription
RenderTexture.anisoLevelDefines the anisotropic filtering level of the Texture.
RenderTexture.dimensionDimensionality (type) of the Texture (Read Only).
RenderTexture.filterModeFiltering mode of the texture.
RenderTexture.heightHeight of the texture in pixels. (Read Only)
RenderTexture.isReadableReturns true if the Read/Write Enabled checkbox was checked when the texture was imported; otherwise returns false. For a dynamic Texture created from script, always returns true.
RenderTexture.mipMapBiasMip map bias of the texture.
RenderTexture.mipmapCountHow many mipmap levels are in this texture (Read Only).
RenderTexture.updateCountThis counter is incremented when the texture is updated.
RenderTexture.widthWidth of the texture in pixels. (Read Only)
RenderTexture.wrapModeTexture coordinate wrapping mode.
RenderTexture.wrapModeUTexture U coordinate wrapping mode.
RenderTexture.wrapModeVTexture V coordinate wrapping mode.
RenderTexture.wrapModeWTexture W coordinate wrapping mode for Texture3D.
RenderTexture.hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
RenderTexture.nameThe name of the object.

Inherited Methods

NameDescription
RenderTexture.GetNativeTexturePtr()Retrieve a native (underlying graphics API) pointer to the Texture resource.
RenderTexture.IncrementUpdateCount()Increment the update counter. Call this method when you update a Texture from the GPU side, or you want to explicitly increment the counter.
RenderTexture.GetInstanceID()Returns the instance id of the object.

Extra Detail

They can be used to implement image based rendering effects, dynamic shadows, projectors, reflections or surveillance cameras.

One typical usage of render textures is setting them as the "target texture" property of a Camera (Camera.targetTexture), this will make a camera render into a texture instead of rendering to the screen.