Search Unity

Question Can someone help me translate this shader to URP?

Discussion in 'Shaders' started by petey, Mar 26, 2024.

  1. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hi all,

    I have very little knowledge of shaders but I was wondering if someone could help me convert this shader to work in URP? It's one of the last things I need to figure out and I'm really stumped. :oops: It looks pretty simple, it's unlit.

    Thanks!
    Pete

    Code (CSharp):
    1. Properties {
    2.     _Color ("Main Color", Color) = (1,1,1,1)
    3.     _MainTex ("Base (RGB)", 2D) = "white" {}
    4.     _LightMap ("Lightmap (RGB)", 2D) = "lightmap" { LightmapMode }
    5. }
    6.  
    7. SubShader {
    8.     Tags { "RenderType"="Opaque" }
    9.  
    10.     // Base pass: lightmap
    11.     Pass {
    12.         Name "BASE"
    13.         Tags {"LightMode" = "Always"}
    14.         BindChannels {
    15.             Bind "Vertex", vertex
    16.             Bind "texcoord", texcoord0 // lightmap uses 2nd uv
    17.         }
    18.         SetTexture [_LightMap] { constantColor [_Color] combine texture * constant }
    19.     }
    20.  
    21.     // Second pass: custom Texture
    22.     Pass {
    23.         Name "BASE"
    24.         Tags {"LightMode" = "Always"}
    25.         BindChannels {
    26.             Bind "Vertex", vertex
    27.             Bind "texcoord1", texcoord0 // main uses 1st uv
    28.         }
    29.         Blend Zero SrcColor
    30.         //Fog { Color (0,0,0,0) }
    31.      
    32.         SetTexture [_MainTex] { combine texture Matrix[_RotateMatrix]}
    33.     }
    34.     }
    35. }
     
    Last edited: Mar 26, 2024