본문 바로가기

유니티/수업 내용

Shader Warning

Shader "Custom/MyShader"
{
    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _Brightness ("Change Brightness!!", Range(0, 1)) = 0.5
        _TestFloat ("Test Float", Float) = 0.5
        _TestColor ("Test Color", Color) = (1,1,1,1)
        _TestVector ("Test Vector", Vector) = (1,1,1,1)
        _TestTexture ("Test Texture", 2D) = "white" {}
    }
    SubShader
    {
        //불투명
        Tags { "RenderType"="Opaque" }

        CGPROGRAM
        
        #pragma surface surf Standard

        struct Input
        {
            float2 uv_TestTexture;
        };

        fixed4 _Color;
        sampler2D _TestTexture;
        float _Brightness;

        void surf (Input IN, inout SurfaceOutputStandard o)
        {
            float3 red = float3(1,0,0);
            //float4 textureColor = tex2D(_TestTexture, IN.uv_TestTexture);
            //o.Emission = float3(-1,0,0);
            //red.r = 1 = (1,1,1) = red.rrr = 흰색
            o.Albedo = float3(-1,1,0);
            o.Alpha = 1;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Albedo = float3(r,b,g) r,b,g에 음수를 하나라도 넣으면 뜨는 경고