API reference
API reference
Select your platform
No SDKs available
No versions available

AMRUKDistanceMapGenerator Class

Extends AActor
Generates a distance map that can be used in materials to calculate the distance to various objects. This can enable interesting effects. With the distance map you can get the distance from scene objects or walls in a material shader.
The Jump Flood Algorithm is used to generate the distance map. This is fast enough to regenerate every tick.
To capture a distance map after a room has been loaded call CaptureDistanceMap(). It will return a captured distance map. In case you already called CaptureDistanceMap() you can receive the last captured distance map with GetDistanceMap(). No other setup is required.
This class will create procedural meshes for every anchor to create a mask. These meshes have their visibility set to scene capture only. That however means that if you place a scene capture component yourself that the meshes will show up in your scene capture component. The actors that have the procedural meshes attached are tagged with GMRUK_DISTANCE_MAP_ACTOR_TAG. In case you don't want them to show up in your scene capture you can hide them by receiving all these actors with the tag GMRUK_DISTANCE_MAP_ACTOR_TAG and add these to the scene captures hidden actors.

Fields

FOnReady OnReady[Get]
The mode in which the final distance map should be generated.
class USceneComponent * Root[Get]
class USceneCaptureComponent2D * SceneCapture2D[Get]
EMRUKSpawnMode SpawnMode[Get]
First render target for jump flood algorithm.
Second render target for jump flood algorithm.
Render target for the final distance map
Material to render a mask that gets used to calculate the distance map.
Material that executes a pass of the jump flood algorithm.
Material to render final distance map
class UMaterialInterface * DistanceMapOccupiedSpaceMaterial[Get]
class UMaterialInterface * DistanceMapAllSpaceMaterial[Get]

Member Functions

DECLARE_DYNAMIC_MULTICAST_DELEGATE
( FOnReady )
Capture the distance map.
Returns
The captured distance map.
Create mask meshes for the given room. These mask meshes are needed for the distance map to be rendered. It should only be called once before CaptureDistanceMap in case the SpawnMode has been set to None. The operation that this function executes is expensive. It only needs to be called after the room has been created or updated.
Parameters
Room
The room for which the masked meshes should be created.
Remove mask meshes for the given room. This function should only be executed when SpawnMode is set to None. It only needs to be called after a room has been removed.
Parameters
Room
The room for which the masked meshes should be removed.
Return the captured distance map. Be sure to call CaptureDistanceMap() before
Returns
The captured distance map.
UCanvasRenderTarget2D * GetDistanceMapRenderTarget ( )
Retrieve the view info from the scene capture. This is useful for re projection of the distance map in a material.
Returns
The view info.
AMRUKDistanceMapGenerator ( )

Protected Functions

void BeginPlay ( )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon