- Home /
Simple texture blender shader not working properly
I am trying to create a 2d morph effect by taking texture1 and lerping a blend value to texture2. However, anything in Texture2 that falls in a transparent part of Texture1 is not drawn. Here is the code:
Shader "Custom/AlphaBlender"
{
Properties {
_Blend ("Blend", Range (0, 1) ) = 0
_MainTex ("Texture 1", 2D) = ""
_Texture2 ("Texture 2", 2D) = ""
}
SubShader {
Tags {"RenderType"="Transparent" Queue = Transparent}
Blend SrcAlpha OneMinusSrcAlpha
Pass {
SetTexture[_MainTex]
SetTexture[_Texture2] {
ConstantColor (0,0,0, [_Blend])
Combine texture Lerp(constant) previous
}
}
}
}
Here is an image of Texture1 and Texture2:
Here is what the adding Texture1 to _MainTex and Texture2 to _Texture2 and setting _Blend to 1 looks like:
As you can see, parts of the flowers are missing. I looked everywhere but I can't figure out how to fix this. Please help!
screen-shot-2015-10-30-at-102105-pm.png
(30.3 kB)
screen-shot-2015-10-30-at-101941-pm.png
(55.4 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612043409im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Silhouette overlay shader 0 Answers
How to set up additive blending on a surface shader? 2 Answers
How to do an outline shader?,How to do an outline? 0 Answers
Shader Problem 0 Answers
How is _WorldSpaceLightPos0 calculated for a directional light? 0 Answers