Dynamic Heightmap

So I am going to create a dynamic heightmap for my project, originaly I went for voxels, but realized it was more data then I actually need and I didn’t want to mess around to much with mesh generation, so I decided to stick with a ordinary terrain heightmap. That being said, I soon realized that there are no dynamic heightmap in unreal engine by default. So that put me on the track of creating my own. (going back to mesh generation… )

I did previously look at the Procedural mesh and it’s implementation, but it seems more to a be an easy layer ontop of a layer of the actuall mesh data. There was also talk about this resulting of three instances of the data being keept, one for each level or layer of inheritance, and also the mesh data seemed to be static in nature, requiring recreation of the data for modifications.

Knowing from previous 3d projects a terrain height map is not “all that” to put together, as long as you have access to a low level vertex and index buffer. Making it dynamic in turn requires you to specify the vertex data as read write, and thus you have references to the data in code, besides it just living on the cpu and allow editing.

Another process, is that the data in question is handled by a shader/material and that shader/material in turn is feed data from the code, and makes a vertex offset on a flat plane.

For now I am aiming on modification on the cpu side with dynamic vertex data.

For this to work I want my heightmap to work like any other mesh applied to an actor, that means it either need to either extend the static mesh (feels wrong since it is by defenition static) or create a new dynamic mesh ( dynamic mesh component, dynamic mesh actor) that have the same behaviour as a ordinary mesh.

It feels like my mesh will have most in common with the static mesh actor, but I assume I will need to look at the skeletal mesh actor. To make things easier I am checking out the current engine source to dig into the implementation of the static mesh actor and see what I can change to make it dynamic.

The core idea is to provide a component where the user specify width,depth and scale per axis for a plane, then can access or modify those points as they see fit.

Anyone worked on something similar?

You could look at the Bouyancy system that ‘Handkor’ created:

The actors in the scene ‘read’ from a procedurally generated height-map (which is also used in the shader for WPO) and use that to offset their world location. Not quite what you’re looking for, but might be a good head-start.