public void SetupMaterials(CameraSkinScattering c)
 {
     if (Application.isPlaying && GetComponent <Renderer>() && _skin1stPassMaterials == null)
     {
         var count = GetComponent <Renderer>().sharedMaterials.Length;
         _skin1stPassMaterials  = new Material[count];
         _skin2ndPassMaterials  = new Material[count];
         _skinFallbackMaterials = new Material[count];
         _skinKeywordMaterials  = new Material[count];
         for (int q = 0; q < count; ++q)
         {
             _skin2ndPassMaterials[q] = GetComponent <Renderer>().sharedMaterials[q];
             SetParameters(_skin2ndPassMaterials[q]);
         }
         for (int q = 0; q < count; ++q)
         {
             _skin1stPassMaterials[q] = c.Create1stPassMaterial(_skin2ndPassMaterials[q], isEyes);
         }
         for (int q = 0; q < count; ++q)
         {
             _skinFallbackMaterials[q] = c.CreateFallbackMaterial(_skin2ndPassMaterials[q]);
         }
         for (int q = 0; q < count; ++q)
         {
             _skinKeywordMaterials[q] = c.CreateKeywordMaterial(_skin2ndPassMaterials[q]);
         }
     }
 }
    // Necessary to process Scene/Preview cameras in Editor
    void OnWillRenderObject()
    {
        CameraSkinScattering sssCamera = GameObject.FindObjectOfType(typeof(CameraSkinScattering)) as CameraSkinScattering;

        if (sssCamera)
        {
            sssCamera.EditorCameraOnPreRender(Camera.current);
        }
    }
예제 #3
0
 static CameraSkinScattering CacheSkinScattering()
 {
     if (cachedSkinScattering == null && Camera.main)
     {
         cachedSkinScattering = Camera.main.GetComponent(typeof(CameraSkinScattering)) as CameraSkinScattering;
     }
     if (cachedSkinScattering == null)
     {
         cachedSkinScattering = Object.FindObjectOfType(typeof(CameraSkinScattering)) as CameraSkinScattering;
     }
     return(cachedSkinScattering);
 }