예제 #1
0
        public override void Create()
        {
            // WaterFX Pass
            m_WaterFxPass = new WaterFxPass {
                renderPassEvent = RenderPassEvent.BeforeRenderingOpaques
            };

            // Caustic Pass
            m_CausticsPass = new WaterCausticsPass();

            causticShader = causticShader ? causticShader : Shader.Find("Hidden/BoatAttack/Caustics");
            if (causticShader == null)
            {
                return;
            }
            if (_causticMaterial)
            {
                DestroyImmediate(_causticMaterial);
            }
            _causticMaterial = CoreUtils.CreateEngineMaterial(causticShader);
            _causticMaterial.SetFloat("_BlendDistance", settings.causticBlendDistance);

            if (causticTexture == null)
            {
                Debug.Log("Caustics Texture missing, attempting to load.");
#if UNITY_EDITOR
                causticTexture = UnityEditor.AssetDatabase.LoadAssetAtPath <Texture2D>("Packages/com.verasl.water-system/Textures/WaterSurface_single.tif");
#endif
            }
            _causticMaterial.SetTexture(CausticTexture, causticTexture);

            switch (settings.debug)
            {
            case WaterSystemSettings.DebugMode.Caustics:
                _causticMaterial.SetFloat(SrcBlend, 1f);
                _causticMaterial.SetFloat(DstBlend, 0f);
                _causticMaterial.EnableKeyword("_DEBUG");
                m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
                break;

            case WaterSystemSettings.DebugMode.WaterEffects:
                break;

            case WaterSystemSettings.DebugMode.Disabled:
                // Caustics
                _causticMaterial.SetFloat(SrcBlend, 2f);
                _causticMaterial.SetFloat(DstBlend, 0f);
                _causticMaterial.DisableKeyword("_DEBUG");
                m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1;
                // WaterEffects
                break;
            }

            _causticMaterial.SetFloat(Size, settings.causticScale);
            m_CausticsPass.WaterCausticMaterial = _causticMaterial;
        }
예제 #2
0
        public override void Create()
        {
            // WaterFX Pass
            m_WaterFxPass = new WaterFxPass {
                renderPassEvent = RenderPassEvent.BeforeRenderingOpaques
            };

            // Caustic Pass
            m_CausticsPass = new WaterCausticsPass();

            causticShader = causticShader ? causticShader : Shader.Find("Hidden/BoatAttack/Caustics");
            if (causticShader == null)
            {
                return;
            }
            if (_causticMaterial)
            {
                DestroyImmediate(_causticMaterial);
            }

            _causticMaterial = CoreUtils.CreateEngineMaterial(causticShader);
            _causticMaterial.SetFloat("_BlendDistance", settings.causticBlendDistance);

            switch (settings.debug)
            {
            case WaterSystemSettings.DebugMode.Caustics:
                _causticMaterial.SetFloat(SrcBlend, 1f);
                _causticMaterial.SetFloat(DstBlend, 0f);
                _causticMaterial.EnableKeyword("_DEBUG");
                m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingPostProcessing;
                break;

            case WaterSystemSettings.DebugMode.WaterEffects:
                break;

            case WaterSystemSettings.DebugMode.Disabled:
                // Caustics
                _causticMaterial.SetFloat(SrcBlend, 2f);
                _causticMaterial.SetFloat(DstBlend, 0f);
                _causticMaterial.DisableKeyword("_DEBUG");
                m_CausticsPass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox + 1;
                // WaterEffects
                break;
            }

            _causticMaterial.SetFloat(Size, settings.causticScale);
            m_CausticsPass.WaterCausticMaterial = _causticMaterial;
        }
예제 #3
0
 public override void Create()
 {
     m_WaterCausticsPass = new WaterCausticsPass();
     m_WaterCausticsPass.m_WaterCausticMaterial = settings.material;
 }