当前位置 博文首页 > unity工具人的博客:unity使用球体和shader做全景球

    unity工具人的博客:unity使用球体和shader做全景球

    作者:[db:作者] 时间:2021-07-20 09:38

    Shader "Custom/InwardShader" {
      Properties {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
      }
      SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
        
        Cull Front
    
        CGPROGRAM
        #pragma surface surf Standard vertex:vert
    
        void vert(inout appdata_full v) {
          v.normal.xyz = v.normal * -1;
        }
    
        sampler2D _MainTex;
    
        struct Input {
          float2 uv_MainTex;
        };
    
        void surf (Input IN, inout SurfaceOutputStandard o) {
          fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
          o.Albedo = c.rgb;
        }
        ENDCG
      } 
      FallBack "Diffuse"
    }
    

    用这个shader,放一张全景图到组件对应位置

    cs
    下一篇:没有了