Hello! I’m getting the following errors when trying to bake a color map in the demo scene with Unity 2023:
Shader error in ‘Hidden/TerrainAlbedo’: redefinition of ‘sampler_LinearClamp’ at Shader/Editor/TerrainSplatmaskPass.hlsl(5) (on d3d11)
Shader error in ‘Hidden/TerrainSplatmask’: redefinition of ‘sampler_LinearClamp’ at Shader/Editor/TerrainSplatmaskPass.hlsl(5) (on d3d11)
Unity 2023 is a beta/alpha version, which are not supported. The error about sampler redefinitions is one the breaking URP changes in this version, but it will be addressed once support for 2023 is verified.
Edit: Seems to have been backported to 2022.3, so that is now not completely supported either. A workaround is to check the “Using third-party terrain shader” checkbox.
I have read through the posts and at least two people have had similar problems to mine but their solutions didn’t help me.
I followed the guide for blending the grass with the terrain but all I get is red. I have double-checked the blue box and the grass and the terrain falls within the bounds.
I have altered the bounds. The terrain is not using a custom shader. I have also tried placing the grass with both Unity’s terrain system and as plain GameObjects but the result is the same. This result can be seen below.
From what I’ve read it seems like the grass is not inside the blue box but the whole terrain is inside the blue box. Any ideas?
Hey!
I’m getting a few errors with some of the Terrain shaders. Unity 2022.3.2f1 // URP 14.0.8
Shader error in 'Hidden/TerrainAlbedo': redefinition of 'sampler_LinearClamp' at Shader/Editor/TerrainSplatmaskPass.hlsl(5) (on d3d11)
Shader error in 'Hidden/TerrainAlbedoAdd': redefinition of 'sampler_LinearClamp' at Shader/Editor/TerrainSplatmaskPass.hlsl(5) (on d3d11)
Shader error in 'Hidden/TerrainSplatmask': redefinition of 'sampler_LinearClamp' at Shader/Editor/TerrainSplatmaskPass.hlsl(5) (on d3d11)
A red color specifies areas in the render where no geometry is visible, typically the skybox.
The main demo scene has a color map set up, if re-rendering it there works as expected, then you can be assured the issue is not project-specific.
@kjorrt This is actually related to the same issue as well.
Verified support for Unity 2023.1 is pending next update. One thing that breaks is this error being thrown, which in turn breaks the color map rendering, resulting in a completely red render.
I’m aiming to round off and submit the update this month
How do you get the billboards to work with multiple cameras in the scene? I am switching between cameras a lot and it seems like that is breaking the billboard effect. I’m using it for grass and distant trees actually. First image is what it looks like in Editor, and second is when I hit play and the cameras are being used.
There’s no set up needed for that to work. The billboarding is performed in the same process that positions the vertices in the world, based on the camera that’s rendering it. Therefor it always rotates the mesh towards the camera looking at it, that could be any number of camera’s simultaneously.
What’s odd is that edit or play mode makes no difference to a shader whatsoever, any differences you may see have to come from scripts so how.
What I can imagine is if you use a third-party renderer, like Nature Renderer or GPU Instancer, it may not support split-screen functionality.
Support for Rendering Layer Mask (lights and decals).
Changed:
Improved UI for the Colormap Renderer inspector to provide more concise instructions and notifications.
When saving a Colormap asset to a file, the texture is now saved as a separate .PNG file. This will allow Unity to properly compress it.
Grass bending can now be disabled on the render feature.
Angle/Distance fading now uses a dithering texture (assigned on the render feature).
(Unity 2022.2+) LOD crossfading now uses the same shader function now native to URP.
Hue variation is now applied on a per-pixel basis.
Fixed:
Colormap not taking effect when entering Play mode, if it was saved to an asset.
Non-terrain objects always rendering on top of terrains in a Colormap render output.
Colormap Renderer, non-terrain objects not being restored to their original Y-position after rendering.
Colormap Renderer, fresnel reflections potentially still being visible when using a third-party lighting system.
Ensured the flower prefabs have a centered position by default.
Grass benders not rendering using the SRP Batcher, if enabled.
Shader error ‘redefinition of sampler_linearClamp’ in URP 14.0.7+
Material UI, not respecting individual texture assignments when selecting multiple materials.
Removed:
(Deletions aren’t tracked by Unity packages, these must be performed manually on your end)
GrassBendingFeature class.
Update guide!
When now rendering a color map, you may get the error “Graphics.CopyTexture called with mismatching texture data sizes, perhaps formats are incompatible?” If so, just hit the “New” button and it won’t ever come up again:
Development overview
This is the last update to support Unity 2020.3! 2021.3 LTS will be the new minimum moving forward.
I now consider this the definitive version of the asset! Which means any major new features, or reworks are considered for the development of a new grass (shader) asset. I can’t say there are any plans for that at the moment. But the past 3 years have proven that hand-writing an opaque shader is discouraged, due to Unity relying on people using Shader Graph, which allows them to change whatever they want in their shader libraries and don’t have to be accountable for it.
So the “next” iteration of the asset would be in Shader Graph. This yields easy support for other render pipelines and (semi)automatic implementation of new Unity features. On the flipside, third-party renderers wouldn’t be integratable anymore, so the focus would lie on using DOTS.
So I actually took everything out of my scene beside the meshes with the billboard shader on them and it still changes on play mode… I don’t even have a camera in my scene now.
Possibly what’s happening is that the grass/tree geometry is being combined by Static Batching. I get that impression since clusters are rotating around a shared pivot. If your prefabs are marked for static batching, that should in any case be disabled as it prevents GPU Instancing from working.
Could also be due to Dynamic Batching, but I’d recommend to check the Frame Debugger to see what’s happening exactly.
That’s correct! Dynamic/static batching will prevent each instance from having unique properties, in this case an individual pivot point for the billboarding to rotate around.
You can still mark prefabs as static for Occlusion Culling or GI though, just not Batching.
Im trying the package with 2022.3.3 and bending is broken (also bend material is pink) is this expected? (SOLVED: Needed to change path to common.hsls to an absolute path)
Reimporting the shader in the Stylized Grass Shader\Shaders\Bending folder would have likely worked as well. If you got an error about an include file missing, it’s a definite false-positive. Unity’s shader compiler is growing more and more flakey.
Ah, strange that I missed that. By the way, I wonder if it’s a good idea that the Color Map color is applied after the AO, so you can’t really combine those two
The color map is currently applied last, in terms of color application, so will be laid over everything else. Though if the Colormap Height parameter isn’t maxed out, you will be able to see the Ambient Occlusion parameter have a bit of an effect still (particularly around the vertical center). Perhaps that’s what you’re seeing.
I just noticed that I’m mostly seeing the (somewhat) darker Equator Color of the Environment Lighting; I wonder if I can reduce that somehow for the grass
[EDIT] Ah, it’s because of the spherized normals. I’ll just turn that off then.