Beispiel #1
0
    //RenderTexture iterativeRT1;
    //RenderTexture iterativeRT2;

    // Use this for initialization
    void Awake()
    {
        lightSystem = FindObjectOfType <LightSystem> ();
        if (lightSystem == null)
        {
            throw new UnityException("Scene missing LightSystem");
        }

        if (!GetComponent <Camera> ())
        {
            throw new UnityException("Ambient Light Script should be attached to ambient obstacle camera");
        }

        lightAmbientRT         = lightSystem.GetAmbientRT();
        lightAmbientObstacleRT = lightSystem.GetLightAmbientObstacleRT();

        /*iterativeRT1 = new RenderTexture (lightAmbientRT.width, lightAmbientRT.height, lightAmbientRT.depth);
         * iterativeRT1.Create ();
         * iterativeRT2 = new RenderTexture (lightAmbientRT.width, lightAmbientRT.height, lightAmbientRT.depth);
         * iterativeRT2.Create ();*/

        ambientLightMaterial = new Material(Shader.Find("Lighting/AmbientLight"));
        ambientLightMaterial.SetTexture("_ObstacleTex", lightAmbientObstacleRT);
        //ambientLightMaterial.SetColor ("_AmbientColor", ambientColor);
        ambientLightMaterial.SetFloat("_ObstacleMul", obstacleMul);
        ambientLightMaterial.SetFloat("_SamplingDist", samplingDist);
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        lightSystem = FindObjectOfType <LightSystem> ();
        if (lightSystem == null)
        {
            throw new UnityException("Scene missing light system gameobject");
        }

        blitMaterial = new Material(Shader.Find("Lighting/Mixer"));
        blitMaterial.SetTexture("_LightTex", lightSystem.GetLightSourceRT());
        blitMaterial.SetTexture("_AmbientLightTex", lightSystem.GetAmbientRT());
        blitMaterial.SetFloat("_Scale", lightSystem.lightCameraOverlap);
    }