效果:
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/d3daa1a22ca5495d873b71f468f9330c.png)
实现步骤
- 全景图的格式改为sprite。
- 将全景图的材质拖拽给球。
- 将法线反转shader拖拽给全景图的材质。
- 球的子物体是相机。
- 相机的子物体是线性光。
法线反转shader
Shader "Custom/Flip Normals" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
Cull Off
CGPROGRAM
#pragma surface surf Lambert vertex:vert
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
float4 color : COLOR;
};
void vert(inout appdata_full v) {
v.normal.xyz = v.normal * -1;
}
void surf (Input IN, inout SurfaceOutput o) {
fixed3 result = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = result.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback "Diffuse"
}