Ejemplo n.º 1
0
        public static void SetupMaterialWithEnvMode(Material material, EnvReflection mode)
        {
            switch (mode)
            {
            case EnvReflection.Diffuse:
                material.EnableKeyword("DIFFUSE_ENV_MAP");
                material.DisableKeyword("SPECULAR_ENV_MAP");
                break;

            case EnvReflection.Specular:
                material.EnableKeyword("SPECULAR_ENV_MAP");
                material.DisableKeyword("DIFFUSE_ENV_MAP");
                break;

            case EnvReflection.All:
                material.EnableKeyword("DIFFUSE_ENV_MAP");
                material.EnableKeyword("SPECULAR_ENV_MAP");
                break;

            case EnvReflection.Off:
                material.DisableKeyword("DIFFUSE_ENV_MAP");
                material.DisableKeyword("SPECULAR_ENV_MAP");
                break;
            }

            if (brdfLUT == null)
            {
                var brdfPath = "Assets/SeinJSUnityToolkit/Shaders/brdfLUT.jpg";
                var e        = File.Exists(brdfPath);
                brdfLUT = AssetDatabase.LoadAssetAtPath <Texture2D>(brdfPath);
            }
            material.SetTexture("_brdfLUT", brdfLUT);
        }
        public static void SetupMaterialWithEnvMode(Material material, EnvReflection mode)
        {
            switch (mode)
            {
            case EnvReflection.On:
                material.EnableKeyword("ENV_SPECULAR_ON");
                break;

            case EnvReflection.Off:
                material.DisableKeyword("ENV_SPECULAR_ON");
                break;
            }
        }