Trying to get my two pass shader into one

hey!

i try to get the following shader into one pass.

The shader blends two textures in the first pass and then ads shading in the second.

 	Pass {
 	 	 		 	 	 	 	 	 		 	 	 	 	 	 	 	
 	 	BindChannels
		{
			Bind "vertex", vertex 
			Bind "normal", normal
			Bind "texcoord", texcoord0
			Bind "texcoord1", texcoord1
		}		
		
 		SetTexture[_MainTex]
 		 		
 		SetTexture[_MainTex] { Combine texture Lerp (texture) previous }
 	}



 	Pass
 	{
 		Blend Zero SrcColor 
 		
 		Material
 		{
			Diffuse [_Color]
			Ambient [_Color]
		}
        Lighting On 
        
        SetTexture[_] { Combine primary double}
 	}

this should be the same as:

 	Pass {	 	 	
 	 	 	 	 	 	 	 	 		 	 	 	 	 	 	 	
 	 	BindChannels
		{
			Bind "vertex", vertex 
			Bind "normal", normal
			Bind "texcoord", texcoord0
			Bind "texcoord1", texcoord1
		}
		
		Material
 		{
			Diffuse [_Color]
			Ambient [_Color]
		}
        Lighting On 	
		
		
 		SetTexture[_MainTex]
 		 		
 		SetTexture[_MainTex] { Combine texture Lerp (texture) previous }
 		
 		SetTexture[_] { Combine previous * primary double }
 	}

But it isn’t the same light effect. In the 2 pass shader i have smoother lights while in the 1 pas shader i have kind of oversaturated highlights.

why? :face_with_spiral_eyes:
how can i get the 1 pass shader having the same result as the 2 pass shader?

Actually it’s the two pass version that gets saturated. If total light value is under 0.5 the two shaders look the same.

Also the lerp stage is useless and everything comes down to just

Pass {
        BindChannels {
            Bind "vertex", vertex 
            Bind "normal", normal
            Bind "texcoord", texcoord0
            Bind "texcoord1", texcoord1
        }

        Material {
            Diffuse [_Color]
            Ambient [_Color]
        }
        Lighting On     
        
        SetTexture[_MainTex] { Combine texture * primary double }
    }

I’m not expert in shaderlab so correct me if I’m wrong.
Cheers.

hi

Actually it’s the two pass version that gets saturated

can you explain please?

also i found out that the 1 pass version produces color values over 1 and so become “overlit”.
while the 2 pass version lerps in the shadows so even with strong light the texture never gets lighter than in “unlit” state.

Also the lerp stage is useless and everything comes down to just

no - the lerp stage of the first pass blends between different UVs of the same texture

so i guess the question is now… how can i do something like this:

previous Lerp (primary * 2) color(0,0,0,1)

the problem is: Lerp uses only the alpha component and primary needs to be doubled before

scratching head