ShaderTerrainMesh terrain engine draw road

Hello, i want to create ShaderTerrainMesh terrain with grass, wood and road.

I found how I can do this with GeoMipTerrain in panda documentation, but i don’t found for ShaderTerrainMesh.
I took the example again, but it doesn’t work.

i have this error:
AttributeError: ‘panda3d.core.ShaderTerrainMesh’ object has no attribute ‘getRoot’

at line 32

import direct.directbase.DirectStart
from pandac.PandaModules import Vec4
from pandac.PandaModules import TextureStage
from pandac.PandaModules import GeoMipTerrain
from pandac.PandaModules import AmbientLight
from panda3d.core import ShaderTerrainMesh, Shader, load_prc_file_data


# add ambient light
ambient = Vec4(0.34, 0.3, 0.3, 1)
alight = AmbientLight('alight')
alnp = render.attachNewNode(alight)

"""# Set up the GeoMipTerrain
terrain = GeoMipTerrain("genTerrain")

# Set up the ShaderTerrainMesh
terrain = ShaderTerrainMesh()
myTexture = loader.loadTexture("./textures/generatedheight.png")
terrain.target_triangle_width = 10.0
# Store the root NodePath for convenience
root = terrain.getRoot()

# Generate it.

# Step 1: alpha maps - first two
ts = TextureStage("stage-basicalpha")
root.setTexture(ts, loader.loadTexture("./textures/alpha2.jpg", "./textures/alpha4.jpg"))

# Step 2: first texture - rocks go on everything
ts = TextureStage("stage-first")
root.setTexture(ts, loader.loadTexture("./textures/rock.jpg"))
root.setTexScale(ts, 64, 64)

# Step 3: second texture grass go on alpha2
ts = TextureStage("stage-second")
ts.setCombineRgb(TextureStage.CMInterpolate, TextureStage.CSTexture, TextureStage.COSrcColor,
                                             TextureStage.CSPrevious, TextureStage.COSrcColor,
                                             TextureStage.CSLastSavedResult, TextureStage.COSrcColor)
root.setTexture(ts, loader.loadTexture("./textures/grass.jpg"))
root.setTexScale(ts, 32, 32)

## Step 5: third texture - road goes on alpha4
ts = TextureStage("stage-third")
root.setTexture(ts, loader.loadTexture("./textures/road.jpg"))
ts.setCombineRgb(TextureStage.CMInterpolate, TextureStage.CSTexture, TextureStage.COSrcColor,
                                             TextureStage.CSPrevious, TextureStage.COSrcColor,
                                             TextureStage.CSLastSavedResult, TextureStage.COSrcAlpha)

how can i make this ?
thanks for advance for your help.

The ShaderTerrainMesh class does not have a getRoot method, I believe thats a method of GeoMipTerrain.
The class behaves different from GeoMipTerrain. It does not support multitextures, but instead you will have to write your own shader for it. There is a sample showing how to use it: … er-terrain

ok but i search a solution for apply texture by heightmap,

like this for example, Is it possible to do it with a shader ?

in this example i want to apply water texture in black color

Because i generated my terrain with noise perlin