High speed grass rendering using glsl shader

Hi!



I've been working on rendering high density grass. I use glsl shaders to create camera facing billboards with grass textures. All grass data is stored in buffers on the graphics card. The grass is divided into tiles with a large number of billboards on every tile.



Features:

  • Individual coloring of grass billboards
  • Individual size of grass billboards
  • Different textures for grass billboards, using texture atlas
  • Grass moves in wind
  • Grass is shaded when moving
  • Grass fades using dissolve
  • Grass over infinite areas
  • Grass can be lighted/shadowed using a light map
  • Interface for grass creation



    This screenshot shows the grass on a TerrainPage, the grass and terrain is shadowed by the clouds.









    Source code will be submitted in a few days.

Very nice. :slight_smile:

Though more impressive when you can see it move, I bet…

Cool, looks like another user showcase picture to me!

You know, if we coupled grass, water, bloom, etc. all together we could create a really awesome webstart demo to show off what you can do in jME…sounds like a good idea for something to show at GDC. :wink:

I

Awesome. :slight_smile:

darkfrog said:

You know, if we coupled grass, water, bloom, etc. all together we could create a really awesome webstart demo to show off what you can do in jME.....sounds like a good idea for something to show at GDC. ;)


Sounds like an excelent idea to me, might interest alot of people into jME

Great!! Bravo!!

That looks amazing :slight_smile:

Looking great. :slight_smile:



I'll list some quite interesting papers about grass rendering for you. Might want to have a look at some of them for some neat algorithms.

Something I'd like to see in your implementation is the option of rendering the grass nearby with real geometry (batched of course).



http://developer.nvidia.com/object/nature_scene.html

A Procedural Approach to Animate Interactive Natural Sceneries

http://www.cs.ubc.ca/nest/imager/tr/2002/bakay2002a/bakay.2002a.pdf

http://www.cs.ubc.ca/nest/imager/th/pdf/Bakay2003.pdf

Gaheris said:

http://developer.nvidia.com/object/nature_scene.html
http://www-evasion.inrialpes.fr/Publications/2003/GPRFC03/
http://www.cs.ubc.ca/nest/imager/tr/2002/bakay2002a/bakay.2002a.pdf
http://www.cs.ubc.ca/nest/imager/th/pdf/Bakay2003.pdf


Thanks for the tips, I've actually read 1,3,4, before creating the grass :) This method I've used is focused on rendering grass for games... The technique is based on chapter 1, "Toward photorealism in virtual botany", from the book "GPU gems 2" http://developer.nvidia.com/object/gpu_gems_2_home.html.

Awesome! I had forgotten to mention the GPU Gems articles but I see you've read most of the relevant stuff.

Looks great, can you render in wireframe mode and take a screenshot for a nice side by side comparison? Might give a better impression on how your are building the vegetation shapes (i.e. pattern of quads). How are you currently controlling what texture is pulled from the Atlas? I.e. how do you (or how do you see) controlling groupings (a group of wildflowers in one area, weeds in another, the rest grass)? I can't wait to see when you get further with trees and larger foliage. Exciting stuff, keep it up!

very nice. can't wait to see it live in action :slight_smile:



@devs: darkfrog mentioned GDC. is there any chance that jme gets there this year?

I've been told that there will be a kiosk/computer at the sun booth showing off jME.  So far all I know is that they will be showing off Bang! Howdy and perhaps one other game that uses jME.

mojomonk said:

Looks great, can you render in wireframe mode and take a screenshot for a nice side by side comparison? Might give a better impression on how your are building the vegetation shapes (i.e. pattern of quads). How are you currently controlling what texture is pulled from the Atlas? I.e. how do you (or how do you see) controlling groupings (a group of wildflowers in one area, weeds in another, the rest grass)? I can't wait to see when you get further with trees and larger foliage. Exciting stuff, keep it up!

Here is a wireframe render. The grass is split into a uniform grid, that

Oooooow, that still looks cool  :stuck_out_tongue:



Wouldn’t happen to have a version we could run ourselves would you?  Source code isn’t important (at this point  ;)) if you don’t want to share it, I’d just like to see it run.  I do get the feeling it’ll crawl to 0fps on my system though  :’(

It looks very nice.



You can lower the vertics count by using triangle instead of quads. Scale up the triangles and the texture coords down to 1/4.

Perhaps that brings few more FPS.



I wait strained for a public demo.

I think you could really optimize this by increasing the width of the quads the farther out you go, there by decreasing poly count and math related to skinning etc… have to tile the grass tex on the wide quads of course.



I used to have a OpenGL fur demo, basically just using lines is a good idea too.



http://personal.inet.fi/koti/markus.ilmola/fur.htm







Ok, this method of fur/grass is new to me…

http://www.xbdev.net/directx3dx/specialX/Fur/index.php