Nodes
Cluster#
This sample demonstrates dynamic manipulation of ObjectMeshCluster in UNIGINE, showcasing how to add/remove mesh instances at runtime through user interaction. A Mesh Cluster allows you to bake identical meshes (with the same material applied to their surfaces) into a single object, which provides less cluttered spatial tree, reduces the number of texture fetches and speeds up rendering.
Core Features:
- Placement and Removal - click on empty ground adds a new mesh at the clicked position, click on existing cluster geometry removes the selected mesh instance from the cluster
- Raycasting and Intersection Testing - casts a ray from the camera through the mouse position to detect whether the user clicked on a cluster mesh or terrain
Use Cases:
- Scattering objects like rocks, grass, or debris
- Dynamic level editing and environment design
- Performance-sensitive applications with many similar mesh instances.
SDK Path: <SDK_INSTALLATION>source/nodes/cluster
Clutter-to-Cluster Converter#
This sample demonstrates how to dynamically generate a clutter (ObjectMeshClutter) and convert it into an optimized cluster (ObjectMeshCluster) in real time. The clutter is generated using a random seed, and the conversion process transfers all key parameters from the clutter: materials, surface properties, LOD, shadows, physics, and collision settings.
The resulting cluster inherits the clutter's transform and hierarchy, but lets you selectively edit and remove individual elements of the group. Very often when building your worlds it is necessary to scatter meshes across a certain area randomly and then reposition some of them manually (e.g. when creating forests).
UI Features:
- Generate Clutter - Creates a randomized layout of clutter meshes.
- Convert to Cluster - Merges all clutter instances into a single ObjectMeshCluster with identical visual/physical behavior.
SDK Path: <SDK_INSTALLATION>source/nodes/clutter_to_cluster
Landscape Combined Modification#
This sample demonstrates a hybrid approach to terrain editing using both non-destructive (using multiple Landscape Layer Maps) and destructive (using Landscape::asyncTextureDraw() method) Landscape Terrain modification techniques.
It works by:
- Sampling height data from a Source Landscape Layer Map
-
Using Landscape::asyncTextureDraw() in combination with a custom material additive height blending to modify the Target Layer Map if the sampled height is above the provided threshold:
- The target terrain is flattened (clamped to the height threshold)
- The target albedo (on the threshold height level) is painted orange.
This sample is ideal for tools that require selective terrain stamping, erosion masks, or custom terrain sculpting.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_combined
Landscape Creation#
This sample demonstrates how to dynamically generate a Landscape Layer Map using tiled albedo, height, and mask textures. The process uses the LandscapeMapFileCreator and LandscapeMapFileSettings APIs to build a fully functional .lmap file and configure it for use with the Landscape Terrain object.
Key features:
- Supports tile-based input with user-defined grid size and resolution
-
Loads and validates image tiles for:
- Albedo
- Height
- Grass mask
- Stone mask
- Applies blend settings for each layer using LandscapeMapFileSettings
- Automatically creates and attaches the landscape objects to the world.
This workflow is ideal for runtime terrain generation, procedural terrain tools, or editor extensions that need to assemble terrain data from image sources.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_create
Landscape Details#
This sample demonstrates how to add and manage detail layers for a LandscapeTerrain object using the getDetailMask() and addDetail() methods.
It dynamically creates and configures three types of terrain details:
- Grass
- Stone
- Snow caps (simple white material applied based on elevation using height constraints - no texture).
Each detail is:
- Mapped to a separate detail mask
- Assigned a custom material
- Ordered visually using swapRenderOrder() to ensure natural blending (stone below grass, grass below snow).
This setup is useful for biome-style terrain detailing, visual layering of materials, and real-time terrain customization.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_details
Landscape Excavation#
This sample demonstrates destructive, real-time modification of a Landscape Layer Map using a 3D object (e.g., a tractor grader) as an excavation tool.
Key features:
- Samples base terrain height from a source layer
- Projects the grader's depth map onto the terrain using an orthographic camera
- Uses a custom material (digging_tool.basemat) to update height data and clear mask layers
- Applies updates asynchronously using Landscape::asyncTextureDraw()
- Supports full interactive movement and rotation of the grader with the Manipulator widget.
This sample is ideal for developing terrain deformation mechanics in simulators, construction games, or any scenario requiring runtime landscape sculpting based on object interaction.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_excavation
Landscape Fetch#
This sample demonstrates how to retrieve detailed information from a LandscapeTerrain object at any arbitrary point on its surface using LandscapeFetch.
Key Features:
- Casts a ray from the camera through the mouse cursor
- Performs asynchronous intersection tests with the terrain
Retrieves:
- Surface height
- Surface normal
- Blend mask values for all configured layers
- Surface albedo
Visualizes results in the viewport with:
- A normal vector
- A floating text box showing the terrain fetch data.
This feature can be used for terrain debugging, editor extensions, dynamic content placement, and real-time visualization of terrain attributes.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_fetch
Landscape Paint Clutter#
This sample demonstrates real-time painting of Landscape Layer Map mask data using a customizable brush system.
Key Features:
- Terrain modification using Landscape::asyncTextureDraw()
Brush parameters:
- Texture, mask
- Size, angle, spacing, opacity
- Visual brush preview via DecalOrtho
- Powered by a custom base material (landscape_mask_brush.basemat) for applying edits.
Ideal for runtime editing tools, vegetation control, or any system requiring dynamic terrain mask authoring.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_mask_paint
Landscape Mesh#
This sample demonstrates how to generate a procedural mesh (ObjectMeshDynamic) that represents a selected region of the Landscape Terrain.
Key Features:
- Terrain data (height and albedo) is fetched at runtime using LandscapeFetch
- Mesh resolution, position, scale, and rotation can be customized via UI
- Optionally render a bounding box and wireframe overlay
Ideal for:
- Runtime terrain previews
- Simplified LOD meshes or data extraction for analysis/simulation.
The generated mesh uses a basic material and includes color data sampled from the terrain's albedo layer. Use the Generate button to fetch terrain data and construct the mesh in real time.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_mesh
Landscape Paint#
This sample demonstrates several techniques for destructive runtime modification of the Landscape Terrain by altering the underlying textures of a Landscape Layer Map using Landscape::asyncTextureDraw() in combination with custom base materials.
It features three distinct painting modes:
- Albedo Painter: Allows painting of the terrain's albedo texture using a customizable brush (texture, mask, size, angle, opacity, and color).
- Height Painter: Enables height modification using height values and scaling options, along with support for alpha or additive blending modes.
- Height To Albedo: Converts terrain height data into albedo colorization based on a user-selected gradient and specified height range.
You can dynamically change brush parameters through a UI panel (textures, masks, gradient, size, spacing, angle, opacity, and color) and visualize the brush as an orthographic decal projected onto the terrain.
Use Cases
- Runtime terrain painting tools for level editors and world-building interfaces
- Terrain sculpting systems in games or simulations
- Custom height-based texturing workflows for stylized or procedurally modified terrains
- Visualization of terrain blending behavior with UI interactivity.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_paint
Landscape Tracks#
This sample demonstrates non-destructive runtime modification of the Landscape Terrain by dynamically spawning multiple Landscape Layer Map beneath moving objects (such as vehicles or characters) to create realistic track imprints on the terrain.
Each track is rendered using a dedicated Landscape Layer Map that blends additively with the terrain’s height data and alpha blends with the albedo, producing visually convincing trails without altering the original terrain layers.
Key Features
- Automatic track spawning based on object movement
- Track maps are spawned only when the object has moved a minimum distance (user-defined)
- The number of active track maps is limited for performance (configurable limit)
- Albedo and height blending are handled via standard non-destructive layering, ensuring easy track removal or replacement.
Customizable Parameters
- Min Distance Between Tracks - Controls how frequently new track maps are spawned based on movement
- Max Number of Track Maps - Caps the number of simultaneously active track layers to manage memory and performance.
Use Cases
- Vehicle or character track systems for games and simulations
- Temporary terrain effects (e.g., tire marks, footprints, sliding trails)
- Runtime procedural content that doesn't permanently modify base terrain.
SDK Path: <SDK_INSTALLATION>source/nodes/landscape_tracks
Lights#
This sample demonstrates how to create light sources and modify their parameters at runtime:
- World Light - an infinitely remote light source casting orthographically projected beams onto the scene.
- Projected Light - a light source that casts light from a single point forming a focused beam aimed in a specific direction.
- Omni Light - a point source emitting light in all directions (360 degrees) and realistically reproducing shadow cast.
SDK Path: <SDK_INSTALLATION>source/nodes/lights
Node Extern#
UNIGINE allows you to extend its out-of-the-box functionality in various ways, including adding custom nodes with personalized behavior, functions, and visualization (if needed).
This sample demonstrates how to implement a custom user node based on the NodeExtern class, featuring bounding box visualization and runtime configuration of node parameters (e.g., bounding box color). These nodes can then be added to your scene via API.
SDK Path: <SDK_INSTALLATION>source/nodes/node_extern
Object Extern#
UNIGINE allows you to extend its out-of-the-box functionality in various ways, including adding your own objects with custom geometry and behavior (e.g., custom particle systems, meshes with custom culling, animated GPU-based crowd rendering solutions, etc.).
This sample demonstrates how to implement custom user objects based on the ObjectExtern class, incorporating custom rendering, physics, and properties, while maintaining full engine integration. These objects can then be added to your scene via API.
SDK Path: <SDK_INSTALLATION>source/nodes/object_extern
Object Creation#
This sample demonstrates the basics of working with Objects - how to create and modify objects via API, highlighting the differences between various types of objects (ObjectMeshStatic, ObjectMeshDynamic, ObjectParticles). Objects are characterized by a set of surfaces, an optional physical body and type-specific properties.
In this sample, we create and configure three types of objects with interactive controls:
1. Static Mesh Object (Material Ball)
- Load an existing .mesh file (material_ball.mesh).
- Assigns a material to the object.
- Adds a Body with a Box-shaped collision.
2. Dynamic Mesh Object (Tetrahedron)
- Constructs a custom ObjectMeshDynamic manually.
- Applies a glass-like material.
- Adds a Body with a Sphere-shaped collision.
- Creates a default ObjectParticles object.
- Configures particle-specific parameters, such as spawn rate and lifetime, and enables a collision mask for particle interaction.
Runtime Modifications (via Sample Menu)
- Adjust the albedo color of the Static Mesh material.
- Modify the mesh (tetrahedron base height) in the Dynamic Mesh.
- Tune the spawn rate of the Particle System.
- Toggle the visualization of surfaces and physical shapes of the objects.
For more complex objects, such as ObjectWaterGlobal and ObjectLandscapeTerrain, see the corresponding samples.
SDK Path: <SDK_INSTALLATION>source/nodes/create_objects
Players#
This sample demonstrates how to create and configure the four available Players:
- PlayerDummy - a manually controlled camera that has no physical properties and cannot collide with objects.
- PlayerPersecutor - a third-person chase camera that follows a target with adjustable distance.
- PlayerSpectator - a free-fly camera without a physical body.
- PlayerActor - a player with a rigid physical body, which is approximated with a capsule and has physical properties. Can only walk on the ground.
Each player is instantiated with appropriate settings (collision, movement parameters, camera settings), and a GUI panel lets you switch between them at runtime. You can also modify camera parameters like FOV, near/far clipping planes, etc.
SDK Path: <SDK_INSTALLATION>source/nodes/players
Spline Graph#
This sample demonstrates how to create and visualize a spline graph (SplineGraph), and move an object along it using the C++ API. A SplineGraph is created at Initialization by adding points and segments using its API (addPoint(), addSegment() methods), with control points placed randomly.
- A cube mesh is created and added to the scene.
- During the Update stage, the cube moves along the spline by switching between its consecutive segments and evaluating a point on it using the calcSegment* methods.
SDK Path: <SDK_INSTALLATION>source/nodes/spline_graph
State Save Restore#
This sample demonstrates how to save and restore the state of an arbitrary Node using the saveState() and restoreState() methods. In this sample we:
- At Initialization create a Blob container for state storage and save the initial state of the referenced node.
- Enable visualizer (a semi-transparent box) at saved position for visualization.
- Save and restore the Node's state at any time by clicking the sample UI panel's Save and Restore buttons.
Use Cases:
- Game saves
- Undo/Redo systems
- Scene serialization
SDK Path: <SDK_INSTALLATION>source/nodes/state_save_restore
Buoyancy#
This sample demonstrates realistic water interaction in UNIGINE, showcasing both the current state of Global Water control via changing Beaufort levels and the use of fetching the water level at a certain point for a simplified simulation of buoyancy without engaging Physics.
Core Features:
Global Water Control. Adjust ocean conditions in real-time using the Beaufort slider (0-12). Higher values create stormier waves with enhanced foam and detail.
Optimized Buoyancy System. Simulates floating objects without full physics collisions. Uses three anchor points for stable wave-following behavior. It then smoothly adjusts the object's position and rotation to match the waves, with calculations based on:
- Object mass (customizable)
- Global buoyancy coefficient (adjustable via Buoyancy slider)
- Water surface steepness and wave height.
Use Cases:
- Marine simulations
- Weather system prototyping
- Performance-sensitive scenes with many floating objects
- Games needing stylized water interactions.
SDK Path: <SDK_INSTALLATION>source/nodes/water_buoyancy
Custom Waves#
This sample demonstrates how to control the wave spectrum of Global Water in Manual mode via API over wave parameters (octaves - a set of waves at a specific size/frequency level, count per octave, length, amplitude, phase, and steepness).
Because all wave parameters are managed on the CPU side, they can be dynamically generated, modified, or stored for reproducible results and external integration (for example, to process Weather Control packets from IOS).
SDK Path: <SDK_INSTALLATION>source/nodes/water_custom_wave
Dynamic Field Height#
The sample illustrates the effect of simulating waves on a water surface, which is created using the Field Height object.
The code generates a heightmap that is dynamically modulated over time by a sinusoidal function, resulting in an oscillating visual representation.
This approach can be useful for creating ship wake waves, water disturbances around floating objects such as buoys, and more.
SDK Path: <SDK_INSTALLATION>source/nodes/dynamic_field_height
Fetch and Intersection Water Parameters#
This sample demonstrates how various parameters influence the accuracy of fetch (sampling water height and normal) and intersection (ray-water collision detection) operations on the Global Water object across different Beaufort levels (the Beaufort slider).
You can interactively adjust the following parameters:
- Steepness Quality: Controls wave detail resolution used in sampling.
- Amplitude Threshold: Filters out minor waves to improve performance at the cost of detail.
- Precision: Controls ray-water intersection accuracy. Lower values reduce jitter when intersecting at an angle.
- Intersection Angle: Adjusts the incoming ray direction for intersection tests, helping evaluate how steep angles affect detection stability.
The UI also allows you to:
- Select between Fetch and Intersection modes
- Show or hide normals at the sampled points
- Adjust the number of samples and visual point size
This sample is useful for fine-tuning water interaction accuracy in physics, gameplay, and visual effects - especially when working with sloped or moving viewpoints (e.g., cameras, characters, or objects interacting with water).
SDK Path: <SDK_INSTALLATION>source/nodes/water_fetch_intersection
Physical Buoyancy#
This sample demonstrates how to implement physically accurate buoyancy for dynamic objects floating on Global Water. A physical body is divided into a grid of virtual volume elements, each sampled independently for water height. Based on how much of each cell is submerged, the system:
- Calculates and applies distributed buoyant forces
- Adds appropriate torque to simulate rotation
- Applies linear and angular damping depending on submerged volume.
You can also define a custom center of mass, and optionally enable debug visualization of submerged sections, force directions, and sampling points via API. Use the Global Water object across different Beaufort slider parameter to adjust wave intensity.
This approach is useful for games and simulators involving boats, ships, debris, or physics-based water interactions.
SDK Path: <SDK_INSTALLATION>source/nodes/water_physical_buoyancy
Simple Boat#
This sample demonstrates how to simulate dynamic wake foam behind a moving boat using a combination of Orthographic Decals and Particle Systems. The foam effect responds to the boat's velocity in real time:
- Decal size is adjusted based on the area covered by particles
- Particle lifetime, spawn rate, and velocity are scaled proportionally to the boat's speed.
A Beaufort slider allows control over sea state - from calm (0) to stormy (8) - to observe how foam reacts in different wave conditions. This setup is ideal for adding convincing surface wake and motion trails to ships or watercraft in real-time environments.
SDK Path: <SDK_INSTALLATION>source/nodes/water_simple_boat
World Spline Graph#
This sample demonstrates how to integrate a spline-based geometry system into a world environment. A WorldSplineGraph class instance is created and populated with data from an external *.spl file, which defines the spatial structure of the graph. Geometry is then applied to each segment using a predefined *.node file, rendered in stretching mode to ensure it conforms seamlessly to the shape and length of each spline.
This approach allows for the efficient construction of roads, pipelines, rails, and other continuous structures within the world.
SDK Path: <SDK_INSTALLATION>source/nodes/world_spline_graph
The information on this page is valid for UNIGINE 2.20 SDK.