Skip to content

Instantly share code, notes, and snippets.

Random notes/code snippets for using the Realtime Mesh Component plugin for Unreal Engine.
I could not find many working examples for this. May create a repo for this later.
///////////////////////////////////////////////////////////////////////////////////////////////
// Code for Normal and Tangent calculation to make stuff less flat since it's just a flat plane with a height map projected
FVector3f left = x > 0 ? VertexPositions[(y * TerrainGeneratorParameters.TerrainSizeVertices) + (x - 1)] : VertexPositions[i];
FVector3f right = x < TerrainGeneratorParameters.TerrainSizeVertices - 1 ? VertexPositions[(y * TerrainGeneratorParameters.TerrainSizeVertices) + (x + 1)] : VertexPositions[i];
FVector3f bottom = y > 0 ? VertexPositions[((y - 1) * TerrainGeneratorParameters.TerrainSizeVertices) + x] : VertexPositions[i];