Hi,
I wanted to draw skydome but doesn’t want to scale it too big which will need to increase camera far plane value.
Hence, using the shader tag “Queue” = “Background”.
I use Unity build-in shader, Unlit, add ZWrite=Off, and change queue tag.
This shader works in 3.5.6
However now I would like to use it in Unity 4.0.0f7
The shader is not working anymore. It doesn’t draw as background.
So, I thought might be Unity shader has change. I downloaded Unity4 shader and create it, but the result is still fail.
I use Diffuse CGPROGRAM with those Zwrite and Queue, and the result is working. But I would like to Unlit the skydome.
Anyone can help?
This work in Unity 3.5.6
Shader "Custom/Unlit-Background" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Background" }
ZWrite Off
Pass {
Lighting Off
SetTexture [_MainTex] { combine texture }
}
}
}
Diffuse render in background
Shader "Diffuse-Background" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "Queue"="Background" }
ZWrite Off
LOD 200
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "VertexLit"
}
Another experiment with vert/frag
Shader "Custom/Test" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" { }
}
SubShader {
Tags {"Queue" = "Background" }
ZWrite Off
Lighting Off
LOD 200
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
sampler2D _MainTex;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
};
float4 _MainTex_ST;
v2f vert (appdata_base v)
{
v2f o;
o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
o.uv = TRANSFORM_TEX (v.texcoord, _MainTex);
return o;
}
half4 frag (v2f i) : COLOR
{
return tex2D (_MainTex, i.uv);
}
ENDCG
}
}
}