Volume grass system

Hi,

I’m just finishing comprehensive volumetric grass system (sounds nice, doesn’t it ?). Consists of editor tool for making mesh model, volumetric (raytracing) shader and a few additional things to make workflow possibly easy. Could somebody tell me if this works on Mac, I’ve got no machine to test it. It’s a bit twisted shader with lot of conditionals (so tex2Dlod was necessary - #pragma glsl compiling) and I want to make sure it works on OpenGL systems.

Whole system is for using with Unity3. Shader is SM3.0 and rather fast GPU is needed. Shader is greately configurable, so potential user can find right balance of quality vs. speed. On my nVidia GT240 the demo below works cool, on ATI 4670 - quite decent.

quick screenshot:

webplayer (I don’t know why depth testing is screwed here, but’ll find it out later):
http://www.stobierski.pl/unity/grass_scene.html

standalone (PC, ztest works like it should do + you may test it under different settings/resolutions):
http://www.stobierski.pl/unity/grass_scene.zip

Grass is able to precise intersect other objects (look at the bottom of tree - I mixed terrain grass with mine or at grass mesh borders from both sides).

As you navigate with SHIFT you’ll probably notice that shader is “motion blur” ready (camera script is a part of system). Well, maybe not “real” motion blur (only linear smearing, without curves), but something that looks good enough to use and it’s almost “free of charge” in terms of GPU hit. I did it especialy for usage in my racing game project (to make good looking offroads at last).

Feedback greatly welcome as I want to give it a chance at AssetStore :).

Tom

P.S. Basic idea has been taken from Ralf Habel docs:

http://www.cg.tuwien.ac.at/research/publications/2007/Habel_2007_IAG/

but was rebuild and enhanced to solve some problems (for example border problem, enlarging angle of view, correct z-test as Unity shaders can’t write into z-buffer, handling mesh and shader LOD against distance, etc).

tried the webplayer on my mac but crashed browser on start up every time…

I get 20fps average on a MacbookPro Leopard GeForce 8600M GT
70fps on Windows 7 GeForce GTX 260M

Visually it looks the same as on Windows 7 Mac.

The ‘motion blur’ doesn’t look good when walking around, but I can see how it would work well for a racing game.

I just played BlackOps multiplayer for the first time today since I thought they were using this technique on the Nuketown level, sadly they were just using billboards:
http://img341.imageshack.us/img341/2590/shot0003ea.jpg
Funny coincidence that right after that I saw your post.

Your example is really impressive, looking forward to seeing it in the asset store (hopefully with ability to tweak toggle things like the motion blur, textures, wind, depth?)

Same here, both Safari and Firefox. How about a standalone build?

–Eric

Works well, though panning/sidestepping results in some nasty effects, it flattens out the texture somehow. Dollying works well though.

Would be even better with some crafty texturing to give a fake self shadowing look.

Works fire for me! I am on mac.

I am just using safari… Sadly though I only got 6 frames per second… :frowning:

Looks good!

so will it be free ?
because at the source you have it from it says that the shader is only for personal or classroom use.

Nice, worked great, I get approx 62 fps on my hd 5770. One thing- you need screen.LockCursor :P.

Looks really nice on “fantastic” setting and runs at 70 fps effortlessly on my hd5750, quad q9550s, 4gb ram ddr2.
The browser version makes my google chrome crash though.

If affordable it would be the first asset store purchase i’d do for my project :slight_smile:

The webplayer runs but the grass doesn’t work at all on my Mac (Macbook Pro, x1600 graphics, OS X 10.6.6) but works nicely at 60+ fps on my PC (i5, GTS360M, Win7). The effect is very convincing, easily the nicest grass I’ve seen. Hopefully the issue with Mac playback can be resolved so everyone can use this.

Scene freezes instantly. Mac OS 10.6.6, Chrome/Rockmelt.

I don’t know if it’s a wanted effect but the fact that grass bends to different directions while moving but it looks really bad to me, and I don’t talk about the “motion blur effect”.
You should cut it off because it totally disrupts the 3d effect of the grass and makes it almost useless if you move.

Apart this, if you refine it, it’s something I was waiting since long time and I have 60 fps on my i5/HD5770.

Thanks everybody for replies, to make quick response:

@MrBodean - which configuration do you have ? (OS version, GPU model)

