Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Secondary map blending

Discussion in 'Shaders' started by Boonalot, Sep 9, 2017.

  1. Boonalot

    Boonalot

    Joined:
    Sep 8, 2017
    Posts:
    3
    hey ..im a newbie
    i managed to ad a secondary texture to my new surface shader by adding uv2 and used the lerp function to put them together. The main texture is moving the other is static in just like intended
    void surf (Input IN, inout SurfaceOutput o)
    {
    float2 uv = IN.uv_MainTex;
    uv.x += sin ((uv.x+uv.y)*_TileX+_Time.g *_SpeedX)*_Scale;
    uv.x += cos (uv.y*_TileY+_Time.g *_SpeedY)*_Scale;


    float2 uv2 = IN.uv2_SecondaryTex;
    half4 c = lerp(tex2D (_MainTex, uv),tex2D (_SecondaryTex, uv2),0.5);
    but when use the shader and textures on my model (its mostly white/black) it looks a little gray, i already played around with the import settings to set up transparency but it didnt work. What i want is that the the second texture to be in front and the other under it...i googled around and found only https://docs.unity3d.com/Manual/StandardShaderMaterialParameterDetail.html but that didnt really help me, i tried to use the standard shader secondary map and detail mask options but there was no difference so what im doing wrong or is it just a problem how unity shows it to me?
     
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    375
    Instead of lerping by 0.5 lerp by the second texture's alpha or whatever else you would like.