Blending between coplanar planes
Hi
I have two coplanar plane meshes that partially overlap. They represent two different but calibrated parts of the same terrain, and their textures overlap perfectly. When the meshes are drawn opaque, you cannot distinguish the edge between the two meshes. But when you apply the same overall transparency to all, the overlapping region suddenly shows up. See attached snapshots (in both screenshots, left pane is the editor scene with wireframe, and right pane is the game window).
I've been fighting with ShaderLab to find a way to hide the overlapping region even when blending transparency, with no success.
I am using the following shader:
Shader "TransparentChannel1"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Alpha("Transparency", Range(0, 1)) = 1
}
SubShader
{
Tags{ "Queue" = "Transparent+1" }
Cull Off
ZWrite Off
Pass
{
Offset -1, -1
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex]
{
ConstantColor (1,1,1,[_Alpha])
combine texture, texture*constant
}
}
}
}
This is actually the shader for the first mesh. For the second mesh I use the same shader but with the following differences, in order to solve the depth fighting issues:
Shader "TransparentChannel2"
{
...
Tags{ "Queue" = "Transparent+2" }
...
Offset -2, -2
Anybody has an idea how to solve my problem with ShaderLab ? (preferably without CG/glsl programming)
Thanks!
Michael
Your answer
Follow this Question
Related Questions
HLSL clip() function don't work on Adreno 320 0 Answers
Render queue on Shader Graphs seems to be ignored 1 Answer
Blur shader that works with Vive 0 Answers
Getting Color Generated from Shader to Script to Shader 0 Answers
Unity MVP coordinate exchange 2 Answers