게임 그래픽 프로그래밍

셰이더: 무지개 얼굴

101won 2024. 9. 4. 22:41

위치가 색이야... 열라 멋지고 당연함..

 

Shader "Custom/holo"
{
	Properties
        {
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        }
	SubShader
    {
    Tags { "RenderType"="Transparent" "Queue"="Transparent" }

CGPROGRAM
    #pragma surface surf Lambert alpha:fade
    sampler2D _MainTex;

struct Input
    {
        float2 uv_MainTex;
        float3 viewDir;
        float3 worldPos;
    };

void surf (Input IN, inout SurfaceOutput o)
    {
        fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
        o.Emission = IN.worldPos;
        float ndotv = saturate(dot(o.Normal, IN.viewDir));
        float rim = pow(1 - ndotv, 3);
        o.Alpha = 1;
    }
ENDCG
}
FallBack "Diffuse"
}