reckfellENGINE

ViewportTexture

Provides the content of a Viewport as a dynamic texture.

On this page
class ViewportTextureReckfellSharpInherits Texture2D

Provides the content of a Viewport as a dynamic texture.

A ViewportTexture provides the content of a Viewport as a dynamic Texture2D. This can be used to combine the rendering of Control, Entity2D and Entity3D nodes. For example, you can use this texture to display a 3D scene inside a TextureRect, or a 2D overlay in a Sprite3D. To get a ViewportTexture in code, use the Viewport.GetTexture method on the target viewport. Note: A ViewportTexture is always local to its scene (see Resource.ResourceLocalToScene). If the scene root is not ready, it may return incorrect data (see Entity.Ready). Note: Instantiating scenes containing a high-resolution ViewportTexture may cause noticeable stutter. Note: When using a Viewport with Viewport.UseHdr2D set to true, the returned texture will be an HDR image that uses linear encoding. This may look darker than normal when displayed directly on screen. To convert to nonlinear sRGB encoding, use Image.LinearToSrgb. Note: Some nodes such as Decal, Light3D, and PointLight2D do not support using ViewportTexture directly. To use texture data from a ViewportTexture in these nodes, you need to create an ImageTexture by calling Texture2D.GetImage on the ViewportTexture and passing the result to ImageTexture.CreateFromImage. This conversion is a slow operation, so it should not be performed every frame.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

ViewportTextureConstructor
# ViewportTexture
C#
public ViewportTexture();

Properties1

ViewportPathProperty
# ViewportPath
C#
public EntityPath ViewportPath { get; set; }

The path to the Viewport node to display. This is relative to the local scene root (see Resource.GetLocalScene), not to the nodes that use this texture. Note: In the editor, this path is automatically updated when the target viewport or one of its ancestors is renamed or moved. At runtime, this path may not automatically update if the scene root cannot be found.

Methods2

GetViewportPathInSceneEntityPath
# GetViewportPathInScene
C#
public EntityPath GetViewportPathInScene();
Returns EntityPath
SetViewportPathInScenevoid
# SetViewportPathInScene
C#
public void SetViewportPathInScene(EntityPath path);
Parameters
NameTypeDefault
pathEntityPath—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.