Help for add 3d grass in HeightfieldTesselator or GeoMipTerrain?

Hello i have question, how create 3D grass in panda3d for HeightfieldTesselator or GeoMipTerrain ?
is there an example code?
how to be efficient (you have to add and remove grass dynamically, with a lod)

for example i search to add 3D to roadming ralph sample, grass
the grass must be visible near ralph and disappear if it is far away

Maybe it’s possible, i view this video example :

but i don’t found source code with 3d grass and tree, i installed thi program and run sampler but i have only terrain without grass or tree.

i run roaming ralph too and i have not water :

why ? it’s bug ?


Where is the full version of the program instead of this poor version? Is there anything else to download?
drophbox source code not exist i have 404 error

thanks tobspr for your answer, but i don’t found vegetation sample in new version,
Where is sample located?

does panda3d have an example 3d grass/tree code in terrain (with lod) ?

This article might help explain the basic technique for rendering grass on terrain:
https://developer.nvidia.com/gpugems/GPUGems/gpugems_ch07.html

To place it on the terrain, you will have to sample the heightmap at the grass’ position to determine the right height to place it at.

1 Like

I’m looking solution with heigmap technicle
I want add 3d grass with “grassmap”, when it’s black i add 3d grass and when is white i add none.
I can do it in panda3d with 2d textures in glsl, but i don’t for 3d object

like this :
hmap = loader.loadTexture(“Data/Terrain/” + layout + “/heightmap.png”)
hmap.set_wrap_u(Texture.WM_clamp)
hmap.set_wrap_v(Texture.WM_clamp)
hmap.set_format(Texture.F_r16)
node.set_shader_input(“heightmap”, hmap)
nodeShadow.set_shader_input(“heightmap”, hmap)

fmap = loader.loadTexture("Data/Terrain/" + layout + "/flowmap.png")
fmap.set_wrap_u(Texture.WMClamp)
fmap.set_wrap_v(Texture.WMClamp)
node.set_shader_input("flowmap", fmap)

for material in ['rock', 'grass', 'gravel', 'snow', 'moss']:
    for i in xrange(2):
        tex = loader.loadTexture("Data/Terrain/Materials/" + material + "_" + str(i+1) + ".png")
        tex.set_wrap_u(Texture.WM_repeat)
        tex.set_wrap_v(Texture.WM_repeat)
        tex.set_format(Texture.F_srgb_alpha)
        tex.set_minfilter(Texture.FT_linear_mipmap_linear)
        tex.set_magfilter(Texture.FT_linear)
        tex.set_anisotropic_degree(16)
        node.set_shader_input(material + ("Diffuse" if i == 0 else "Normal"), tex) 

i want same technical with hmap but i want to add 3d grass and 3d tree for example, it’s possible ?