2023. 1. 16. 21:41
Unity/shader
Shader "Skybox/Sample"
{
Properties
{
[NoScaleOffset] _Tex ("Cubemap (HDR)", Cube) = "grey" {}
}
SubShader
{
Tags { "Queue"="Background" "RenderType"="Background" "PreviewType"="Skybox" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float3 texcoord : TEXCOORD0;
UNITY_VERTEX_OUTPUT_STEREO
};
samplerCUBE _Tex;
half4 _Tex_HDR;
v2f vert (appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.vertex.xyz;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
half4 tex = texCUBE (_Tex, i.texcoord);
fixed3 col = DecodeHDR (tex, _Tex_HDR);
return half4(col, 1);
}
ENDCG
}
}
}
샘플코드
'Unity > shader' 카테고리의 다른 글
스크린 오버레이 샘플 (0) | 2023.01.20 |
---|---|
함수 그래프 모음 (0) | 2022.01.15 |
Decal Shader (0) | 2022.01.13 |