URP 2022.3 cumstom sky box

这skybox啊,分两步,创建材质,使用材质赋值到天空盒上
赋值的地方就在lighting面板
在这里插入图片描述
接下来就是创建这个材质了
主要是shader有一点点讲究这个Tags要这么写,LOD100也要写后面

Shader "Unlit/AerialPerspective"
{
    
    
    
    Properties
    {
    
    
        _MainTex ("_MainTex", 2D) = "white" {
    
    }
    }
    SubShader
    {
    
    
        Tags {
    
      "RenderPipeline"="UniversalPipeline"  "Queue"="Background" "IgnoreProjector" = "True"  "RenderType"="Skybox"} 
        LOD 100

        Pass
        {
    
    
            HLSLPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
            #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
            #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DeclareDepthTexture.hlsl"
            
            struct appdata
            {
    
    
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
    
    
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            v2f vert (appdata v)
            {
    
    
                v2f o;
                o.vertex = TransformObjectToHClip(v.vertex);
                o.uv = v.uv;
                return o;
            }

            Texture2D _MainTex;

            

            float4 frag (v2f i) : SV_Target
            {
    
    
                float2 uv = i.uv;
           
            	return float4(uv, 0.0, 1.0);
            }
            ENDHLSL
        }
    }
}

猜你喜欢

转载自blog.csdn.net/qq_35158695/article/details/141299259
sky
Box