LoginSignup
2
4

More than 5 years have passed since last update.

Unity でShaderの勉強 その8 Point Lightを取り込む

Posted at

正しいアクセスの仕方なのかはわからないけど
unity_LightColor[0]でライトにアクセスできた

Shader "Custom/TestShader" {
    Properties {
        _MainColor("MainColor",Color) = (1,1,1,1)
    }

    SubShader {
        Tags {"LightMode" = "ForwardBase"}
        Pass {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            uniform float4 _MainColor;

            struct v2f {
                float4 wPos : SV_POSITION;
            };


            v2f vert(float4 pos : POSITION) {
                v2f output;
                output.wPos = mul(UNITY_MATRIX_MVP,pos);
                return output;
            }

            float4 frag(v2f input) : SV_TARGET {
                return _MainColor + (unity_LightColor[0]);
            }
            ENDCG
        }
    }
}
2
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
4