[RELEASED] DirectX 11 Grass Shader

DirectX 11 Grass Shader

An affordable way of getting great grass to your project.

If you need the 5.0 version of the shader, you can still download it here.

High performance:
Scalable from low to high end, by generating blades of grass directly on the GPU!

Easy to use:
With a detailed text and video documentation and easy to use controls great results are a matter of minutes.

CPU Fallback:
Systems that cannot use DirectX 11 can still use the optimized CPU Fallback system.

Dynamic reaction:
Reacts dynamically to characters, vehicles, or any other game event.

Artistic control:
Use a variety of included tools to paint grass where you want it or easily create texture atlases.

Highly customizable:
From underwater scenes to alien landscapes. Useable for every art style.

With features from years of support and development:

  • Supports Unity terrain and custom meshes
  • Texture atlases
  • Various lighting modes
  • CPU fallback
  • Moving platforms
  • Advanced interaction system
  • Grass painter
  • Wind zones
  • Texture atlas creation tools
  • Detailed text documentation
  • Video tutorials

Now on the Asset Store:

Website:

Documentation:

Discord:

Supported third party assets:

  • Curved World
  • Most assets should work without explicit support. Ask here when you are in doubt.

Supported third party assets:

Frequently Asked Questions:
Can the shader be used with Unity terrain?
Yes, the package includes a preprocessor which can optimize Unity terrain for use with the shader.

Can the shader be used with other meshes?
Yes, it works perfectly with custom meshes. To use all features it will have to be UV unwrapped.

Is it possible to remove grass?
Yes, you can also use a grass painter tool to change it directly in the editor.

If you have any questions, feel free to ask!

Example Screenshots:










15 Likes

Yeeah, finally. Good job. It was me you sent a link to on reddit ( @ddutchie ). Will buy with next round of purchases. Thanks.

Thanks for the early interest! If you should have any problems or questions, just contact me!

Does it work with Oculus? (I guess it should)

A few people reported that it worked with VR, including Oculus, but I had one comment that the right eye doesn’t render correctly on Oculus. I’ll try to fix that bug, but that might be a bit tricky, as I don’t have one myself at the moment. (I’ll get mine as soon as the consumer versions are out!)

Any chance you can add terrain support for specific texture layers? Would make this asset 11/10 :smile:

In the video comments, you told you did the videos using the terrain, can you explain the process to get it working with a terrain?

I tried the texture layer support, but only partly got it to work, maybe I’ll try it again later. The problem is that that requires some serious changes to the shader, to be similar to Unitys terrain shaders. Even after that there are still the terrain LOD problems remaining, so the best way is probably to just create the terrain in an external program.

Anyway, here’s short guide how to get it to work:

  • Create a terrain object (obviously)
  • Create a Grass material (with the grass shader) and a floor material (with the standard shader or something similar)
  • Duplicate the terrain, so that both are exactly overlapping.
  • Apply the materials to the terrains, this can be done here:

I hope that helped! If you have any other questions, wishes or suggestions, feel free!

Just bought and tested but disapointed : there is no more than the simple grass, none of the screenshot’s grass is included…

Issue with the wind if you move the object (exemple : the plane is moving as a plateforme)

Could it be that you didn’t see the Grass type / Texture count tabs at the top of the material settings? I didn’t include any example materials because I thought it was obvious. I’m sorry about that. I’ll definitely include some of these in the next patch, as well as some example scenes. (I only didn’t do that from the beginning because some of the textures weren’t mine and I didn’t have any time to look into their licenses)

Yes, you are right. Using the grass on moving platforms isn’t possible because of the nature of how the wind is calculated in the shader. In short, the wind is calculated completely new every frame, it has no idea how strong it was the frame before. For the calculation it uses the position and time since the start of the program, so if you change the position, the shader doesn’t know any more how to continue the wind calculations.

I try to add a object space mode, so you can create moving platforms, and include it in the next patch, but that means that the wind will rotate and move with the platform. (I’ll try to include as many things in the patch as possible, because the submission process takes quite a bit of time, but it shouldn’t take too long)

This asset is absolutely beautiful. I’ve added it to two projects and it’s absolutely transformed one of them. Here’s a quick video of it it in action

https://www.youtube.com/watch?v=6s8XkP6XURw

Beautiful asset!

I’ve found the asset extremely easy to use, reproducing the grass in the videos should be really easy to do. That said, it’d be nice if they were included as additional examples.

3 Likes

Watching this. Would love to see a bit better integration with Unity Terrain (as horrid as it may currently be) since we use Terrain Composer to generate our terrains.

This looks exactly like my grass. Is this by chance Grid’s DX11 solution? Always curious to check out how other people do things so I’ll pick it up for that alone.

No, I’ve created it from scratch! I’ve seen a few youtube videos using similar techniques to mine, but they seemed more like tech demos or small tests.

Also if you want to check out the code, you shouldn’t have any problems with that! The full code is included, without any obfuscation or stuff like that. It’s split up in a few .cginc files, so start with the Grass.shader if you are a bit disoriented at the beginning.

Edit: I just found the paper to Grids implementation. That’s quite interesting! I’ll definitely look into it. Could have been helpful a few months ago, but maybe I can still get something out of it.

I’m thinking the same, actually, with regards to yours - I implemented Grid’s solution but I’m certain I can pull some stuff from yours to benefit. I hadn’t actually thought of just applying a material onto the terrain. That would save some cycles, though also somewhat harder to easily control the density. I would presume yours is faster because it does not involve separate rendering, and definitely easier to apply with shadows, because it’s right inside the pipeline (I use a command buffer).

Definitely a resemblance - I just run more, but thinner, blades.


Here’s a contrasting image with just your code - no lighting, obv, but simple grass, limited LOD -

Love it!

I like my look, but I’m glancing through your code and will take some lessons from it as soon as I get the time to implement it. I won’t say anything about the techniques you use directly, but I’m sure it’ll improve my performance to skip the render because Unity won’t allow me to go straight from a render => append buffer, so I have to do render => MRT for two textures (position + normals) => compute shader => append buffer.

Yeah, I’m giving away a bit of flexibility so I can use tessellation. Believe me, getting the smoothing of tessellation levels working was really annoying, but now it’s done I think it’s working really well.

Still, with a bit of playing around, you should be able to get something very similar to you scene with my shader. Just decrease the width of the grass, like I did here: http://gfycat.com/GrotesqueAromaticBeauceron

By the way, especially your third screenshot looks really nice! I love the atmosphere.

Please go ahead and use as much as you can, but please keep it to your own projects. I’m all for sharing, but the shader is already rather inexpensive as it is, so I wouldn’t want parts of it to be given away for free. The whole thing was quite a lot of work after all!

Of course! That’s what I meant. Exactly why I am not mentioning how you put everything together here. Well aware of how challenging some of these things can be, and how much work it can take… This’ll integrate fairly easily into my project (which is commercial), preserve the same look, and probably double the rendering performance of the grass. For $20? I’m happy with that. Code is well written, too.

I’m happy to hear that! I’ve been trying to keep the code as readable as possible for situations like yours.

Any web player of this in action?

Not yet, but I’ll add it in the next few days, after cleaning up the example scenes. For now you can use the trailer or this small (a bit outdated) collection to get a feeling for the shader: http://www.gfycat.com/nonakesh/dx11_grass_shader