I think lightmapping can be tricky. I’d recommend to not actually include the grass meshes into the bake. Given the large amount of small meshes, it would either take a lot of lightmaps or at a very high resolution to include them.
I tried it out in the demo scene, and what I’m doing here is baking the scene, with the Directional Light set to “Baked”. Letting it finish, then render the color map. As a result, the grass takes on the baked color of the terrain (so including the cube shadow)
An issue wil arise when setting the directional light to “Mixed”, since the grass will be colored by a (fake) lightmap, but directional light is added on top of it.
The terrain has a lightmap, so isn’t affected. Essentially at this point the color map acts an unofficial lightmap, but the grass isn’t treated as a baked mesh.
That is tough one, since it’s not possible to mark a mesh as “baked” even though it isn’t part of a lightmap. This only happens when including it in a bake by settings the “Contribute GI” flag. But including the grass in a lightbake is going to be problematic.
A viable workaround is to assign the LOD meshes in the grass prefab to a specific layer, then set the Directional Light to ignore that layer in its culling mask. This way is can be set to Realtime/Mixed and still maintain the visual result as shown in the first image. Though since the light doesn’t affect the grass anymore, the translucency effect will be lost.
Billboarding mode, this requires the “GrassBillboardQuad” mesh. A new prefab configured for billboarding has been added.
Line Renderers can now also be used for grass bending
Angle fading feature, dithers the faces not directed at the camera, making the mesh’s planes less noticeable (works best without shadow casting)
Fixed:
Skybox reflection and fog are temporarily disabled when rendering a color map, as their effects may end up being rendered into the texture
Improvements to grass bending, where any flickering is now entirely eliminated.
Changed:
Color map is now rendered by rendering terrains with an unlit shader for increased color accuracy. Previous method still available through a checkbox, when using a third-party terrain shader.
Minimized CG allocation in grass bending render loop
Enabled LOD crossfading on all prefabs by default
Removed:
Support for directional lightmaps, this is unlikely to ever be used with grass and halves the amount of shader variants
Hi (after water-feedback, I’m now coming for grass-feedback).
I want to create a couple of rectangular panels with grass, and use them as set-up pieces to put in different parts of a scene.
Also I’m using the GPU instancer asset so I would like to crank up the quality.
Probably I will try first putting the grass by hand in the prefabs, or creating them with some procedural method to add some randomness in the position, density and orientation.
If you’re using GPU Instancer, be sure to activate the integration at the bottom of the material UI. Otherwise the grass may fail to render entirely, or won’t benefit from the tool’s performance benefit.
Submitted v1.1.3, which adds support for the new Screen-space Ambient Occlusion feature in Unity 2020.2+. May not be live until early January since part of the Unity staff is on holiday break.
Hi, I’m looking around to check performances using this asset in our game, and I don’t seem to be able to make dynamic batching work with this grass.
The demo scene obviously breaks it with the varying scales but even when putting all to uniform scales the stats window always shows 0 batching.
There are no plugins managing the GPU instancing yet, it’ll probably help in that regard but I wondered if there were mandatory to get any batching happening.
Dynamic batching most likely doesn’t work because the LOD0 grass patch mesh has 193 vertices, while dynamic batching is limited to 180 vertices per mesh. Removing LOD0 from the prefab and LOD group will probably get around this. But the Frame Debugger will tell you exactly why something cannot be batched.
Though dynamic/static batching will break any color and wind randomization per instance, since each instance no longer has a unique pivot point.
Is there any particular reason why you can’t use GPU instancing?
No really, just we don’t have any of the plugins that your system is hooking to yet, but it’s planned. I’ll have alook at them and at doing it ourselves if it’s supported by your system.
Checked more the docs after my message and yeah, didn’t remember dynamic batchnig was that limited, sorry. It’s my first time digging in URP and not used to have 0 visible effet of what is batched or not ^^;
I’ll have to look more into the frame debugger then.
Thanks for the quick answer anyway.
I see, you don’t necessarily need an instanced renderer. Their main benefit is that they remove the overhead of GameObjects, as having potentially 100.000 objects individual objects in the scene will heavily weigh down performance.
But GPU instancing will combine MeshRenderers using the same material/mesh into a few drawcalls (up to 1023 per drawcall I believe). Similar to batching, but instead each renderer can have individual instanced properties. So you can make use of this even with vanilla Unity. It’s already enabled by default on the grass materials.
Indeed, thanks for the clarification. I guess I’ll have to play around with that and the SRP batcher, as once it’s active it seem to take effect before GPU instancing, just need to see what gets the most benefits I guess.
Have encounter this before on trees, but didn’t think much of it because I was using a grass shader on trees. Specifically, it seems to occur when using a HDR skybox for lighting and Bloom with an intensity higher than 1.
I’ve been able to reproduce it (at least on trees) and tracked down the root of the problem. There is a small modification you can make that appears to fix this.
In the Stylized Grass Shader/Shaders/LightingPass.hlsl file you can change line 111 from:
surfaceData.albedo = albedo;
to
surfaceData.albedo = saturate(albedo);
Sparing the technically details, it trickles down to URP’s lighting functionality, but taking out this changes brings back the sparkles. Please let me know if this works out for you!
This happens when you paint grass through the terrain’s detail system, which doesn’t support anything other than the built-in billboard grass. From the “Placing grass” documentation section:
It was definitely bloom. Thanks! I deactivated it completely, you hardly notice that.
Unfortunately, rewriting LightingPass.hls did not help. I use everything from the demo scene for now, lightning etc… Bloom intensity was 1.
If I need bloom again, I’ll try to reproduce the whole thing.
I guess I was a bit too wild with meshbrush. I found some twisted grasses.
Hi.
I was testing using the grass with a colormap.
I am using a normal plane mesh with a tiled texture. The plane has a scale of (9, 1, 6) in the transform, so is basically a field of 90 x 60 meters:
This gives me the idea that the size of the texture used is correct, but there is a problem with the offset at the start of the texture.
Like if it start using the colormap from the (0,0) UV.