Class RenderBuffers
The scene rendering buffers container.
Inherited Members
Assembly: FlaxEngine.dll
File: Engine/Graphics/RenderBuffers.h
Syntax
public class RenderBuffers : public ScriptingObject, public ISceneRenderingListener
Constructors
~RenderBuffers()
Fields
_aspectRatio
Declaration
protected float _aspectRatio = 0.0f
Field Value
|
float
|
_cullingIdsOwnerTypes
Declaration
protected HashSet<ScriptingTypeHandle> _cullingIdsOwnerTypes
Field Value
|
HashSet<ScriptingTypeHandle>
|
_cullingLocker
Declaration
protected CriticalSection _cullingLocker
Field Value
|
CriticalSection
|
_height
Declaration
protected int32 _height = 0
Field Value
|
int32
|
_resources
Declaration
protected Array<GPUTexture* , FixedAllocation<32>> _resources
Field Value
|
Array<GPUTexture , FixedAllocation<32>>
|
_statelessCulling
Declaration
protected bool _statelessCulling = true
Field Value
|
bool
|
_useAlpha
Declaration
protected bool _useAlpha = false
Field Value
|
bool
|
_usedCulling
Declaration
protected bool _usedCulling = false
Field Value
|
bool
|
_useNull
Declaration
protected bool _useNull = false
Field Value
|
bool
|
_viewport
_width
Declaration
protected int32 _width = 0
Field Value
|
int32
|
CustomBuffers
Declaration
public Array<CustomBuffer* , HeapAllocation> CustomBuffers
Field Value
|
Array<CustomBuffer , HeapAllocation>
|
DepthBuffer
Gets the depth buffer render target allocated within this render buffers collection (read only).
Declaration
public GPUTexture* DepthBuffer
Field Value
|
GPUTexture
|
GBuffer
GBuffer0
Gets the GBuffer texture 0. RGB: Color, A: AO
Declaration
public GPUTexture* GBuffer0
Field Value
|
GPUTexture
|
GBuffer1
Gets the GBuffer texture 1. RGB: Normal, A: ShadingModel
Declaration
public GPUTexture* GBuffer1
Field Value
|
GPUTexture
|
GBuffer2
Gets the GBuffer texture 2. R: Roughness, G: Metalness, B:Specular
Declaration
public GPUTexture* GBuffer2
Field Value
|
GPUTexture
|
GBuffer3
Gets the GBuffer texture 3. RGBA: Custom Data
Declaration
public GPUTexture* GBuffer3
Field Value
|
GPUTexture
|
LastEyeAdaptationTime
Declaration
public float LastEyeAdaptationTime = 0.0f
Field Value
|
float
|
LastFrameLuminanceMap
Declaration
public uint64 LastFrameLuminanceMap = 0
Field Value
|
uint64
|
LastFrameTemporalAA
Declaration
public uint64 LastFrameTemporalAA = 0
Field Value
|
uint64
|
LastFrameTemporalSSR
Declaration
public uint64 LastFrameTemporalSSR = 0
Field Value
|
uint64
|
LastFrameVolumetricFog
Declaration
public uint64 LastFrameVolumetricFog = 0
Field Value
|
uint64
|
LinkedCustomBuffers
External Render Buffers used to redirect FindCustomBuffer/GetCustomBuffer calls. Can be linked to other rendering task (eg. main game viewport) to reuse graphics effect state from it (eg. use GI from main game view in in-game camera renderer).
Declaration
public RenderBuffers* LinkedCustomBuffers = nullptr
Field Value
|
RenderBuffers
|
LocalShadowedLightScattering
LuminanceMap
MaxDistance
Declaration
public float MaxDistance
Field Value
|
float
|
MotionVectors
Gets the motion vectors render target allocated within this render buffers collection (read only).
Texture ca be null or not initialized if motion blur is disabled or not yet rendered.
Declaration
public GPUTexture* MotionVectors
Field Value
|
GPUTexture
|
OcclusionCulling
Occlusion culling implementation (optional). Can skip drawing occluded objects. Maintains a state synchronized with scene rendering with container RenderBuffers.
Declaration
public IOcclusionCulling* OcclusionCulling = nullptr
Field Value
|
IOcclusionCulling
|
TemporalAA
TemporalSSR
VolumetricFog
VolumetricFogData
Declaration
public struct RenderBuffers::@154 VolumetricFogData
Field Value
|
struct RenderBuffers::@154
|
VolumetricFogHistory
Methods
FindCustomBuffer(const StringView& name, bool withLinked=true)
Declaration
public CustomBuffer* FindCustomBuffer(const StringView& name, bool withLinked=true) const
Parameters
|
StringView
name
|
|
bool
withLinked
|
Returns
|
CustomBuffer
|
FindLinkedBuffer(const StringView& name)
Declaration
public T* FindLinkedBuffer(const StringView& name) const
Parameters
|
StringView
name
|
Returns
|
T
|
Type Parameters
|
class T
|
GetAspectRatio()
Gets the buffers aspect ratio.
Declaration
public float GetAspectRatio() const
Returns
|
float
|
GetCustomBuffer(const StringView& name, bool withLinked=true)
Declaration
public T* GetCustomBuffer(const StringView& name, bool withLinked=true)
Parameters
|
StringView
name
|
|
bool
withLinked
|
Returns
|
T
|
Type Parameters
|
class T
|
GetGeometryDrawState(SceneRendering* scene, int32 key, const Actor* actor)
Gets the geometry drawing state container for a specific actor/object. Returns null for invalid object (-1) or when view is not using LOD transitions (single-shot frame).
Declaration
public GeometryDrawState* GetGeometryDrawState(SceneRendering* scene, int32 key, const Actor* actor) const
Parameters
|
SceneRendering
scene
|
|
int32
key
|
|
Actor
actor
|
Returns
|
GeometryDrawState
|
GetHeight()
Gets the buffers height (in pixels).
Declaration
public int32 GetHeight() const
Returns
|
int32
|
GetMemoryUsage()
Gets the current GPU memory usage by all the buffers (in bytes).
Declaration
public uint64 GetMemoryUsage() const
Returns
|
uint64
|
GetOutputFormat()
Gets the output buffers format (R11G11B10 or R16G16B16A16 depending on UseAlpha property).
Declaration
public PixelFormat GetOutputFormat() const
Returns
|
PixelFormat
|
GetReadOnlyDepthBuffer()
Gets the depth buffer binding for rendering as read-only (both shader resource and render target).
Declaration
public ReadOnlyDepthBuffer GetReadOnlyDepthBuffer() const
Returns
|
ReadOnlyDepthBuffer
|
GetSize()
Gets the buffers width and height (in pixels).
Declaration
public Float2 GetSize() const
Returns
|
Float2
|
GetUseAlpha()
True if support alpha output in the rendering buffers and pass-though alpha mask of the scene during rendering (at cost of reduced performance).
Declaration
public bool GetUseAlpha() const
Returns
|
bool
|
GetViewport()
Gets the buffers rendering viewport.
Declaration
public Viewport GetViewport() const
Returns
|
Viewport
|
GetWidth()
Gets the buffers width (in pixels).
Declaration
public int32 GetWidth() const
Returns
|
int32
|
Init(int32 width, int32 height)
Allocates the buffers.
Declaration
public bool Init(int32 width, int32 height)
Parameters
|
int32
width
The surface width (in pixels). |
|
int32
height
The surface height (in pixels). |
Returns
|
bool
True if cannot allocate buffers, otherwise false. |
OnRendering(const RenderContext& renderContext)
Declaration
public void OnRendering(const RenderContext& renderContext)
Parameters
|
RenderContext
renderContext
|
OnSceneRendering(SceneRendering* scene)
OnSceneRenderingAddActor(SceneRendering* scene, int32 key, Actor* a)
Declaration
public virtual void OnSceneRenderingAddActor(SceneRendering* scene, int32 key, Actor* a) override
Parameters
|
SceneRendering
scene
|
|
int32
key
|
|
Actor
a
|
Overrides
OnSceneRenderingClear(SceneRendering* scene)
Declaration
public virtual void OnSceneRenderingClear(SceneRendering* scene) override
Parameters
|
SceneRendering
scene
|
Overrides
OnSceneRenderingRemoveActor(SceneRendering* scene, int32 key, Actor* a)
Declaration
public virtual void OnSceneRenderingRemoveActor(SceneRendering* scene, int32 key, Actor* a) override
Parameters
|
SceneRendering
scene
|
|
int32
key
|
|
Actor
a
|
Overrides
OnSceneRenderingUpdateActor(SceneRendering* scene, int32 key, Actor* a, const BoundingSphere& prevBounds, UpdateFlags flags)
Declaration
public virtual void OnSceneRenderingUpdateActor(SceneRendering* scene, int32 key, Actor* a, const BoundingSphere& prevBounds, UpdateFlags flags) override
Parameters
|
SceneRendering
scene
|
|
int32
key
|
|
Actor
a
|
|
BoundingSphere
prevBounds
|
|
UpdateFlags
flags
|
Overrides
Release()
Release the buffers data.
Declaration
public void Release()
ReleaseUnusedMemory()
Frees unused buffers to reduce memory usage for certain drawing effects that are state-dependant but unused for multiple frames.
Declaration
public void ReleaseUnusedMemory()
RequestHalfResDepth(GPUContext* context)
Requests the half-resolution depth to be prepared for the current frame.
Declaration
public GPUTexture* RequestHalfResDepth(GPUContext* context)
Parameters
|
GPUContext
context
The context. |
Returns
|
GPUTexture
The half-res depth buffer. |
RequestHiZ(GPUContext* context, bool fullRes=false, int32 mipLevels = 0, bool closest=true, bool powerOfTwo=false)
Requests the Hierarchical Z-Buffer (closest or furthest) to be prepared for the current frame.
Declaration
public GPUTexture* RequestHiZ(GPUContext* context, bool fullRes=false, int32 mipLevels = 0, bool closest=true, bool powerOfTwo=false)
Parameters
|
GPUContext
context
The context. |
|
bool
fullRes
Generates the full-resolution buffer, otherwise HiZ starts at half-res of the original Depth Buffer. |
|
int32
mipLevels
Maximum amount of mip levels to generate. Value 0 generates a full mip chain down to 1x1. |
|
bool
closest
True if generate the closest depth values, otherwise will use the furthest depths filter. |
|
bool
powerOfTwo
True if the buffer dimensions should be powers of two. |
Returns
|
GPUTexture
The HiZ depth buffer. |
SetUseAlpha(bool value)
True if support alpha output in the rendering buffers and pass-though alpha mask of the scene during rendering (at cost of reduced performance).
Declaration
public void SetUseAlpha(bool value)
Parameters
|
bool
value
|
TestOcclusionCulling(const Actor* actor, uint32& cullingId)
Performs the occlusion culling test for a specific sub-object of the actor (eg. terrain chunk or foliage patch) and returns the assigned CullingId (for draw call).
Declaration
public bool TestOcclusionCulling(const Actor* actor, uint32& cullingId) const
Parameters
|
Actor
actor
The owning actor. |
|
uint32
cullingId
Result CullingId to use for drawing this actor. |
Returns
|
bool
True if actor can be rendered (is visible or visibility will be calculated on GPU), otherwise false. |
TestOcclusionCulling(SceneRendering* scene, const Actor* actor, const BoundingBox& objectBounds, uint32& cullingId, const void* object=nullptr)
Performs the occlusion culling test for a specific sub-object of the actor (eg. terrain chunk or foliage patch) and returns the assigned CullingId (for draw call).
Declaration
public bool TestOcclusionCulling(SceneRendering* scene, const Actor* actor, const BoundingBox& objectBounds, uint32& cullingId, const void* object=nullptr) const
Parameters
|
SceneRendering
scene
The scene owning this actor. |
|
Actor
actor
The owning actor. |
|
BoundingBox
objectBounds
The world-space bounds of the actor (or sub-object). |
|
uint32
cullingId
Result CullingId to use for drawing this actor (or sub-object). |
|
void
object
The pointer to the sub-actor object. Null for actor-only culling. |
Returns
|
bool
True if object can be rendered (is visible or visibility will be calculated on GPU), otherwise false. |