GeoClip Grass

A while ago, I mentioned geo clip-mapped grass. Today I implemented it on my geoClipMapped terrain.

Play with it online here:
Source at
More images:

This is just the basic implementation. No wind or LOD, though this setup should handle all of those pretty well. This is mainly a proof of concept. Look, lots of grass, and its not super slow. So much grass in fact that you can’t see the black and red ground through it from lowish view angles!

All the grass is one geom, all placement is done on the GPU with a vertex shader. Uses the same tile based geoclip stuff as the height map based ground: Textures generated as needed on the GPU. Still some precision and graphical bugs when re-rendering tiles. Now the grass is actually a few geoms in one node to improve culling.

Grass texture by xsinick+Tristan.

very nice. a bit full of glitches but very nice.
if i press X it crashes the web-plugin for some reason,tho.

looks great…

It seems that my card can’t handle this awesomeness :slight_smile:

I have an ATI HD 5730 graphics card which has never given me any problems before…any suggestions?

Try out this new version. Run from the terminal/command prompt and post what ever errors show up (there will be a few to ignore that always show, but there should be something useful. Looks like the shader compile failed)

Demo improved! You can now walk up the terrain, defaults to first person view. FPS is high! (150+ for me). New one has lighting too, but its quite wrong (backs of grass lights with inverted normals)

My fault. Fixed “x” in the new one (along with many other things)

Here it is, but not knowing much about shaders I can’t interpret much…

saved buffer (513, 513)
:gobj(error): Cg program too complex for driver: /c/Users/dug/Desktop/Craig-Maco
4/geoClip.sha. Try choosing a different profile.
:gobj(error): Cg program too complex for driver: /c/Users/dug/Desktop/Craig-Maco
4/geoClipGrass.sha. Try choosing a different profile.
saved buffer (512, 512)
Tile Level: 6
Tile Level: 5
Tile Level: 4
Tile Level: 3
Tile Level: 2
Tile Level: 1
Tile Level: 0

Panda sure lines crazy excessive file paths. Seriously, whats with the “/c/Users/dug/Desktop/Craig-Macomber-Panda3D-Terrain-System0dad404/Craig-Macomber-Panda3D-Terrain-System-0dad40” file path?

Anyway, its simply refusing to compile the shaders. I suspect its because I’m sampling textures in the vertex shader (requires non basic shaders). I do have basic-shaders-only #f, so panda thinks your drivers are insufficient. As far as I can tell, that card has features way beyond mine, but its an ATI, which I guess could mess something up. Seems like a panda, cg or driver bug.

I did manage to get it to look better…there are now distinct lines seperating the LOD levels (filled in with black) with the closest LOD having a grid of evenly spaced squares roughly grass colored.

That filepath is simply me downloading the auto generated zip file of the source to my desktop and running it from there, just laziness on my part :slight_smile:

Also, I realized that after the program exits I get about 10 identical errors:
:display:gsg:glgsg(error): c:\panda3d-1.7.0\panda\src\glstuff\glGraphicsBuffer_src.cxx, line 989: GL error 1282

which is interesting because panda is not even installed on the c drive but the d drive…this is windows7 64 by the way. (d:\Programming\Panda3D)

Updated again. Now the grass has variable height and terrain height sampling is smooth (so walking isn’t jittery on slopes). Still tons to do, but I think I have enough basic stuff working that its time to clean up the engine again, and integrate with my shader generator to doing custom graphical effects.

Screens look nice, but it runs at 0.5 FPS on my machine :confused:

I know it’s not top end (rather dog end - 1,6GHz, 1GB RAM, GF6200) but 0.5 fps is a bit slow just for grass (InfinateRalph.p3d runs at 17-40fps)

I think the difference is my card (9600m GT) has 32 vertex shaders I think, and yours has 3. Your card is actually the very first that has the features needed to run this project at all as far as I can tell. It makes extremely heavy use of vertex shaders with texture sampling which is somewhat new. Once I’ve done some more work on it, the terrain mesh resolution will be adjustable without breaking stuff, so it will be able to run faster on such a card, though other rendering approaches are far better suited for older cards. (The basic tile based render is still in there, just not in use). Its not the grass thats killing it, its the geoClipmap renderer’s vertex shader (the grass uses it too though).

On the bright side, this rendering setup uses almost no CPU at all, and after a few fixes, will use almost no memory either. It leaves lots of capacity for game logic :slight_smile:. I guess as long as I’m working in python, making the graphics card do all the heavy lifting seems better, though doing some gfx coding is C++ is probably the right approach.

Depending on the exact model a GF6200 is effectively 10 years old tech in terms of computational power. It is a crippled cheap chip (compared to the rest of the GF6 family) so you can’t really expect it to perform well with anything modern :confused:

I think the main issue is that it does not have unified shaders, so the fact that my use of shaders is far from standard (heavy vertex shader load) means most of what little power there is goes unused.

It does not work.

DirectStart: Starting the game.
Known pipe types:
(all display modules loaded.)
setting up water plane at z=0.01
saved buffer (256, 256)
:display:gsg:glgsg(error): Could not load Cg fragment program: created-shader (glslf The program could not load.)
:display:gsg:glgsg(error): Could not load Cg fragment program: created-shader (glslf The program could not load.)
Tile Level: 4