Change in realtime hightmap of terrain

Hello i have question, it’s possible to change in real time (in game) a heightmap of terrain

i generate 3D terrain in panda3d like this :

from panda3d.core import ShaderTerrainMesh, Shader, load_prc_file_data
load_prc_file_data("", "gl-coordinate-system default")
terrain_node = ShaderTerrainMesh()
terrain_node.heightfield_filename = "heightfield.png"
terrain_node.target_triangle_width = 10.0
terrain_np = render.attach_new_node(terrain_node)
terrain_np.set_scale(1024, 1024, 60)
terrain_np.set_shader(Shader.load(Shader.SL_GLSL, "terrain.vert", "terrain.frag")) 

I would like to add a crater/hole or a mountain in specific coordinate (in 0:0 or center of my terrain for example)
I can make this in panda3d in python ?

Two things come to mind, in particular:

You could use a compute shader in order to modify the texture on the GPU. This will be most efficient, but will require somewhat recent graphics hardware and knowledge of shaders.

Alternatively, you can load the texture into a PNMImage, and modify it on the CPU for example using the PNMPainter class in order to “paint” a crater onto the heightmap, and then using Texture.load in order to refresh the texture contents based on what is in the PNMImage.

ok but I’m not talking about changing the texture but the height of the terrain
for apply texture, i thing use TextureStage

Yes, but the heightmap of the terrain is also a texture in itself. So painting a white-ish dot on the heightmap would raise the terrain at that position.

ok, i modify heightmap texture (black and with image) and i reload texture and i regenerate heightmap

Sounds about right. With ShaderTerrainMesh, reloading the texture should be sufficient, since the geometry is deformed on the GPU; the terrain geometry does not need to be regenerated.

I proposed ShaderTerrainMesh but it may be simpler / more powerful with GeomipTerrain?
What do you think? for geomip terrain it also go through the shaders?

ShaderTerrainMesh is more modern, powerful and efficient, since it is done on the GPU. With GeoMipTerrain, the geometry needs to be regenerated and reuploaded every time the heightfield is modified, which is slower.

However, with ShaderTerrainMesh you do need a shader, so if you don’t know shaders you may consider it more difficult to use. But it is likely that with either approach you would end up needing to use some type of shader at some point anyway, since that provides greatest flexibility over how you want to do the texturing.

ok, thanks for your answer