Ejemplo n.º 1
0
    void Update()
    {
        Shader.SetGlobalVector("preview_LightPos", _pointLight1.transform.position);
        Shader.SetGlobalColor("preview_LightColor", _pointLight1.color);
        Shader.SetGlobalFloat("preview_LightGloss", _gloss);

        Shader.SetGlobalVector("preview_LightPos2", _pointLight2.transform.position);
        Shader.SetGlobalColor("preview_LightColor2", _pointLight2.color);
        Shader.SetGlobalFloat("preview_LightGloss2", _gloss);

        Shader.SetGlobalColor("preview_AmbientColor", _ambient);

        if (_shadowEnable)
        {
            Matrix4x4 shadowmatrix = ShadowRenderer.UpdateShadowMatrix(_shadowPlane.up, _shadowPlane.position.y, _shadowLight.position, 1.0f);
            Shader.SetGlobalMatrix("preview_shadowmat", shadowmatrix);
            Shader.SetGlobalColor("preview_shadowcolor", _shadowColor);
        }
    }
Ejemplo n.º 2
0
    public void UpdateShadowMatrix(Vector3 lightDir, float pointLight, Vector4 shadowRange)
    {
        Matrix4x4 shadowMatrix = ShadowRenderer.UpdateShadowMatrix(Vector3.up, -_thisTransform.position.y, lightDir, pointLight);

        _materialInst.SetShadowMatrix(shadowMatrix, shadowRange);
    }