Skip to content

API > RenderTexture


RenderTexture⚓︎

RenderTexture inherits from Texture

Render textures are textures that can be rendered to.

Members⚓︎

Properties⚓︎

Name Description
RenderTexture.antiAliasingProperty The antialiasing level for the RenderTexture.
RenderTexture.autoGenerateMipsProperty Mipmap levels are generated automatically when this flag is set.
RenderTexture.bindTextureMSProperty If 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.colorBufferPropertyReadonly Property Color buffer of the render texture (Read Only).
RenderTexture.depthProperty The precision of the render texture's depth buffer in bits (0, 16, 24/32 are supported).
RenderTexture.depthBufferPropertyReadonly Property Depth/stencil buffer of the render texture (Read Only).
RenderTexture.descriptorProperty 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.
RenderTexture.dimensionProperty Dimensionality (type) of the render texture.
RenderTexture.enableRandomWriteProperty Enable random access write into this render texture on Shader Model 5.0 level shaders.
RenderTexture.graphicsFormatProperty The color format of the render texture.
RenderTexture.heightProperty The height of the render texture in pixels.
RenderTexture.memorylessModeProperty The render texture memoryless mode property.
RenderTexture.sRGBProperty Does this render texture use sRGB read/write conversions? (Read Only).
RenderTexture.stencilFormatProperty The format of the stencil data that you can encapsulate within a RenderTexture.
RenderTexture.useDynamicScaleProperty Is the render texture marked to be scaled by the Dynamic Resolution system.
RenderTexture.useMipMapProperty Render texture has mipmaps when this flag is set.
RenderTexture.volumeDepthProperty Volume extent of a 3D render texture or number of slices of array texture.

Static Properties⚓︎

Name Description
RenderTexture.active Static fieldProperty Currently active render texture.

Constructor⚓︎

Name Description
RenderTexture(width, height, depth)Constructor
RenderTexture(textureToCopy)Constructor
RenderTexture(desc)Constructor

Methods⚓︎

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

Static Methods⚓︎

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

Inherited Members⚓︎

Inherited Properties⚓︎

Name Description
RenderTexture.anisoLevelProperty Defines the anisotropic filtering level of the Texture.
RenderTexture.dimensionProperty Dimensionality (type) of the Texture (Read Only).
RenderTexture.filterModeProperty Filtering mode of the texture.
RenderTexture.heightProperty Height of the texture in pixels. (Read Only)
RenderTexture.isReadableProperty Returns 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.mipMapBiasProperty Mip map bias of the texture.
RenderTexture.mipmapCountProperty How many mipmap levels are in this texture (Read Only).
RenderTexture.updateCountProperty This counter is incremented when the texture is updated.
RenderTexture.widthProperty Width of the texture in pixels. (Read Only)
RenderTexture.wrapModeProperty Texture coordinate wrapping mode.
RenderTexture.wrapModeUProperty Texture U coordinate wrapping mode.
RenderTexture.wrapModeVProperty Texture V coordinate wrapping mode.
RenderTexture.wrapModeWProperty Texture W coordinate wrapping mode for Texture3D.
RenderTexture.hideFlagsProperty Should the object be hidden, saved with the Scene or modifiable by the user?
RenderTexture.nameProperty The name of the object.

Inherited Methods⚓︎

Name Description
RenderTexture.GetNativeTexturePtr()Method Retrieve a native (underlying graphics API) pointer to the Texture resource.
RenderTexture.IncrementUpdateCount()Method 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()Method 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.