Unigine.Renderer Class
A basic interface for setting a renderer state (changing rendering passes parameters): pass shader uniforms, set modelview and projection matrices, etc. This class is used for rendering custom nodes (for example, a node inherited from ObjectExtern).
The Renderer class provides the following structures representing constant buffers:
Renderer Class
Enums
RENDER_STEREO_EYE#
Stereo eye enumeration.Name | Description |
---|---|
NONE = 0 | None of the stereo eyes. |
LEFT = 1 | Left stereo eye. |
RIGHT = 2 | Right stereo eye. |
LEFT_FOCUS = 3 | Left eye focus view. |
RIGHT_FOCUS = 4 | Right eye focus view. |
Structs
struct
A structure that represents a buffer for storing camera parameters.Fields
- mat4 camera_projection - Camera projection matrix.
- mat4 camera_iprojection - Camera inverse projection matrix.
- mat4 oblique_frustum_plane - World coordinates of the oblique frustum culling plane in the format (Nx, Ny, Nz, D), where Nx, Ny, Nz are the coordinates of the plane normal, and D is the distance from the origin to the plane.
- int is_oblique_frustum - Flag indicating if the viewing frustum is oblique.
- mat4 projection - Projection matrix.
- mat4 iprojection - Inverse projection matrix.
- mat4 projection_screen - Projection matrix for the screen space effect.
- mat4 iprojection_screen - Inverse projection matrix for the screen space effect.
- mat4 imodelview - Inverse view matrix.
- mat4 old_imodelview - Inverse old view matrix used for rendering of the previous frame.
- mat4 old_imodelview_delta - Delta of the old inverse view and inverse view matrices.
- mat4 modelview - View matrix.
- mat4 old_modelview - Old view matrix.
- vec3 camera_offset - Camera additional transformation (offset). This transformation is applied after the view transformation. The offset does not affect the view matrix or the camera position.
- vec3 camera_position - Camera position.
- vec3 camera_direction - Inverted normalized camera direction vector.
- vec3 projection_row_0 - The first row of the camera projection matrix.
- vec3 projection_row_1 - The second row of the camera projection matrix.
- vec3 projection_row_2 - The third row of the camera projection matrix.
- vec4 modelview_projection_x - The first row of the view projection matrix.
- vec4 modelview_projection_y - The second row of the view projection matrix.
- vec4 modelview_projection_w - The third row of the view projection matrix.
- vec4 modelview_projection_old_x - The first row of the old view projection matrix used for rendering of the previous frame.
- vec4 modelview_projection_old_y - The second row of the old view projection matrix used for rendering of the previous frame.
- vec4 modelview_projection_old_w - The third row of the old view projection matrix used for rendering of the previous frame.
- float camera_fov - Camera vertical field of view.
- int shadow_cascade_target - Current shadow cascade used for rendering shadows.
struct
A structure that represents a buffer for storing scattering parameters.Fields
- vec3 scattering_sun_dir - Direction vector of the World light source having the Sun scattering mode.
- vec3 scattering_moon_dir - Direction vector of the World light source having the Moon scattering mode.
- float environment_ambient_intensity - Intensity of the environment ambient lighting. The higher the value, the more ambient lighting affects the environment. 0s means no environment reflection.
- float environment_reflection_intensity - Intensity of the environment reflection.
- float environment_sky_intensity - Intensity of the environment sky. 0 means no environment sky.
- vec4 haze_color - Haze color.
- float haze_max_distance - Distance starting from which the haze becomes completely solid, so nothing will be seen behind.
- float haze_density - Haze density.
- float haze_physical_start_height - Reference height value for the half visibility distance and half faloff height.
- float haze_physical_density - Distance to the boundary at which the visibility comprises 50%. There is no zero-visibility in the real world, so the half-visibility boundary is used to adjust haze distance.
- float haze_physical_falloff - Height of the haze density gradient. The higher the value, the longer the haze desity reduces as the height grows, making the transition between the clear sky and haze smoother.
- float haze_physical_zero_visibility_height - Height at which the haze completely overlaps the scene.
- float haze_physical_screen_space_global_illumination - Value indicating if the Screen-Space Haze Global Illumination effect is enabled.
- float haze_physical_ambient_light_intensity - Intensity of the impact of the ambient lighting on haze (how much the ambient lighting affects the haze).
- float haze_physical_ambient_color_saturation - Intensity of the ambient color's contribution to the haze (how much the sunlight affects the haze).
- float haze_physical_sun_light_intensity - Intensity of the impact of the sunlight on haze (how much the sunlight affects the haze).
- float haze_physical_sun_color_saturation - Intensity of the impact of the sunlight on haze (how much the sunlight affects the haze).
- float haze_scattering_mie_intensity - Minimum Mie intensity value for geometry-occluded areas. This value specifies the fraction of Mie intensity visible when the surface is viewed from straight on.
- float haze_scattering_mie_front_side_intensity - Falloff of the Fresnel effect for Mie intensity. This value is used to control occlusion of light from a World light source by the geometry.
- float haze_scattering_mie_fresnel_power - Power of the Fresnel effect for Mie visibility. Higher values will tighten up the areas affected, while lower ones will allow more areas to be affected by the Fresnel effect.
- vec3 sky_up - Sky up vector.
- float sky_altitude - Sky altitude.
- mat4 sky_transform - Sky transformation matrix.
- vec3 sun_color - Sun color.
- mat4 sun_rotation - Sun rotation matrix.
- mat4 moon_rotation - Moon rotation matrix.
struct
A structure that represents a buffer for storing tone mapping parameters.Fields
- vec4 filmic_curve - Vector of parameters for a tone mapping curve.
- vec4 filmic_white - Parameter determining the brightness at which a pixel becomes pure white in the resulting image.
- float filmic_saturation_recovery - Color saturation recovery value for the filmic tonemapper.
- float aces_white_clip - White clip parameter for the ACES operator. Controls the cut-off point for white.
- float aces_toe - Toe parameter for the ACES operator. Controls the dark color. Higher values result in darker colors.
- float aces_shoulder_angle - Shoulder angle parameter for the ACES operator. Controls how much overshoot should be added to the curve's shoulder.
- float aces_shoulder_strength - Shoulder strength parameter for the ACES operator. Controls the strength of the transition between the curve's midsection and the curve's shoulder.
- float aces_shoulder_length - Shoulder length parameter for the ACES operator. Controls the amount of f-stops to add to the dynamic range of the curve. Defines how much of the highlights the curve takes into account.
- float aces_with_reinhard_mix - ACES with Reinhard tone mapping operator contribution.
- float aces_with_reinhard_white_clip - White clip parameter for the ACES with Reinhard operator. Controls the cut-off point for white.ACES with Reinhard operator's white clip.
- float aces_with_reinhard_toe - Toe parameter for the ACES with Reinhard operator. Controls the dark color. Higher values result in darker colors.
- float aces_with_reinhard_shoulder_angle - Shoulder angle parameter for the ACES with Reinhard operator. Controls how much overshoot should be added to the curve's shoulder.
- float aces_with_reinhard_shoulder_strength - Shoulder strength parameter for the ACES with Reinhard operator. Controls the strength of the transition between the curve's midsection and the curve's shoulder.
- float aces_with_reinhard_shoulder_length - Shoulder length parameter for the ACES with Reinhard operator. Controls the amount of f-stops to add to the dynamic range of the curve. Defines how much of the highlights the curve takes into account.
- float reinhard_contribution - Reinhard tone mapping operator contribution.
- float reinhard_luma_based_contribution - Reinhard Luma-Based tone mapping operator contribution. Controls the overall contribution that the Reinhard operator makes to the final color grading of the image.
Properties
Texture TextureGBufferVelocity#
Texture TextureGBufferFeatures#
The texture that stores intensity of the screen-space bevel effect.
Texture TextureGBufferMaterialMask#
Texture TextureGBufferNormal#
Texture TextureGBufferShading#
Texture TextureGBufferAlbedo#
Texture TextureClouds#
The clouds texture. This texture is rendered during the separate clouds pass.
Texture TextureAutoWhiteBalance#
Texture TextureAutoExposure#
The autoexposure texture.
Texture TextureDOFMask#
The DoF mask texture. This texture is used at the camera effects stage.
Texture TextureSSCurvature#
The texture used by the Screen-Space Dirt (SSDirt) effect.
Texture TextureSSR#
The SSR texture.
Texture TextureSSGI#
The SSGI texture.
Texture TextureSSShadowShafts#
The Screen-Space Shadow Shafts texture.
Texture TextureSSAO#
The SSAO texture.
Texture TextureBentNormal#
The bent normal texture. This texture is used during the Screen-Space Global Illumination stage.
Texture TextureIndirectLights#
The array texture storing contents of the deferred reflections buffer. The texture contains two RG11B10F textures: the first layer stores the environment reflection color, and the second layer stores the environment ambient light.
Texture TextureDirectLights#
The array texture storing contents of the deferred light buffer. The texture contains two RG11B10F textures: the first layer stores the diffuse light, and the second layer stores the specular light.
Texture TextureTransparentBlur#
The transparent blur texture. This texture is rendered during the transparent blur pass.
Texture TextureRefractionMask#
The refraction mask texture.
Texture TextureRefraction#
The refraction texture.
Texture TextureAuxiliary#
The auxiliary texture.
Texture TextureLinearDepth#
The texture that stores linear depth data.
Texture TextureOpacityDepth#
Texture TextureCurrentDepth#
Texture TextureNormalUnpack#
The texture that stores unpacked normals.
Texture TextureColorOldReprojection#
Texture TextureColorOld#
The color old texture.
Texture TextureColorOpacity#
The color opacity texture.
Texture TextureColor#
The color texture.
RenderTarget PostRenderTarget#
The post texture render.
RenderTarget RenderTarget#
The render target.
int Height#
The screen height.
int Width#
The screen width.
Texture OverlapEnvironmentTexture#
The currently used environment cubemap texture.
Light CurrentLight#
The currently rendered light source. This method can be used to obtain shadow maps for a certain light source in an event handler (see BeginShadows event).
bool ObliqueFrustum#
The a value indicating if the viewing frustum is oblique.
vec4 ObliqueFrustumPlane#
The oblique near clipping plane of the viewing frustum.
float ZFar#
The Return current far clipping plane.
float ZNear#
The near clipping plane.
vec3 CameraPosition#
The camera position.
mat4 OldModelview#
The old view matrix.
mat4 IModelview#
The inverse view matrix.
mat4 Modelview#
The view matrix.
mat4 ProjectionWithoutTAA#
The projection matrix without TAA.
mat4 OldProjection#
The old projection matrix.
mat4 Projection#
The projection matrix.
Viewport Viewport#
The rendering viewport.
int StereoMode#
The stereo mode.
Renderer.RENDER_STEREO_EYE StereoCurrentEye#
The current stereo eye.
int SkipFlags#
The skip flag set for the rendering viewport.
int ReflectionViewportMask#
The reflection viewport mask.
int ViewportMask#
The viewport mask.
bool IsStereo#
The a value indicating if stereo rendering is enabled.
bool IsShadow#
The a value indicating if shadows are rendered.
bool IsReflection#
The a value indicating if reflection rendering is in progress.
bool IsNode#
The a value indicating if node rendering is in progress.
CBufferScattering ShaderCBufferScattering#
The a buffer containing scattering parameters to be passed to a custom shader. This method can be used in a event handler to obtain scattering parameters at a certain stage of the rendering sequence and pass them to a custom shader.
CBufferCamera ShaderCBufferCamera#
The a buffer containing camera parameters to be passed to a custom shader. This method can be used in a event handler to obtain camera parameters at a certain stage of the rendering sequence and pass them to a custom shader.
bool UseTAAOffset#
The value indicating if skipping render mode check is enabled for using TAA. Can be used to ensure proper TAA calculation when rendering mode for the Viewport is set to RENDER_DEPTH.
bool IsStereoPeripheral#
The a value indicating if peripheral stereo rendering is enabled.
CBufferTonemapper ShaderCBufferTonemapper#
The Buffer containing tone mapping parameters to be passed to a custom shader.
Members
void ClearStates ( ) #
Clears rendering states and textures.The shader will also be cleared.
void ClearShader ( ) #
Clears the shader.void SetBlendFunc ( Render.PASS pass, Material material ) #
Sets the light blending function for a given rendering pass and material.Arguments
- Render.PASS pass - Rendering pass. One of the following values:
- Material material - Material smart pointer.
void SetBufferMask ( Render.PASS pass, Material material ) #
Sets the buffer mask for a given rendering pass and material.If the material does not use a depth mask and ambient pass is specified, the BUFFER_COLOR mask will be set; otherwise, the BUFFER_ALL mask will be set.
Arguments
- Render.PASS pass - Rendering pass. One of the following values:
- Material material - Material smart pointer.
void SetDepthFunc ( Render.PASS pass, Material material ) #
Sets depth function for a given rendering pass and material.If the depth_test option of the material is enabled, the DEPTH_GEQUAL function will be used; otherwise the depth comparison function will be disabled.
Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables, except the following: PASS_DEFERRED, PASS_SHADOW, PASS_DEPTH_PRE_PASS, PASS_EMISSION.
- Material material - Material smart pointer.
bool HasGeodeticPivot ( ) #
Returns a value indicating if the rendering scene has a GeodeticPivot.Return value
1 if the rendering scene has a GeodeticPivot; otherwise, 0.void SetMaterial ( Render.PASS pass, Material material ) #
Sets material and initialize all material textures for the specified rendeting pass.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Material material - Material smart pointer.
void SetPolygonCull ( Render.PASS pass, Material material ) #
Sets the polygon culling mode for a given rendering pass and material.If the material is one-sided, the back-facing polygons will be culled; otherwise, polygon culling for the material will be disabled.
Arguments
- Render.PASS pass - Rendering pass. One of the RENDER_PASS_* variables.
- Material material - Material smart pointer.
void SetShaderParameters ( Render.PASS pass, Shader shader, bool is_screen_space = 0 ) #
Sets the parameters of the specified shader for a given rendering pass.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Shader shader - Shader smart pointer.
- bool is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.
void SetShaderParameters ( Render.PASS pass, Shader shader, Material material, bool is_screen_space = 0 ) #
Sets the parameters of the specified shader for a given rendering pass and material.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Shader shader - Shader smart pointer.
- Material material - Material smart pointer.
- bool is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.
void SetShaderParameters ( Render.PASS pass, Shader shader, Material material, Object object, int surface, bool is_screen_space = 0 ) #
Sets the parameters of the specified shader for a given rendering pass, material, object and surface.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Shader shader - Shader smart pointer.
- Material material - Material smart pointer.
- Object object - Object smart pointer.
- int surface - Surface number.
- bool is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.
void SetShaderParameters ( Render.PASS pass, Material material, bool is_screen_space = 0 ) #
Sets the parameters of the shader for a given rendering pass and material.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Material material - Material smart pointer.
- bool is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.
void SetShaderParameters ( Render.PASS pass, Object object, int surface, bool is_screen_space = 0 ) #
Sets the parameters of the shader for a given rendering pass, object and surface.Arguments
- Render.PASS pass - Rendering pass. One of the PASS_* variables.
- Object object - Object smart pointer.
- int surface - Surface number.
- bool is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.
int CheckSkipFlags ( int flags ) #
Returns a value indicating if the specified skip flag is set.Arguments
- int flags - Skip flag.
Return value
1 if the specified skip flag is set; otherwise, 0.Texture GetTextureDirectLights ( ) #
Returns the array texture storing contents of the deferred light buffer. The texture contains two RG11B10F textures: the first layer stores the diffuse light, and the second layer stores the specular light.Return value
A texture storing contents of the deferred light buffer.Texture GetTextureIndirectLights ( ) #
Returns the array texture storing contents of the deferred reflections buffer. The texture contains two RG11B10F textures: the first layer stores the environment reflection color, and the second layer stores the environment ambient light.Return value
A texture storing contents of the deferred reflections buffer.void SaveState ( ) #
Saves current renderer matrices.void RestoreState ( ) #
Restores current renderer matrices.bool UseDynamicReflections ( ) #
Returns a value indicating if rendering of dynamic reflections is enabled.Return value
1 if rendering of dynamic reflections is enabled; otherwise, 0.bool UseOcclusionQueries ( ) #
Returns a value indicating if the occlusion query test is enabled.Return value
1 if the occlusion query test is enabled; otherwise, 0.bool UsePostEffects ( ) #
Returns a value indicating if rendering of post effects is enabled.Return value
1 if rendering of post effects is enabled; otherwise, 0.bool UseShadows ( ) #
Returns a value indicating if rendering of shadows is enabled.Return value
1 if rendering of shadows is enabled; otherwise, 0.bool UseTAA ( ) #
Returns a value indicating if the Temporal Anti-Aliasing (TAA) is enabled.Return value
1 if the Temporal Anti-Aliasing (TAA) is enabled; otherwise, 0.bool UseVelocityBuffer ( ) #
Returns a value indicating if rendering to the velocity buffer is enabled.Return value
1 if rendering to the velocity buffer is enabled; otherwise, 0.bool UseVisualizer ( ) #
Returns a value indicating if rendering of the visualizer is enabled.Return value
1 if rendering of the visualizer is enabled; otherwise, 0.Texture CreateCustomTexture3D ( string name, int width, int height, int depth, int format, int flags = 0 ) #
Creates a custom 3D texture. Such textures can be used in your materials.In your base material:
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->
Create a corresponding custom texture via code:
// ...
// creating a custom texture
Renderer::createCustomTexture3D("texture_name", 512, 512, 512, Texture::FORMAT_RGBA8);
Arguments
- string name - Texture name.
- int width - Texture width, in pixels.
- int height - Texture height, in pixels.
- int depth - Texture depth, in pixels.
- int format - Texture format, one of the Texture.FORMAT_ values.
- int flags - Texture flags. A combination of flags (such as Texture.FORMAT_USAGE_, Texture.SAMPLER_WRAP_, etc.)
Return value
New created custom 3D texture.Texture CreateCustomTexture2D ( string name, int width, int height, int format, int flags = 0 ) #
Creates a custom 2D texture array. Such texture can be used in your materials.In your base material:
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->
Create a corresponding custom texture via code:
// ...
// creating a custom texture
Renderer::createCustomTexture2D("texture_name", 512, 512, Texture::FORMAT_RGBA8);
Arguments
- string name - Texture name.
- int width - Texture width, in pixels.
- int height - Texture height, in pixels.
- int format - Texture format, one of the Texture.FORMAT_ values.
- int flags - Texture flags. A combination of flags (such as Texture.FORMAT_USAGE_, Texture.SAMPLER_WRAP_, etc.)
Return value
New created custom 2D texture.Texture CreateCustomTexture2DArray ( string name, int width, int height, int depth, int format, int flags = 0 ) #
Creates a custom 2D texture array. Such texture can be used in your materials.
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->
Create a corresponding custom texture via code:
// ...
// creating a custom texture
Renderer::createCustomTexture2DArray("texture_name", 512, 512, 16, Texture::FORMAT_RGBA8);
Arguments
- string name - Texture name.
- int width - Texture width, in pixels.
- int height - Texture height, in pixels.
- int depth - Number of elements in the array.
- int format - Texture format, one of the Texture.FORMAT_ values.
- int flags - Texture flags. A combination of flags (such as Texture.FORMAT_USAGE_, Texture.SAMPLER_WRAP_, etc.)
Return value
New created custom 2D texture array.Texture GetCustomTexture ( string name ) #
Returns a custom texture by its name. Custom textures can be created using createCustomTexture3D(), createCustomTexture3D(), and createCustomTexture3D() methods.Arguments
- string name - Custom texture name.
Return value
Custom texture corresponding to the specified name, if it exists, otherwise NULL.void ResetOverlapEnvironmentTexture ( ) #
Resets the environment cubemap texture to default (no environment texture is used).void RenderMesh ( MeshRender mesh, Material material, string pass_name, mat4 transform, Camera camera ) #
Renders the specified render mesh with the specified material applied to it during the specified render pass as viewed from by specified camera.Arguments
- MeshRender mesh - Render mesh to be rendered.
- Material material - Material to be used to render the mesh.
- string pass_name - Name of the rendering pass during which the mesh is to be rendered.
- mat4 transform - Transformation to be passed to shader for rendering.
- Camera camera - Camera to be used for mesh rendering.
bool UseUpscale ( ) #
Last update:
2024-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)