- Home /
Transparent shader (water) showing over billboard trees
Hi,
I have cross-posted this question and will be glad to cross post any answers: [Shader Lab][1], [Support Forum][2]
I used a Transparent/Bumped shader to make river and lake water [see attached picture][3]. As you can see, the river/water shows through the tree in front of it, but only when the tree is billboarded. I found a thread with a similar question: [Pro water showing over trees thread][4] with a good answer by CodeMonkey. He recommends this:
"Queue"="Transparent" to "Queue"="Transparent-200" However, I can't find an Edit button or way to edit the Transparent/Bumped Specular shader. Any suggestions? Thanks. Zaffer [1]: http://forum.unity3d.com/threads/129459-water-showing-over-billboard-trees [2]: http://forum.unity3d.com/threads/129381-water-over-billboard-trees-problem [3]: http://bitsong.com/forPosting/Unity/water_over_tree.html [4]: http://forum.unity3d.com/threads/77544-3.2-Water-over-billboard-treesYou can fix the issue by changing the queue order for the water. Edit FX-Water3.shader and replace all instances of:
Hi, You can find the sources of built-in shaders here.
Hi Cascho01, Glad my solution works but I can't help you with reworking the trees billboard-shader. I was hanging on by my mental fingernails just finding the built-in shaders and editing one of them. Anybody else?
This solution no work in Water4! What solution for Water4?
Answer by Zaffer · Mar 27, 2012 at 05:41 PM
Thanks Moichezmoi,
I had totally forgotten about the built-in shaders. It worked like a charm. For those not familiar with how to do this, you download the built-in shaders, per the link above, unzip and pick out the one you want. In my case, it was Alpha-BumpSpec.shader equals Transparent/Bumped Specular. Then you put a copy of the shader you want in the Assets folder, and once you do that, you will be able to open it in MonoDevelop by clicking on its Open button in the Inspector.
Once open, you first have to rename it so it will show up in the Shader menu. To do this, change the line:
Shader "Transparent/Bumped Specular" to Shader "Custom/Transparent/Bumped Specular"
When that's done, all you have to do is make the code change itself per CodeMonkey's directions: original water over trees thread, change:
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 400
to
SubShader { Tags {"Queue"="Transparent-200" "IgnoreProjector"="True" "RenderType"="Transparent"} LOD 400
Save those changes, apply your custom shader to your material (you will find it in the shader menu under Custom) and the water behaves itself and stays behind the trees.
@Zaffer Surprised to find today in Unity 5.2 with older Trees going to billboard this still happens; thankful for this post which solved the problem.
Answer by Cascho01 · Apr 26, 2012 at 05:35 PM
I see that your solutions will work. But I use different transparency-shaders for multiple materials. In your case I have to make these changes to all my transparent shaders.
Wouldn´t it be smarter to change the trees billboard-shader queue only (to let´s say -99)?
I have tried this, but I get strange error messages from the editor when replacing the hidden original with the downloaded one from builtin_shaders.zip.
Any help on this?
Answer by bojangles · Jan 05, 2017 at 09:59 AM
Instead of creating a new shader, create an instance copy of the water material and set the renderQueue variable to a more appropriate number. 2005 worked for me (rendering water after terrain and trees)
waterHQ.GetComponent<MeshRenderer>().material.renderQueue = 2005;
Answer by Darren_Therrien · Jan 20, 2018 at 05:55 PM
Change the billboard start on your terrain to a higher number than the default until you notice the effect is gone. Simple answer I found for me.
Depending on your tree mesh complexity, LOD settings, tree counts and other game environment factors, that could impact performance.
Your answer
Follow this Question
Related Questions
Unity tree billboard depth buffer 0 Answers
Billboard trees - changing the render queue 0 Answers
Transparency shader that also writes to Camera Depth Texture 0 Answers
Changing Queue in shader has no effect 1 Answer
About shader! 0 Answers