@Proton - sadly low 20fps on 8600M, but the shader is inteded to be used for new games, not necesarilly web casual, and yes - you’ll be able to disable easily every effect (shader is simply configurable by #defines section) and adjust ray penetration depth (now it’s set on 8 planes hits max, while 5 works not that bad while looking at grass from middle angle of view). + you can make grass textures smaller (now its 1024x1024 + 512x512 for noise). Full discussion about tweaking performance a user will find in shader. So, you can even detect user system and make 2-3 version of shader to use on different systems.

@Eric5h5 - I put standalone zip for PC. Here is standalone Mac version too (however I can’t check it):
http://www.stobierski.pl/unity/grass_scene_mac.zip

@Per - “motion blur” can be disabled (a few GPU ticks saved) as it’s unnecessary for FPS like games, I made it for racing game where camera is running almost linearily following vehicle. Effect can be also tweaked as I’ve decided not to close anything into dlls or stuff like this, so user will be able to mess around (and adjust blur effect for his needs). Self shadowing - well, hard to achieve as this shader is expensive enough by now. I’m thinking about it, but what’s sure it will cost at least another tex lookup(s) + more ALUs per ray tracing iteration step inside fragment program.

@Daimon - I only pointed out the underlying idea and what was the original inspiration. I didn’t just put Ralf’s HLSL shader into shaderlab (it would be impossible for depth testing issue anyway). My rendering pipeline is different (must say - heavily optimized, so inside loop I trace one ray incrementally only, not 2/3 rays like in original HLSL version). Furthermore - to be sure if I can use it I contacted Mr. Habel and he has nothing against :). He’s paid as a university researcher, so publicly presented ideas are not subject for such restrictions. Restrictions are only set on copying original materials (Habel’s pdf paper) to publish it elsewhere.

@bigkahuna - It seems that shader need to have new GPU model for Mac (not only SM3.0 maybe, but some profile requirements have to be met). But maybe it’s only webplayer issue - look at mac standalone posted above for Eric5h5

Webplayer crashes may be due to webplayer error I’ve got on my PC (it does not render depth buffer for ztesting grass against intersecting objects). I’ll inspect it and release next version in a few days. I think maybe I’ll need some help from Unity staff (Aras or another magician like him) to make it work on more machines.

Well, everybody is knocking down my “motion blur” wording :slight_smile: OK, as I said it is NOT motion blur effect at all. It’s only motion blur LIKE effect when we move really fast linearily. It’s indeed exagerrated when walking or oribting camera fast (it should be off then), but this is only the idea what user can do with this. To not confuse anybody I’ll probably cut this off completely from package release (but I’ll use it for sure in my game).

Well, I don’t know if you have a different effect, but it looks often weird.
If you run pressing SHIFT then ok, the effect is so exaggerated that it looks ok.
But if you walk (but in your webplayer it’s like a run) the effect is weird and bends grass more in the far than in the near making it a totally wrong effect and it really looks like a bug.
So, better no effect than a buggy one.
More on that, it flattens all the nice render when you move. If I want a flat ground then I fall back to a flat terrain eheh.

Very nice, does take a lot of power if you wanted to implement in an actual game, but its great… Also you might wanna fix the edge of the grass, when i ran outside of the grass zone, the grass ended with a fine line and didn’t seem quite realistic.

Not bad. 140FPS, with Post Processing on.

well I tried the mac stand alone and it crashed on me as well

I have an iMac running lepoard 10.6.6 2.4 Intetl Duo Core with 4 GB ram.

Hope that helps…

Running from the shell, the standalone says “Abort trap”, and the most relevant bit from the crash log seems to be:

Exception Type:  EXC_BAD_ACCESS (SIGABRT)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000094
Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread

I guess it really doesn’t like that shader. :wink:

–Eric

Runs amazing in both web and standalong on GTX 480. I have to say, this effect is just spectacular. If you could, I would love it if you could post links to all the source components of the shader (diffuse, noise, or any other relevant data). I’m curious as an artist as to what other ‘deep’ materials this could be useful for.

Could this be used to make an equally convincing field of wheat? What about something with a larger granularity, like a ball pit ( http://imgs.xkcd.com/blag/ballpen/all.jpg )? Do you intend to release this in any capacity in the near future? I would love to play with this/try to break it, and use less photo-real sources to see what the effect would be. If you’re looking for an intensive beta tester I’d be happy to put it through a battery of visual tests and share them with you/the community. PM me if you’re willing to share. :slight_smile: