Materials for Location and Color

 

 

Those Materials are special

Materials which are used in a PCD / PCA to calculate locations or colors are different. They are not about rendering geometry, instead pure data operations running on the GPU. The Difference to a normal Material is that they are rendered by a function called UKismetRenderingLibrary::DrawMaterialToRenderTarget. They don’t need a camera nor viewport setup. The drawback is that some of the nodes for transforming a location into another space will not work, as well as all the view and object related locations, because there is no view or object they are connected to. The advantage is that it is fast and can be executed on demand (in a separate rendering pass).

Independent of the import mode (by Blueprint, File, Cube, Material, Mesh) all the data will end up into two RenderTargets: A floating point (RTF_RGBA16f or RTF_RGBA32f) for the Locations and a LinearColor one for all the Colors.

 

Within the PCD / PCA Data Assets are arrays for user parameters, which will be passed into the Materials. Parameters with a [D] can be changed on runtime (no “Update Data” needed) with a Blueprint function (SetVector, SetScalar, look at Blueprint Interface). Note that this will not change the values in the Data Asset, only cached copies on the PointCloudSystemComponent itself.

 

A Material used in a PCD / PCA should have the BlendMode Opaque or AlphaComposite (in the case you want to have values in the alpha channel. Note that the alpha value will be clamped to 1.0 - 0.0 and needs to be passed as 1-x in that blendmode). On the Material properties under advanced options enable “Allow Negative Emissive Color” to be able to have negative locations. Best practice is to copy one of the Materials in “PointCloudKit Content / Examples / Materials / AnimatePointCloud”.

 

Locations are always in Local Space of the Point Cloud. With the Enum property LocationFromWS on the Vector parameter (in the PCD / PCA DataAsset) you can auto transform the Vector or Point from World Space into Local Space before passing it to the Material, or leave it unchanged.

 

Standard Parameters

Besides the user defined values, there are some standard parameters which will always be passed into the Material as the core interface. Within the Material MAT_ZeroAnimation in “Examples / Materials / AnimatePointCloud” you can take a look at all standard parameters.

 

 

 

  • DeltaTimeAnimation (float) : Current Delta Time for the animation updates.
  • RT size X (float) : Render Target X resolution.
  • RT size Y (float) : Render Target Y resolution.
  • InitTick (float) : On first Update 1 otherwise 0.
  • Locations (texture) : Current Point Location, based on current UV.
  • InitLocations (texture) : Initial Point Locations on creation.
  • LastLocation (texture) : Point Locations of the last update.
  • Colors (texture) : Current Color of the Point, based on current UV.
  • InitColors (texture) : Initial Colors of the current Point.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Material Functions

In “PointCloudKit Content / Examples / Materials / MaterialFunctions” is a collection of very useful MaterialFunctions for this kind of Materials.