Creating terrain on a 3D object


I am trying to apply a heightmap on a 3D object. I can’t figure out how to do it.
I have found this example on how to do a 2D terrain, but have no idea how to modify it to a 3D.
My end goal is to make a cube with a bulge moving on the surface of the cube following a cursor, but for now I need help with at least applying of the heightmap.

The example you linked generates 3d terrain? Not sure why you say it’s 2D?

We have this engine example as well which is similar to what you described, but it’s the same principle as the example, just does it every frame: PlayCanvas Examples

Ah I see … you want to modify a cube instead of a plane. Well, the code should work the same, but you need to work on each side of the cube separately. The cube is just 6 sides.

Thanks. But how do I access every side of the cube separately? Or what do I do if I want to do it for a sphere instead of the cube?

One options would be to use displacement, which is in the works, but not finalized yet:

I don’t think there is out of the box solution for what you need … you could create a custom shader to implement displacement, or do some form of displacement on the CPU and construct a mesh from this as the other example I linked.