Exemple #1
0
        public override void Cleanup()
        {
            Utilities.Destroy(m_InitPreFGD);

            // TODO: how to delete RenderTexture ? or do we need to do it ?
            m_isInit = false;
        }
        public void Cleanup()
        {
            Utilities.Destroy(m_StandardSkyboxMaterial);
            Utilities.Destroy(m_SkyboxCubemapRT);
            Utilities.Destroy(m_SkyboxGGXCubemapRT);
            Utilities.Destroy(m_SkyboxMarginalRowCdfRT);
            Utilities.Destroy(m_SkyboxConditionalCdfRT);

            if (m_Renderer != null)
            {
                m_Renderer.Cleanup();
            }
        }
Exemple #3
0
        void OnDisable()
        {
            Utilities.Destroy(m_EyeAdaptationMaterial);
            Utilities.Destroy(m_FinalPassMaterial);

            foreach (var rt in m_AutoExposurePool)
            {
                Utilities.Destroy(rt);
            }

            Utilities.Destroy(m_DebugHistogram);
            Utilities.SafeRelease(m_HistogramBuffer);
        }
Exemple #4
0
        public override void Dispose()
        {
            base.Dispose();

            if (m_LightLoop != null)
            {
                m_LightLoop.Cleanup();
            }

            m_LitRenderLoop.Cleanup();

            Utilities.Destroy(m_DebugViewMaterialGBuffer);
            Utilities.Destroy(m_DebugDisplayShadowMap);

            m_SkyManager.Cleanup();

#if UNITY_EDITOR
            SupportedRenderingFeatures.active = SupportedRenderingFeatures.Default;
#endif
        }
Exemple #5
0
 public override void Cleanup()
 {
     Utilities.Destroy(m_SkyHDRIMaterial);
 }
        void RebuildTextures(SkySettings skySettings)
        {
            int resolution = 256;

            // Parameters not set yet. We need them for the resolution.
            if (skySettings != null)
            {
                resolution = (int)skySettings.resolution;
            }

            if ((m_SkyboxCubemapRT != null) && (m_SkyboxCubemapRT.width != resolution))
            {
                Utilities.Destroy(m_SkyboxCubemapRT);
                Utilities.Destroy(m_SkyboxGGXCubemapRT);
                Utilities.Destroy(m_SkyboxMarginalRowCdfRT);
                Utilities.Destroy(m_SkyboxConditionalCdfRT);

                m_SkyboxCubemapRT        = null;
                m_SkyboxGGXCubemapRT     = null;
                m_SkyboxMarginalRowCdfRT = null;
                m_SkyboxConditionalCdfRT = null;
            }

            if (m_SkyboxCubemapRT == null)
            {
                m_SkyboxCubemapRT                  = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
                m_SkyboxCubemapRT.dimension        = TextureDimension.Cube;
                m_SkyboxCubemapRT.useMipMap        = true;
                m_SkyboxCubemapRT.autoGenerateMips = false; // We will generate regular mipmap for filtered importance sampling manually
                m_SkyboxCubemapRT.filterMode       = FilterMode.Trilinear;
                m_SkyboxCubemapRT.Create();

                m_SkyboxGGXCubemapRT                  = new RenderTexture(resolution, resolution, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
                m_SkyboxGGXCubemapRT.dimension        = TextureDimension.Cube;
                m_SkyboxGGXCubemapRT.useMipMap        = true;
                m_SkyboxGGXCubemapRT.autoGenerateMips = false;
                m_SkyboxGGXCubemapRT.filterMode       = FilterMode.Trilinear;
                m_SkyboxGGXCubemapRT.Create();

                if (m_useMIS)
                {
                    int width  = (int)LightSamplingParameters.TextureWidth;
                    int height = (int)LightSamplingParameters.TextureHeight;

                    // + 1 because we store the value of the integral of the cubemap at the end of the texture.
                    m_SkyboxMarginalRowCdfRT                   = new RenderTexture(height + 1, 1, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
                    m_SkyboxMarginalRowCdfRT.useMipMap         = false;
                    m_SkyboxMarginalRowCdfRT.autoGenerateMips  = false;
                    m_SkyboxMarginalRowCdfRT.enableRandomWrite = true;
                    m_SkyboxMarginalRowCdfRT.filterMode        = FilterMode.Point;
                    m_SkyboxMarginalRowCdfRT.Create();

                    // TODO: switch the format to R16 (once it's available) to save some bandwidth.
                    m_SkyboxConditionalCdfRT                   = new RenderTexture(width, height, 0, RenderTextureFormat.RFloat, RenderTextureReadWrite.Linear);
                    m_SkyboxConditionalCdfRT.useMipMap         = false;
                    m_SkyboxConditionalCdfRT.autoGenerateMips  = false;
                    m_SkyboxConditionalCdfRT.enableRandomWrite = true;
                    m_SkyboxConditionalCdfRT.filterMode        = FilterMode.Point;
                    m_SkyboxConditionalCdfRT.Create();
                }

                m_UpdatedFramesRequired = 2; // Special case. Even if update mode is set to OnDemand, we need to regenerate the environment after destroying the texture.
            }

            m_CubemapScreenSize = new Vector4((float)resolution, (float)resolution, 1.0f / (float)resolution, 1.0f / (float)resolution);
        }
 public void Cleanup()
 {
     Utilities.Destroy(m_Material);
 }
Exemple #8
0
 public override void Cleanup()
 {
     Utilities.Destroy(m_ProceduralSkyMaterial);
 }