This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.LightPlanarProbe Class

Inherits from: Light

This class is used to create and manage Planar Reflection Probes the implement planar reflections functionality (used to create mirrors etc.). The probe grabs the reflection, and requires a surface to project the reflection onto. There is a set of parameters enabling you to tweak the look of your reflections and optimize rendering load (by limiting visibility distance, reflections rendering distance, etc.).

Usage Example#

In the example below a Planar Reflection Probe is created along with a plane primitive. The surface of the primitive serves for projecting the reflection grabbed by the probe (the reflection is projected only within the area of intersection of the probe and the surface). Some parameters of the material assigned to the reflecting surface are also tweaked in order to provide the desired effect and match roughness range (which enables rendering of reflections depending on surface roughness).

Copy the source code below implemented as a C# component, save it to the PlanarReflector.cs file, create a new Dummy Node or choose any other node in the scene and assign the component to it.

Source code (C#)
// PlanarReflector.cs

using System;
using System.Collections;
using System.Collections.Generic;
using Unigine;

[Component(PropertyGuid = "")]	//<--- guid is autogenerated on component creation
public class PlanarReflector : Component
{
	private ObjectMeshDynamic plane;
	private LightPlanarProbe planar_probe;
	private void Init()
	{
		// write here code to be called on component initialization
		//creating a reflecting plane, onto which the reflection is to be projected by the probe
		plane = Primitives.CreatePlane(20, 20, 1);
	
		// Creating a planar reflection probe of the same size
		planar_probe = new LightPlanarProbe();
		planar_probe.ProjectionSize = new vec3(20, 20, 1);
		plane.Rotate(-90.0f, 0.0f, 0.0f);
		plane.Translate(0.0f, 5.0f, 5.0f);

		// putting the planar probe so that it covers the reflecting surface
		planar_probe.Transform = plane.Transform;

		// inheriting a new material from the one assigned
		// to the surface by default in order to tweak it
		// and set metalness and roughness values (metallic and polished)
		Material plane_mat = plane.GetMaterialInherit(0);
		plane_mat.SetParameterFloat("metalness", 1.0f);
		plane_mat.SetParameterFloat("roughness", 0.0f);

		// set the distance from the camera, up to which 
		// the planar reflection will be visible
		planar_probe.VisibleDistance = 5.0f;
	}
	
	private void Update()
	{
		// write here code to be called before updating each render frame
		
	}
}

LightPlanarProbe Class

Enums

REFLECTION_RESOLUTION#

NameDescription
MODE_HEIGHT = 0Reflection texture size equals to the viewport height resolution.
MODE_HALF_HEIGHT = 1Reflection texture size equals to half of the viewport height resolution.
MODE_QUART_HEIGHT = 2Reflection texture size equals to the quarter of the viewport height resolution.
MODE_128 = 3Reflection texture size equals to 128x128 pixels.
MODE_256 = 4Reflection texture size equals to 256x256 pixels.
MODE_512 = 5Reflection texture size equals to 512x512 pixels.
MODE_1024 = 6Reflection texture size equals to 1024x1024 pixels.
MODE_2048 = 7Reflection texture size equals to 2048x2048 pixels.
MODE_4096 = 8Reflection texture size equals to 4096x4096 pixels.

Properties

vec3 ProjectionSize#

The current size of the Light Planar Probe.

vec3 AttenuationDistance#

The current distance from the probe, at which the probe doesn't project anything in the reflection.

int RoughnessSamples#

The maximum number of blurring samples.

LightPlanarProbe.REFLECTION_RESOLUTION ReflectionResolution#

The current resolution of the reflection texture in pixels.

bool TwoSided#

The value indicating if the reflection is two-sided.

bool StereoPerEyeEnabled#

The value indicating if rendering of the reflection for each eye separately is enabled.

float DistanceScale#

The current distance scale for the reflection.

float ReflectionDistance#

The current rendering distance of the reflected projection.

int ReflectionViewportMask#

The reflection mask that controls rendering of the Planar Reflection Probe reflections into the reflection camera viewport.

int VisibilitySkipFlags#

The mask that specifies what objects to ingore for the reflection projection (sky).

float ZNear#

The current distance to the near clipping plane defining a frustum to be used for grabbing reflections.

float ZFar#

The current distance to the far clipping plane defining a frustum to be used for grabbing reflections.

float ReflectionVisibilityRoughnessMin#

The current lower surface roughness limit, starting from which the reflection starts to fade out gradually.

float ReflectionVisibilityRoughnessMax#

The current upper surface roughness limit, starting from which the reflection completely disappears.

bool VisibilitySky#

The value indicating if rendering of the sky is enabled or disabled for the reflection.

float Parallax#

The value indicating the current degree of reflection distortion.

float NoiseIntensity#

The current intensity of noise effect for the projection.

float ReflectionOffset#

The current Z axis offset relative to the probe position.

Members


LightPlanarProbe ( ) #

Constructor. Creates a new planar probe.

static int type ( ) #

Returns the object node type.
Last update: 2022-12-14
Build: ()