View Full Version : Realistic Mowed Grass - ideas?
07-06-2010, 04:16 AM
Okay, so I tried this in grit game engine and it was very, very, very slow:
(it really did look cool in motion, sitting still, not so much, also, we don't own that car, it's from some free model site our coder used it to draft some baby car classes, oh, and the corner of the pavement is rockstar's :x, no, we don't snatch, i just had it sitting around and didn't have any ref for sidewalks at the time, think: placeholder, also, batches are high because our text is 3d)
It is the old school shell/fur technique as seen in shadow of the colossus etc. Apparently, this is left behind since dx8 and it kills the fill rate very fast. Translation: cannot use. I want to have realistic, coverage style grass in our game engine, beyond flat-planes for ground with only the little tuft here and there. I want realistic grass so bad, it really holds me back to know that whatever I make has the potential to be really ugly flat planes, and if they did it on PS2 with animate colosi, how come I can't do it on my GTS 250? No matter, it looks like ass on hills etc and totally breaks smooth shading anyway. Anyone have experience working with realistic grass coverage??
07-06-2010, 06:40 AM
I don't know the math behind shader stuff, so I can only give advice based on the visuals I've seen. I have seen a grass shader that created the effect of actual standing dense grass, but it only worked at oblique angles. If you looked at a shallow angle, you could see it was just flat geometry - much like the effect of a parallax map. But combined with some standard cross planes, it can be very believable. I have no clue how that's done though, so I guess it's not much help :P
07-06-2010, 06:44 AM
well, it's a start: shader based does sound like the most sense from a lot of papers I've been looking at (i've been looking for alternative geometry to crossing planes) Thanks for the start, let's hope for more :D
07-06-2010, 07:06 AM
Using an alphatest (1bit) alpha would probably be a good place to start in optimising it. I can't be sure but it looks like you've got 8-bit alpha there which is really expensive.
Use some code that'll only draw it out a certain distance from the camera (no point in having it render all those planes all the way to the horizon when you won't be able to tell it's there after a few metres).
Some generated distance-from-camera limited scrubs using alpha planes would help the look, too.
Changing the UVs of each successive plane veeery slightly will also help the look, as it'll give the grass blades some direction, rather than all sticking uniformly upwards.
07-06-2010, 08:03 AM
Might help to d/l Trackmania to take a close look.
They also had tire tracks IIRC
07-06-2010, 11:08 AM
I didn't think about changing the UVs as a workaround to scaling the layers - good tip, outside of the box! I think it would still look bad when approaching hills, however.
As for trackmania, a close look at what? :P Is that all crosses? The grass looks cool, but it is entirely too long, will the method there break on short *realistic length* grass?
To illustrate, here is a hotlinked image xD
the one on the left reminds me of the trackmania grass, I desperately want grass like that on the right.
07-06-2010, 11:11 AM
Take a look through the tech what you working on thread. I know someone was working on grass/ had really nice grass demo.
Can the engine do parallax mapping? Might work well enough for short grass.
07-06-2010, 09:37 PM
We don't have parallax yet as our coder says it's pretty slow and we will probably only use that on bullet holes or collision marks on walls (like GTA/RAGE engine) to be honest. For short grass it could look good though.
I was looking through the what are you working on topic, I mailed the guy (or girl) about the grass, but then a friend told me he thinks it's 2D, sigh :P
07-06-2010, 10:22 PM
If you look at that trackmania shot it looks like the grass is fading out like 10 feet behind the car. You should definitely only draw it really close to the camera and use alpha test instead of alpha blend. use different images, or scale the alpha cutoff value with each plane so its not the same thing over and over which looks like motion blur.
Do something like this (http://wiki.polycount.com/Hair%20Techniques?action=AttachFile&do=view&target=jfalconer_fur_examples.jpg).
07-06-2010, 10:47 PM
Keen, that's the technique those 5 minute test models in the first post uses.
It is indeed an 8bit alpha like mentioned earlier though. I was having problems with dxt1 (actually, it turned out the viewer I was using was broken) so I never even got to try with 1 bit.
Is the shell method worth looking more into for sure? Will 1 bit be that much faster that the method is no longer considered "expensive" (at least sided to the 8 bit in comparison?) If you could only see it a short distance anyway, do you guys think I could do like 10 layers in 2010? :P
Thanks so much for your help so far everyone, really want to make some stunning visuals and get our old stuff down and replaced with new soon at the site :P
Also @Keen, I was at your site recently! I thought you were a unity team dev, sorry for my comment asking things that had nothing to do with protools :P
07-07-2010, 12:54 AM
also related to the topic would be this whitepaper from last years siggraph.
actually stuff like grass rendering should not be artists job, other than making the textures ;)
the shell-fur stuff can be done in code efficiently as well, (especially the shells) and the coders can experiment with the number of shells with a single number variable...
07-07-2010, 07:07 AM
Great read, CB. Thanks for the linkage.
07-07-2010, 07:53 AM
try doing a variation on this: http://www.peterguthrie.net/blog/2009/03/vray-grass-tutorial-part-1/
07-07-2010, 06:53 PM
just saw this:
Its the same technique that has been discussed here but more optimized. He doesnt say anything about how he is doing it besides that its the "shell" technique though.
07-07-2010, 10:25 PM
And I just did a test of this in Unity:
Web Player (http://www.keenleveldesign.com/pimp/protools/grass/shellgrass_04.html)
It requires SM3 and will probably run very slow unless your GPU was made within the last year. There are 40 shells with a rather expensive shader. I get 400 fps on a 8 month old card.
EDIT: Web player is now half quality with 20 shells.
EDIT2: Optimized it even more. Should be about 2.5 times faster than the last one.
07-08-2010, 01:47 AM
so now the big question, how do i do it :P lol the shader is doing it, yea? that's why it doesn't clip ugly like mine? Mine is only like 5 or so layers anyway, that looks ideal, i would do it even shorter, bit more dense, and not move it as much if I could do it.
I only have the indie unity, waiting to see if they actually limit it on shadows with deferred shading in 3, if so, i wont continue with it. Want that in grit big time! Any tips I can pass to our programmer? is this universal type stuff?
07-08-2010, 02:05 AM
now just add some dynamic uv scaling around objects for grass distrurbance and your peachy ;-)
07-08-2010, 03:34 AM
Keen that's beautiful.
07-08-2010, 04:17 AM
very nice execution, would love to see a interactive demo where you can at least pan or move the camera around. I assume the shadows are baked on the grass using your Light mapping code?
07-08-2010, 11:40 AM
mortalhuman, its the same thing your doing except a more advanced shader and more shells. heres a list of features in the shader:
-Tiling "grass blade" texture used for alpha. tiling it more makes more grass blades.
-Grass color texture that gives it color variation. its uv scaling is not the same as the grass blade texture.
-Each shell has a lower vertex color value than the last, this is used for slightly tapering the grass blades at the top, faked shadow at the base of the grass blades, and how much the grass bends with the wind.
-A scrolling "wind texture" is used to distort the uvs of the grass blades and the grass color textures.
-It uses the lightmap from the underlying terrain mesh.
The shader was created with my shader editor so the the entire scene did not require any programming at all, although the shader is not as optimized as it should be.
07-08-2010, 02:19 PM
Hey keen could you make some blue sky's and rolling hills with a single tree on a hill that the camera rotates around with that grass? I'd watch that for hours. Hell id want that to be my background!
Holy crap keen that is awesome :O.
07-08-2010, 03:14 PM
Yeah, that's really nice, I would also love to see a webdemo
07-08-2010, 03:46 PM
Looks awesome. would there be any way to add say a low/mid/high shells mask so you could vary the height of the grass with a bitmap.
jocose: the webdemo is linked in keens post.
07-08-2010, 04:06 PM
r_fletch_r, yeah I was thinking of that. Im actually thinking of making and optimized shader and a unity tool for painting fur/grass on any object.
07-08-2010, 04:48 PM
oops didn't see the link, demo looks great.
07-09-2010, 12:53 AM
That is so awesome and well thought out. Do want for Cg in Grit lol.
07-10-2010, 01:40 AM
Keen has broken it down well for you. I am an artist who is pretty confident I could make this myself. If Keen and I are Artists with a technical flair for shaders who could do this, than any professional programmer worth a damn should be able to help you achieve the same. Show them this thread, and Keen's description, and you should be good to go.
@Keen; stop being lazy and post this shit on your blog! I'm sure I'm not the only one waiting for updates, ;)
07-10-2010, 08:20 AM
As sexy as it is, the "fur" effect is pretty expensive, even in a pixel shader.
Coupled with some regular billboards and such, this can be a pretty convincing effect, while being cheaper than the fur:
the source documentation (and link to shader): http://www.cg.tuwien.ac.at/research/publications/2007/Habel_2007_IAG/#Additional Files and Images
Just bear in mind this won't work at perpendicular angles to the ground plane. Once you go to about 40º or so, the billboards become very apparent. But it still looks convincing overall.
07-10-2010, 10:11 AM
I wonder if a different noise function displacing the uvs would improve the effect, the motion on keens and that youtube video really break the effect for me.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.