unity使用球体和shader做全景球

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,放一张全景图到组件对应位置

posted @ 2022-06-22 18:05  哒哒哒~~~  阅读(304)  评论(0编辑  收藏  举报