Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Converting a custom shader to URP but getting an error

Discussion in 'Universal Render Pipeline' started by Aktarus_Neuro, Jun 14, 2021.

  1. Aktarus_Neuro

    Aktarus_Neuro

    Joined:
    Jun 4, 2016
    Posts:
    12
    Hi Everyone, I am trying to convert this Shader used for a skybox into URP, for an educational project (and yes I am a beginner :0) but I have got some errors. Plus everything turned pink into the scene.
    I know this shader is quite old (2018) but I am sure there is a way to convert it. I have followed the advice of
    @weiping-toh in another thread.
    Here is the original code:

    Code (CSharp):
    1. Shader "Skybox/Clouds"
    2. {
    3.     Properties
    4.     {
    5.         [NoScaleOffset] _CloudTex1 ("Clouds 1", 2D) = "white" {}
    6.         [NoScaleOffset] _FlowTex1 ("Flow Tex 1", 2D) = "grey" {}
    7.         _Tiling1("Tiling 1", Vector) = (1,1,0,0)
    8.         [NoScaleOffset] _CloudTex2 ("Clouds 2", 2D) = "white" {}
    9.         [NoScaleOffset] _Tiling2("Tiling 2", Vector) = (1,1,0,0)
    10.         _Cloud2Amount ("Cloud 2 Amount", float) = 0.5
    11.         _FlowSpeed ("Flow Speed", float) = 1
    12.         _FlowAmount ("Flow Amount", float) = 1
    13.         [NoScaleOffset] _WaveTex ("Wave", 2D) = "white" {}
    14.         _TilingWave("Tiling Wave", Vector) = (1,1,0,0)
    15.         _WaveAmount ("Wave Amount", float) = 0.5
    16.         _WaveDistort ("Wave Distort", float) = 0.05
    17.         _CloudScale ("Clouds Scale", float) = 1.0
    18.         _CloudBias ("Clouds Bias", float) = 0.0
    19.         [NoScaleOffset] _ColorTex ("Color Tex", 2D) = "white" {}
    20.         _TilingColor("Tiling Color", Vector) = (1,1,0,0)
    21.         _ColPow ("Color Power", float) = 1
    22.         _ColFactor ("Color Factor", float) = 1
    23.         _Color ("Color", Color) = (1.0,1.0,1.0,1)
    24.         _Color2 ("Color2", Color) = (1.0,1.0,1.0,1)
    25.         _CloudDensity ("Cloud Density", float) = 5.0
    26.         _BumpOffset ("BumpOffset", float) = 0.1
    27.         _Steps ("Steps", float) = 10
    28.         _CloudHeight ("Cloud Height", float) = 100
    29.         _Scale ("Scale", float) = 10
    30.         _Speed ("Speed", float) = 1
    31.         _LightSpread ("Light Spread PFPF", Vector) = (2.0,1.0,50.0,3.0)
    32.     }
    33.     SubShader
    34.     {
    35.         Tags { "RenderType"="Opaque" }
    36.         LOD 100
    37.         Pass
    38.         {
    39.             CGPROGRAM
    40.             #pragma vertex vert
    41.             #pragma fragment frag
    42.        
    43.             #include "UnityCG.cginc"
    44.             #define SKYBOX
    45.             #include "FogInclude.cginc"
    46.             sampler2D _CloudTex1;
    47.             sampler2D _FlowTex1;
    48.             sampler2D _CloudTex2;
    49.             sampler2D _WaveTex;
    50.             float4 _Tiling1;
    51.             float4 _Tiling2;
    52.             float4 _TilingWave;
    53.             float _CloudScale;
    54.             float _CloudBias;
    55.             float _Cloud2Amount;
    56.             float _WaveAmount;
    57.             float _WaveDistort;
    58.             float _FlowSpeed;
    59.             float _FlowAmount;
    60.             sampler2D _ColorTex;
    61.             float4 _TilingColor;
    62.             float4 _Color;
    63.             float4 _Color2;
    64.             float _CloudDensity;
    65.             float _BumpOffset;
    66.             float _Steps;
    67.             float _CloudHeight;
    68.             float _Scale;
    69.             float _Speed;
    70.             float4 _LightSpread;
    71.             float _ColPow;
    72.             float _ColFactor;
    73.             struct v2f
    74.             {
    75.                 float4 vertex : SV_POSITION;
    76.                 float3 worldPos : TEXCOORD0;
    77.             };
    78.        
    79.             v2f vert (appdata_full v)
    80.             {
    81.                 v2f o;
    82.                 o.vertex = UnityObjectToClipPos(v.vertex);
    83.                 o.worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
    84.                 return o;
    85.             }
    86.             float rand3( float3 co ){
    87.                 return frac( sin( dot( co.xyz ,float3(17.2486,32.76149, 368.71564) ) ) * 32168.47512);
    88.             }
    89.             half4 SampleClouds ( float3 uv, half3 sunTrans, half densityAdd ){
    90.                 // wave distortion
    91.                 float3 coordsWave = float3( uv.xy *_TilingWave.xy + ( _TilingWave.zw * _Speed * _Time.y ), 0.0 );
    92.                 half3 wave = tex2Dlod( _WaveTex, float4(coordsWave.xy,0,0) ).xyz;
    93.                 // first cloud layer
    94.                 float2 coords1 = uv.xy * _Tiling1.xy + ( _Tiling1.zw * _Speed * _Time.y ) + ( wave.xy - 0.5 ) * _WaveDistort;
    95.                 half4 clouds = tex2Dlod( _CloudTex1, float4(coords1.xy,0,0) );
    96.                 half3 cloudsFlow = tex2Dlod( _FlowTex1, float4(coords1.xy,0,0) ).xyz;
    97.                 // set up time for second clouds layer
    98.                 float speed = _FlowSpeed * _Speed * 10;
    99.                 float timeFrac1 = frac( _Time.y * speed );
    100.                 float timeFrac2 = frac( _Time.y * speed + 0.5 );
    101.                 float timeLerp  = abs( timeFrac1 * 2.0 - 1.0 );
    102.                 timeFrac1 = ( timeFrac1 - 0.5 ) * _FlowAmount;
    103.                 timeFrac2 = ( timeFrac2 - 0.5 ) * _FlowAmount;
    104.                 // second cloud layer uses flow map
    105.                 float2 coords2 = coords1 * _Tiling2.xy + ( _Tiling2.zw * _Speed * _Time.y );
    106.                 half4 clouds2 = tex2Dlod( _CloudTex2, float4(coords2.xy + ( cloudsFlow.xy - 0.5 ) * timeFrac1,0,0)  );
    107.                 half4 clouds2b = tex2Dlod( _CloudTex2, float4(coords2.xy + ( cloudsFlow.xy - 0.5 ) * timeFrac2 + 0.5,0,0)  );
    108.                 clouds2 = lerp( clouds2, clouds2b, timeLerp);
    109.                 clouds += ( clouds2 - 0.5 ) * _Cloud2Amount * cloudsFlow.z;
    110.                 // add wave to cloud height
    111.                 clouds.w += ( wave.z - 0.5 ) * _WaveAmount;
    112.                 // scale and bias clouds because we are adding lots of stuff together
    113.                 // and the values cound go outside 0-1 range
    114.                 clouds.w = clouds.w * _CloudScale + _CloudBias;
    115.                 // overhead light color
    116.                 float3 coords4 = float3( uv.xy * _TilingColor.xy + ( _TilingColor.zw * _Speed * _Time.y ), 0.0 );
    117.                 half4 cloudColor = tex2Dlod( _ColorTex, float4(coords4.xy,0,0)  );
    118.                 // cloud color based on density
    119.                 half cloudHightMask = 1.0 - saturate( clouds.w );
    120.                 cloudHightMask = pow( cloudHightMask, _ColPow );
    121.                 clouds.xyz *= lerp( _Color2.xyz, _Color.xyz * cloudColor.xyz * _ColFactor, cloudHightMask );
    122.                 // subtract alpha based on height
    123.                 half cloudSub = 1.0 - uv.z;
    124.                 clouds.w = clouds.w - cloudSub * cloudSub;
    125.                 // multiply density
    126.                 clouds.w = saturate( clouds.w * _CloudDensity );
    127.                 // add extra density
    128.                 clouds.w = saturate( clouds.w + densityAdd );
    129.                 // add Sunlight
    130.                 clouds.xyz += sunTrans * cloudHightMask;
    131.                 // premultiply alpha
    132.                 clouds.xyz *= clouds.w;
    133.                 return clouds;
    134.             }
    135.             fixed4 frag (v2f IN) : SV_Target
    136.             {
    137.                 // generate a view direction fromt he world position of the skybox mesh
    138.                 float3 viewDir = normalize( IN.worldPos - _WorldSpaceCameraPos );
    139.                 // get the falloff to the horizon
    140.                 float viewFalloff = 1.0 - saturate( dot( viewDir, float3(0,1,0) ) );
    141.                 // Add some up vector to the horizon to pull the clouds down
    142.                 float3 traceDir = normalize( viewDir + float3(0,viewFalloff * 0.1,0) );
    143.                 // Generate uvs from the world position of the sky
    144.                 float3 worldPos = _WorldSpaceCameraPos + traceDir * ( ( _CloudHeight - _WorldSpaceCameraPos.y ) / max( traceDir.y, 0.00001) );
    145.                 float3 uv = float3( worldPos.xz * 0.01 * _Scale, 0 );
    146.                 // Make a spot for the sun, make it brighter at the horizon
    147.                 float lightDot = saturate( dot( _WorldSpaceLightPos0, viewDir ) * 0.5 + 0.5 );
    148.                 half3 lightTrans = _LightColor0.xyz * ( pow(lightDot,_LightSpread.x) * _LightSpread.y + pow(lightDot,_LightSpread.z) * _LightSpread.w );
    149.                 half3 lightTransTotal = lightTrans * pow(viewFalloff, 5 ) * 5.0 + 1.0;
    150.                 // Figure out how for to move through the uvs for each step of the parallax offset
    151.                 half3 uvStep = half3( traceDir.xz * _BumpOffset * ( 1.0 / traceDir.y), 1.0 ) * ( 1.0 / _Steps );
    152.                 uv += uvStep * rand3( IN.worldPos + _SinTime.w );
    153.                 // initialize the accumulated color with fog
    154.                 half4 accColor = FogColorDensitySky(viewDir);
    155.                 half4 clouds = 0;
    156.                 [loop]for( int j = 0; j < _Steps; j++ ){
    157.                     // if we filled the alpha then break out of the loop
    158.                     if( accColor.w >= 1.0 ) { break; }
    159.                     // add the step offset to the uv
    160.                     uv += uvStep;
    161.                     // sample the clouds at the current position
    162.                     clouds = SampleClouds(uv, lightTransTotal, 0.0 );
    163.                     // add the current cloud color with front to back blending
    164.                     accColor += clouds * ( 1.0 - accColor.w );
    165.                 }
    166.                 // one last sample to fill gaps
    167.                 uv += uvStep;
    168.                 clouds = SampleClouds(uv, lightTransTotal, 1.0 );
    169.                 accColor += clouds * ( 1.0 - accColor.w );
    170.                 // return the color!
    171.                 return accColor;
    172.             }
    173.             ENDCG
    174.         }
    175.     }
    176. }
    And this is my modified code:
    Code (CSharp):
    1. Shader "Skybox/Clouds"
    2. {
    3.     Properties
    4.     {
    5.         [NoScaleOffset] _CloudTex1 ("Clouds 1", 2D) = "white" {}
    6.         [NoScaleOffset] _FlowTex1 ("Flow Tex 1", 2D) = "grey" {}
    7.         _Tiling1("Tiling 1", Vector) = (1,1,0,0)
    8.         [NoScaleOffset] _CloudTex2 ("Clouds 2", 2D) = "white" {}
    9.         [NoScaleOffset] _Tiling2("Tiling 2", Vector) = (1,1,0,0)
    10.         _Cloud2Amount ("Cloud 2 Amount", float) = 0.5
    11.         _FlowSpeed ("Flow Speed", float) = 1
    12.         _FlowAmount ("Flow Amount", float) = 1
    13.         [NoScaleOffset] _WaveTex ("Wave", 2D) = "white" {}
    14.         _TilingWave("Tiling Wave", Vector) = (1,1,0,0)
    15.         _WaveAmount ("Wave Amount", float) = 0.5
    16.         _WaveDistort ("Wave Distort", float) = 0.05
    17.         _CloudScale ("Clouds Scale", float) = 1.0
    18.         _CloudBias ("Clouds Bias", float) = 0.0
    19.         [NoScaleOffset] _ColorTex ("Color Tex", 2D) = "white" {}
    20.         _TilingColor("Tiling Color", Vector) = (1,1,0,0)
    21.         _ColPow ("Color Power", float) = 1
    22.         _ColFactor ("Color Factor", float) = 1
    23.         _Color ("Color", Color) = (1.0,1.0,1.0,1)
    24.         _Color2 ("Color2", Color) = (1.0,1.0,1.0,1)
    25.         _CloudDensity ("Cloud Density", float) = 5.0
    26.         _BumpOffset ("BumpOffset", float) = 0.1
    27.         _Steps ("Steps", float) = 10
    28.         _CloudHeight ("Cloud Height", float) = 100
    29.         _Scale ("Scale", float) = 10
    30.         _Speed ("Speed", float) = 1
    31.         _LightSpread ("Light Spread PFPF", Vector) = (2.0,1.0,50.0,3.0)
    32.     }
    33.     SubShader
    34.     {
    35.         Tags { "RenderType"="Opaque" "IgnoreProjector" = "True" "RenderPipeline" = "UniversalPipeline" }
    36.         LOD 100
    37.         Pass
    38.         {
    39.             //CGPROGRAM
    40.             HLSLPROGRAM
    41.             // Required to compile gles 2.0 with standard srp library
    42.             #pragma prefer_hlslcc gles
    43.             #pragma exclude_renderers d3d11_9x
    44.             #pragma vertex vert
    45.             #pragma fragment frag
    46.             // -------------------------------------
    47.             // Unity defined keywords
    48.             #pragma multi_compile_fog
    49.             #pragma multi_compile_instancing
    50.             #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
    51.        
    52.             //#include "UnityCG.cginc"
    53.             #define SKYBOX
    54.             //#include "FogInclude.cginc"
    55.             sampler2D _CloudTex1;
    56.             sampler2D _FlowTex1;
    57.             sampler2D _CloudTex2;
    58.             sampler2D _WaveTex;
    59.             CBUFFER_START(UnityPerMaterial)
    60.             float4 _Tiling1;
    61.             float4 _Tiling2;
    62.             float4 _TilingWave;
    63.             float _CloudScale;
    64.             float _CloudBias;
    65.             float _Cloud2Amount;
    66.             float _WaveAmount;
    67.             float _WaveDistort;
    68.             float _FlowSpeed;
    69.             float _FlowAmount;
    70.             sampler2D _ColorTex;
    71.             float4 _TilingColor;
    72.             float4 _Color;
    73.             float4 _Color2;
    74.             float _CloudDensity;
    75.             float _BumpOffset;
    76.             float _Steps;
    77.             float _CloudHeight;
    78.             float _Scale;
    79.             float _Speed;
    80.             float4 _LightSpread;
    81.             float _ColPow;
    82.             float _ColFactor;
    83.             CBUFFER_END
    84.             struct v2f
    85.             {
    86.                 float4 vertex : SV_POSITION;
    87.                 float3 worldPos : TEXCOORD0;
    88.             };
    89.        
    90.             v2f vert (appdata_full v)
    91.             {
    92.                 v2f o;
    93.                 o.vertex = UnityObjectToClipPos(v.vertex);
    94.                 o.worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;
    95.                 return o;
    96.             }
    97.             float rand3( float3 co ){
    98.                 return frac( sin( dot( co.xyz ,float3(17.2486,32.76149, 368.71564) ) ) * 32168.47512);
    99.             }
    100.             half4 SampleClouds ( float3 uv, half3 sunTrans, half densityAdd ){
    101.                 // wave distortion
    102.                 float3 coordsWave = float3( uv.xy *_TilingWave.xy + ( _TilingWave.zw * _Speed * _Time.y ), 0.0 );
    103.                 half3 wave = tex2Dlod( _WaveTex, float4(coordsWave.xy,0,0) ).xyz;
    104.                 // first cloud layer
    105.                 float2 coords1 = uv.xy * _Tiling1.xy + ( _Tiling1.zw * _Speed * _Time.y ) + ( wave.xy - 0.5 ) * _WaveDistort;
    106.                 half4 clouds = tex2Dlod( _CloudTex1, float4(coords1.xy,0,0) );
    107.                 half3 cloudsFlow = tex2Dlod( _FlowTex1, float4(coords1.xy,0,0) ).xyz;
    108.                 // set up time for second clouds layer
    109.                 float speed = _FlowSpeed * _Speed * 10;
    110.                 float timeFrac1 = frac( _Time.y * speed );
    111.                 float timeFrac2 = frac( _Time.y * speed + 0.5 );
    112.                 float timeLerp  = abs( timeFrac1 * 2.0 - 1.0 );
    113.                 timeFrac1 = ( timeFrac1 - 0.5 ) * _FlowAmount;
    114.                 timeFrac2 = ( timeFrac2 - 0.5 ) * _FlowAmount;
    115.                 // second cloud layer uses flow map
    116.                 float2 coords2 = coords1 * _Tiling2.xy + ( _Tiling2.zw * _Speed * _Time.y );
    117.                 half4 clouds2 = tex2Dlod( _CloudTex2, float4(coords2.xy + ( cloudsFlow.xy - 0.5 ) * timeFrac1,0,0)  );
    118.                 half4 clouds2b = tex2Dlod( _CloudTex2, float4(coords2.xy + ( cloudsFlow.xy - 0.5 ) * timeFrac2 + 0.5,0,0)  );
    119.                 clouds2 = lerp( clouds2, clouds2b, timeLerp);
    120.                 clouds += ( clouds2 - 0.5 ) * _Cloud2Amount * cloudsFlow.z;
    121.                 // add wave to cloud height
    122.                 clouds.w += ( wave.z - 0.5 ) * _WaveAmount;
    123.                 // scale and bias clouds because we are adding lots of stuff together
    124.                 // and the values cound go outside 0-1 range
    125.                 clouds.w = clouds.w * _CloudScale + _CloudBias;
    126.                 // overhead light color
    127.                 float3 coords4 = float3( uv.xy * _TilingColor.xy + ( _TilingColor.zw * _Speed * _Time.y ), 0.0 );
    128.                 half4 cloudColor = tex2Dlod( _ColorTex, float4(coords4.xy,0,0)  );
    129.                 // cloud color based on density
    130.                 half cloudHightMask = 1.0 - saturate( clouds.w );
    131.                 cloudHightMask = pow( cloudHightMask, _ColPow );
    132.                 clouds.xyz *= lerp( _Color2.xyz, _Color.xyz * cloudColor.xyz * _ColFactor, cloudHightMask );
    133.                 // subtract alpha based on height
    134.                 half cloudSub = 1.0 - uv.z;
    135.                 clouds.w = clouds.w - cloudSub * cloudSub;
    136.                 // multiply density
    137.                 clouds.w = saturate( clouds.w * _CloudDensity );
    138.                 // add extra density
    139.                 clouds.w = saturate( clouds.w + densityAdd );
    140.                 // add Sunlight
    141.                 clouds.xyz += sunTrans * cloudHightMask;
    142.                 // premultiply alpha
    143.                 clouds.xyz *= clouds.w;
    144.                 return clouds;
    145.             }
    146.             fixed4 frag (v2f IN) : SV_Target
    147.             {
    148.                 // generate a view direction fromt he world position of the skybox mesh
    149.                 float3 viewDir = normalize( IN.worldPos - _WorldSpaceCameraPos );
    150.                 // get the falloff to the horizon
    151.                 float viewFalloff = 1.0 - saturate( dot( viewDir, float3(0,1,0) ) );
    152.                 // Add some up vector to the horizon to pull the clouds down
    153.                 float3 traceDir = normalize( viewDir + float3(0,viewFalloff * 0.1,0) );
    154.                 // Generate uvs from the world position of the sky
    155.                 float3 worldPos = _WorldSpaceCameraPos + traceDir * ( ( _CloudHeight - _WorldSpaceCameraPos.y ) / max( traceDir.y, 0.00001) );
    156.                 float3 uv = float3( worldPos.xz * 0.01 * _Scale, 0 );
    157.                 // Make a spot for the sun, make it brighter at the horizon
    158.                 float lightDot = saturate( dot( _WorldSpaceLightPos0, viewDir ) * 0.5 + 0.5 );
    159.                 half3 lightTrans = _LightColor0.xyz * ( pow(lightDot,_LightSpread.x) * _LightSpread.y + pow(lightDot,_LightSpread.z) * _LightSpread.w );
    160.                 half3 lightTransTotal = lightTrans * pow(viewFalloff, 5 ) * 5.0 + 1.0;
    161.                 // Figure out how for to move through the uvs for each step of the parallax offset
    162.                 half3 uvStep = half3( traceDir.xz * _BumpOffset * ( 1.0 / traceDir.y), 1.0 ) * ( 1.0 / _Steps );
    163.                 uv += uvStep * rand3( IN.worldPos + _SinTime.w );
    164.                 // initialize the accumulated color with fog
    165.                 half4 accColor = FogColorDensitySky(viewDir);
    166.                 half4 clouds = 0;
    167.                 [loop]for( int j = 0; j < _Steps; j++ ){
    168.                     // if we filled the alpha then break out of the loop
    169.                     if( accColor.w >= 1.0 ) { break; }
    170.                     // add the step offset to the uv
    171.                     uv += uvStep;
    172.                     // sample the clouds at the current position
    173.                     clouds = SampleClouds(uv, lightTransTotal, 0.0 );
    174.                     // add the current cloud color with front to back blending
    175.                     accColor += clouds * ( 1.0 - accColor.w );
    176.                 }
    177.                 // one last sample to fill gaps
    178.                 uv += uvStep;
    179.                 clouds = SampleClouds(uv, lightTransTotal, 1.0 );
    180.                 accColor += clouds * ( 1.0 - accColor.w );
    181.                 // return the color!
    182.                 return accColor;
    183.             }
    184.             //ENDCG
    185.             ENDHLSL
    186.         }
    187.     }
    188. }
    The error I have got is the following:

    unrecognized identifier 'appdata_full'
    Compiling Fragment program
    Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_USE_DITHER_MASK_FOR_ALPHABLENDED_SHADOWS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING UNITY_ENABLE_DETAIL_NORMALMAP SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA UNITY_LIGHT_PROBE_PROXY_VOLUME UNITY_LIGHTMAP_FULL_HDR
    Disabled keywords: FOG_LINEAR FOG_EXP FOG_EXP2 INSTANCING_ON UNITY_NO_DXT5nm UNITY_ENABLE_NATIVE_SHADOW_LOOKUPS UNITY_METAL_SHADOWS_USE_POINT_FILTERING UNITY_NO_SCREENSPACE_SHADOWS UNITY_PBS_USE_BRDF2 UNITY_PBS_USE_BRDF3 UNITY_NO_FULL_STANDARD_SHADER UNITY_HARDWARE_TIER1 UNITY_HARDWARE_TIER2 UNITY_HARDWARE_TIER3 UNITY_HALF_PRECISION_FRAGMENT_SHADER_REGISTERS UNITY_LIGHTMAP_DLDR_ENCODING UNITY_LIGHTMAP_RGBM_ENCODING UNITY_VIRTUAL_TEXTURING UNITY_PRETRANSFORM_TO_DISPLAY_ORIENTATION UNITY_ASTC_NORMALMAP_ENCODING SHADER_API_GLES30


    From what I read the error is 'appdata_full', but I don't see what is wrong here.
    Any help, please?
     
    Last edited: Jun 16, 2021
  2. Aktarus_Neuro

    Aktarus_Neuro

    Joined:
    Jun 4, 2016
    Posts:
    12
  3. andybak

    andybak

    Joined:
    Jan 14, 2017
    Posts:
    561
  4. Aktarus_Neuro

    Aktarus_Neuro

    Joined:
    Jun 4, 2016
    Posts:
    12

    Thank you @andybak. I have added

    Code (CSharp):
    1. struct appdata_full {
    2. float4 vertex : POSITION;
    3. float4 tangent : TANGENT;
    4. float3 normal : NORMAL;
    5. float4 texcoord : TEXCOORD0;
    6. float4 texcoord1 : TEXCOORD1;
    7. float4 texcoord2 : TEXCOORD2;
    8. float4 texcoord3 : TEXCOORD3;
    9. fixed4 color : COLOR;
    10. UNITY_VERTEX_INPUT_INSTANCE_ID
    11. };
    It removed the error but another one appeared (Unrecognized fixed4). Seems that the code needs to be rewriten from scratch. So I think I'm going to give up URP and back to SRP.
     
  5. jhocking

    jhocking

    Joined:
    Nov 21, 2009
    Posts:
    813
    This was from months ago so you've probably moved on, but the 'fixed' data type (and derivatives, like fixed4) are no longer supported in URP. So just change the fixed4 to half4

    btw in case you wanted to know what the name appdata_full means:
    https://docs.unity3d.com/Manual/SL-VertexProgramInputs.html
     
    Last edited: Apr 13, 2022
  6. BurningthumbStudios

    BurningthumbStudios

    Joined:
    Apr 28, 2008
    Posts:
    95
    I know this is old, but if anyone stumbles upon it and just wants to use the CG shader, make this change and you will have a great skybox.


    Code (CSharp):
    1.  
    2. //   Tags { "RenderType"="Opaque" }
    3. //   LOD 100
    4.    Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
    5.    Cull Off ZWrite Off
    6.  
    I'll look at finishing the port to an HLSLPROGRAM just for fun.