RenderFrame
The RenderFrame class manages all resources needed to render a single frame. It provides methods to configure rendering limits and quality settings. The Statistics structure offers detailed information about the current frame.
#include <render/TellusimRenderFrame.h>
Constructors
RenderFrame()
explicit RenderFrame(const RenderFrame *frame, uint32_t index = 0)
explicit RenderFrame(RenderManager &manager, const char *name = nullptr)
RenderFrame(RenderManager &manager, NodeCamera &node, uint32_t index = 0, const char *name = nullptr)
Methods
Clear frame.
void clear()
Frame name.
void setName(const char *name)
String getName() const
Render manager.
RenderManager getManager() const
Check frame.
bool isCreated() const
Frame parameters.
uint32_t getWidth() const
uint32_t getHeight() const
float32_t getAspect() const
Frame camera.
void setCamera(NodeCamera &node, uint32_t index = Maxu32)
NodeCamera getCameraNode() const
uint32_t getCameraIndex() const
Frame camera.
const Camera getCamera() const
Camera getCamera()
Frame scene.
const Scene getScene() const
Scene getScene()
Create frame.
bool create(const Device &device, const RenderRenderer &renderer, uint32_t width, uint32_t height, Size size = Size(), bool resize = true)
Type | Name | Description |
---|---|---|
uint32_t | width | Frame width in pixels. |
uint32_t | height | Frame height in pixels. |
Size | size | Composite texture size. |
bool | resize | Resize frame textures. |
Resize frame.
bool resize(const Device &device, const RenderRenderer &renderer, uint32_t width, uint32_t height, Size size = Size())
Type | Name | Description |
---|---|---|
uint32_t | width | Frame width in pixels. |
uint32_t | height | Frame height in pixels. |
Size | size | Composite texture size. |
Background color.
void setBackgroundColor(Color color)
const Color getBackgroundColor() const
Projection matrix multiplier.
void setProjection(Matrix4x4f projection)
const Matrix4x4f getProjection() const
Modelview matrix multiplier.
void setModelview(Matrix4x3f modelview)
const Matrix4x3f getModelview() const
Spatial buffer parameters.
void setSpatialSize(uint32_t lights = 1024 * 8, uint32_t objects = 1024 * 256, uint32_t geometries = 1024 * 512, uint32_t instances = 1024 * 64)
uint32_t getMaxLights() const
uint32_t getMaxObjects() const
uint32_t getMaxGeometries() const
uint32_t getMaxInstances() const
Type | Name | Description |
---|---|---|
uint32_t | lights | Maximum number of visible lights. |
uint32_t | objects | Maximum number of visible objects. |
uint32_t | geometries | Maximum number of visible geometries. |
uint32_t | instances | Maximum number of visible instances (scene matrix per instance). |
Draw buffer parameters.
void setDrawSize(uint32_t batches = 1024 * 1024, uint32_t indirects = 1024 * 1024 * 4)
uint32_t getMaxBatches() const
uint32_t getMaxIndirects() const
Type | Name | Description |
---|---|---|
uint32_t | batches | Maximum number of draw batch parameters. |
uint32_t | indirects | Maximum number of draw indirect commands. |
Raster buffer parameters.
void setRasterSize(uint32_t groups = 1024 * 1024, uint32_t triangles = 1024 * 512)
uint32_t getMaxRasterGroups() const
uint32_t getMaxRasterTriangles() const
Type | Name | Description |
---|---|---|
uint32_t | groups | Maximum number of raster groups per frame. |
uint32_t | triangles | Maximum number of raster triangles per frame. |
Tracing buffer parameters.
void setTracingSize(uint32_t geometries = 1024 * 256)
uint32_t getMaxTracingGeometries() const
Type | Name | Description |
---|---|---|
uint32_t | geometries | Maximum number of tracing geometries per frame. |
Motion buffer parameters.
void setMotionSize(uint32_t transforms = 1024 * 256)
uint32_t getMaxMotionTransforms() const
Type | Name | Description |
---|---|---|
uint32_t | transforms | Maximum number of motion transform hashes. |
Light buffer parameters.
void setLightGridSize(Vector3u size = Vector3u(16, 16, 128), uint32_t count = 256)
const Vector3u getLightGridSize() const
uint32_t getLightGridCount() const
Type | Name | Description |
---|---|---|
Vector3u | size | Light grid size. |
uint32_t | count | Average number of lights per cell. |
Transparent buffer parameters.
void setTransparentSize(uint32_t size = 6, uint32_t layers = 8)
uint32_t getTransparentSize() const
uint32_t getTransparentLayers() const
Type | Name | Description |
---|---|---|
uint32_t | size | Maximum number of transparent pixels (frame overdraw). |
uint32_t | layers | Maximum number of top transparent layers to sort. |
Transparent texture layers.
bool addTransparentTexture(Texture &texture)
uint32_t getNumTransparentTextures() const
Texture getTransparentTexture(uint32_t index) const
Type | Name | Description |
---|---|---|
Texture | texture | Transparent texture layer (must be created by render manager). |
Shadow map parameters.
void setShadowMapSize(uint32_t size = 4096, uint32_t layers = 2, uint32_t border = 4)
uint32_t getShadowMapSize() const
uint32_t getShadowMapLayers() const
uint32_t getShadowMapBorder() const
Type | Name | Description |
---|---|---|
uint32_t | size | Shadow map atlas layers. |
uint32_t | layers | Number of shadow map atlas layers. |
uint32_t | border | Safe border between shadow maps. |
Scale parameters.
void setLightScale(float32_t scale)
void setObjectScale(float32_t scale)
void setScaleParameters(float32_t light = 1.0f, float32_t object = 1.0f)
float32_t getLightScale() const
float32_t getObjectScale() const
Type | Name | Description |
---|---|---|
float32_t | light | Light distance scale. |
float32_t | object | Object distance scale. |
Screen parameters.
void setScreenScale(float32_t scale)
void setScreenPower(float32_t power)
void setScreenVariance(float32_t variance)
void setScreenParameters(float32_t scale = 1.0f, float32_t power = 1.0f, float32_t variance = 1.0f)
float32_t getScreenScale() const
float32_t getScreenPower() const
float32_t getScreenVariance() const
Type | Name | Description |
---|---|---|
float32_t | scale | Weight scale. |
float32_t | power | Weight power. |
float32_t | variance | Variance scale. |
Ambient occlusion parameters.
void setOcclusionPower(float32_t power)
void setOcclusionSamples(uint32_t samples)
void setOcclusionSteps(uint32_t steps)
void setOcclusionDepth(float32_t depth)
void setOcclusionRange(float32_t range)
void setOcclusionBias(float32_t bias)
void setOcclusionParameters(float32_t power = 1.0f, uint32_t samples = 2, uint32_t steps = 32, float32_t depth = 1.0f, float32_t range = 1.0f, float32_t bias = 0.001f)
float32_t getOcclusionPower() const
uint32_t getOcclusionSamples() const
uint32_t getOcclusionSteps() const
float32_t getOcclusionDepth() const
float32_t getOcclusionRange() const
float32_t getOcclusionBias() const
Type | Name | Description |
---|---|---|
float32_t | power | Ambient Occlusion power. |
uint32_t | samples | Number of Occlusion samples. |
uint32_t | steps | Number of Occlusion screen steps. |
float32_t | depth | Occlusion screen depth. |
float32_t | range | Ambient Occlusion range. |
float32_t | bias | Ambient Occlusion tracing bias. |
Reflection parameters.
void setReflectionThreshold(float32_t threshold)
void setReflectionSamples(uint32_t samples)
void setReflectionSteps(uint32_t steps)
void setReflectionDepth(float32_t depth)
void setReflectionRange(float32_t range)
void setReflectionBias(float32_t bias)
void setReflectionParameters(float32_t threshold = 0.5f, uint32_t samples = 1, uint32_t steps = 32, float32_t depth = 0.1f, float32_t range = 1000.0f, float32_t bias = 0.001f)
float32_t getReflectionThreshold() const
uint32_t getReflectionSamples() const
uint32_t getReflectionSteps() const
float32_t getReflectionDepth() const
float32_t getReflectionRange() const
float32_t getReflectionBias() const
Type | Name | Description |
---|---|---|
float32_t | threshold | Reflection roughness threshold. |
uint32_t | samples | Number of Reflection samples. |
uint32_t | steps | Number of Reflection screen steps. |
float32_t | depth | Reflection screen depth. |
float32_t | range | Reflection tracing range. |
float32_t | bias | Reflection tracing bias. |
Refraction parameters.
void setRefractionDispersion(Vector3f dispersion)
void setRefractionThreshold(float32_t threshold)
void setRefractionScale(float32_t scale)
void setRefractionParameters(float32_t threshold = 1.0f, float32_t scale = 0.1f)
const Vector3f getRefractionDispersion() const
float32_t getRefractionThreshold() const
float32_t getRefractionScale() const
Type | Name | Description |
---|---|---|
Vector3f | dispersion | Refraction dispersion scale. |
float32_t | threshold | Refraction depth threshold. |
float32_t | scale | Refraction screen scale. |
Luminance parameters.
void setLuminanceBins(uint32_t bins)
void setMinLuminance(float32_t min_value)
void setMaxLuminance(float32_t max_value)
void setLuminanceRange(uint32_t bins = 128, float32_t min_value = 0.001f, float32_t max_value = 8192.0f)
void setLuminanceScale(float32_t scale = 0.0f)
void setLuminanceAdaptation(float32_t adaptation = 8.0f)
void setLuminanceTime(float64_t time)
uint32_t getLuminanceBins() const
float32_t getMinLuminance() const
float32_t getMaxLuminance() const
float32_t getLuminanceScale() const
float32_t getLuminanceAdaptation() const
float64_t getLuminanceTime() const
Type | Name | Description |
---|---|---|
uint32_t | bins | Luminance histogram size. |
float32_t | min_value | Minimum luminance histogram value. |
float32_t | max_value | Maximum luminance histogram value. |
float32_t | scale | Luminance exposure compensation. |
float32_t | adaptation | Luminance time adaptation coefficient. |
float64_t | time | Last luminance exposure time. |
Tonemap parameters.
void setTonemapValue(float32_t value)
void setTonemapContrast(float32_t contrast)
void setTonemapShoulder(float32_t shoulder)
void setTonemapMiddleIn(float32_t middle_in)
void setTonemapMiddleOut(float32_t middle_out)
void setTonemapParameters(float32_t value = 8.0f, float32_t contrast = 1.4f, float32_t shoulder = 1.0f, float32_t middle_in = 0.16f, float32_t middle_out = 0.16f)
float32_t getTonemapValue() const
float32_t getTonemapContrast() const
float32_t getTonemapShoulder() const
float32_t getTonemapMiddleIn() const
float32_t getTonemapMiddleOut() const
float32_t getTonemapScale() const
float32_t getTonemapBias() const
Type | Name | Description |
---|---|---|
float32_t | value | Maximum tonemapper value. |
float32_t | contrast | Curve contrast parameter. |
float32_t | shoulder | Curve shoulder parameter. |
float32_t | middle_in | Curve middle value input parameter. |
float32_t | middle_out | Curve middle value output parameter. |
Post parameters.
void setPostSaturation(float32_t saturation)
void setPostBrightness(float32_t brightness)
void setPostContrast(float32_t contrast)
void setPostMiddle(float32_t middle)
void setPostParameters(float32_t saturation = 0.0f, float32_t brightness = 0.0f, float32_t contrast = 0.0f, float32_t middle = 0.0f)
float32_t getPostSaturation() const
float32_t getPostBrightness() const
float32_t getPostContrast() const
float32_t getPostMiddle() const
Antialiasing parameters.
void setAntialiasingBias(float32_t bias)
void setAntialiasingPower(float32_t power)
void setAntialiasingVariance(float32_t variance)
void setAntialiasingDenoise(float32_t denoise)
void setAntialiasingDepth(float32_t depth)
void setAntialiasingParameters(float32_t bias = 1.0f, float32_t power = 1.0f, float32_t variance = 1.0f, float32_t denoise = 1.0f, float32_t depth = 1.0f)
float32_t getAntialiasingBias() const
float32_t getAntialiasingPower() const
float32_t getAntialiasingVariance() const
float32_t getAntialiasingDenoise() const
float32_t getAntialiasingDepth() const
const Vector2f getAntialiasingOffset() const
Type | Name | Description |
---|---|---|
float32_t | bias | Weight bias. |
float32_t | power | Weight power. |
float32_t | variance | Variance scale. |
float32_t | denoise | Denoise scale. |
float32_t | depth | Depth threshold. |
Frame uniform buffer.
Buffer getUniformBuffer() const
Frame luminance buffer.
Buffer getLuminanceBuffer() const
Frame tracing.
Tracing getFrameTracing() const
Frame textures normal is a deferred screen-space normal and binormal angle diffuse is a deferred base color texture (RGB is base color, A is multisample mask) metallic is a deferred metallic texture (R is occlusion, G is roughness, B is metallic, A is refletivity) auxiliary is a deferred auxiliary texture (R0 is clearcoat value, G0 is clearcoat roughness, B0 is anisotropy value, A0 is anisotropy angle, RGBA1 is frame geometry address) motion is a deferred motion texture (R is X motion, G is Y motion) temporal is composite temporal color texture (RGBA is upscaled color) history is composite history texture (RG is depth range, BA is motion vector) occluder is hierarchical depth occluder (R is min value (max depth), G is max value (min depth)).
Texture getDepthTexture(uint32_t index = 0) const
Texture getColorTexture(uint32_t index = 0) const
Texture getNormalTexture(uint32_t index = 0) const
Texture getDiffuseTexture(uint32_t index = 0) const
Texture getMetallicTexture(uint32_t index = 0) const
Texture getAuxiliaryTexture(uint32_t index = 0) const
Texture getMotionTexture(uint32_t index = 0) const
Texture getScreenTexture(uint32_t index = 0) const
Texture getLuminanceTexture(uint32_t index = 0) const
Texture getCompositeTexture(uint32_t index = 0) const
Texture getTemporalTexture(uint32_t index = 0) const
Texture getHistoryTexture(uint32_t index = 0) const
Texture getOccluderTexture(uint32_t index = 0) const
Swap textures.
Texture swapDepthTextures()
Texture swapColorTextures()
Texture swapNormalTextures()
Texture swapDiffuseTextures()
Texture swapMetallicTextures()
Texture swapAuxiliaryTextures()
Texture swapMotionTextures()
Texture swapScreenTextures()
Texture swapLuminanceTextures()
Texture swapCompositeTextures()
Texture swapTemporalTextures()
Texture swapHistoryTextures()
Texture swapOccluderTextures()
Present texture.
void setPresentTexture(Texture &texture)
Texture getPresentTexture() const
Shadow map texture.
Texture getShadowMapTexture() const
Flush frame.
void flush(const Device &device)
const Statistics getStatistics() const
Memory usage.
size_t getTextureMemory() const
size_t getBufferMemory() const
size_t getMemory() const
Load frame.
bool load(const Xml &xml)
bool load(const Json &json)
bool load(Stream &stream)
Save frame.
bool save(Xml &xml, bool force = false, bool comment = false) const
bool save(Json &json, bool force = false) const
bool save(Stream &stream) const
Type | Name | Description |
---|---|---|
bool | force | Keep default values. |
bool | comment | Comment default values. |
Enums
Frame parameters.
Name | Value | Description |
---|---|---|
MaxFrames | 16 | Maximum number of frames to cull. |
MaxShadowMaps | 128 | Maximum number of visible shadow maps. |
MaxShadowSplits | 8 | Maximum number of shadow map splits. |
Structs
Statistics
Frame statistics.
Variables
Type | Name | Description |
---|---|---|
uint32_t | num_lights | Number of lights. |
uint32_t | num_shadow_maps | Number of shadow maps. |
uint32_t | num_frame_objects | Number of frame objects. |
uint32_t | num_frame_instances | Number of frame instances. |
uint32_t | num_frame_geometries | Number of frame geometries. |
uint32_t | num_shadow_map_objects | Number of shadow map objects. |
uint32_t | num_shadow_map_instances | Number of shadow map instances. |
uint32_t | num_shadow_map_geometries | Number of shadow map geometries. |
uint32_t | num_tracing_objects | Number of tracing objects. |
uint32_t | num_tracing_instances | Number of tracing instances. |
uint32_t | num_tracing_geometries | Number of tracing geometries. |