【发布时间】:2018-07-06 14:38:17
【问题描述】:
我正在尝试制作 360 度渲染纹理。在游戏模式下,一个 Shephere 模型向我们展示了渲染的内容。我不想录视频。只需像 2d 渲染纹理一样显示。
我正在使用这个着色器:
Shader “Unlit/Pano360Shader”
{
Properties
{
_MainTex (“Base (RGB)”, 2D) = “white” {}
_Color (“Main Color”, Color) = (1,1,1,0.5)
}
SubShader
{
Tags { “RenderType” = “Opaque” }
//This is used to print the texture inside of the sphere
Cull Front
CGPROGRAM
#pragma surface surf SimpleLambert
half4 LightingSimpleLambert (SurfaceOutput s, half3 lightDir, half atten)
{
half4 c;
c.rgb = s.Albedo;
return c;
}
sampler2D _MainTex;
struct Input
{
float2 uv_MainTex;
float4 myColor : COLOR;
};
fixed3 _Color;
void surf (Input IN, inout SurfaceOutput o)
{
//This is used to mirror the image correctly when printing it inside of the sphere
IN.uv_MainTex.x = 1 — IN.uv_MainTex.x;
fixed3 result = tex2D(_MainTex, IN.uv_MainTex)*_Color;
o.Albedo = result.rgb;
o.Alpha = 1;
}
ENDCG
}
Fallback “Diffuse”
}
它正在工作,但它只显示照片。当我尝试渲染纹理时,它没有显示任何内容。 如何在 Unity 中创建 360 度渲染纹理?
【问题讨论】:
标签: c# unity3d shader virtual-reality