public void Cleanup()
        {
            Reset();

            if (renderer != null)
            {
                renderer.Cleanup();
                renderer = null;
            }
            if (renderingContext != null)
            {
                renderingContext.Cleanup();
                renderingContext = null;
            }
        }
Exemple #2
0
        public void Build(HDRenderPipelineAsset hdAsset, RenderPipelineResources defaultResources, IBLFilterBSDF[] iblFilterBSDFArray)
        {
            m_SkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, true);
#if UNITY_EDITOR
            m_PreviewSkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, true);
#endif

            m_StandardSkyboxMaterial      = CoreUtils.CreateEngineMaterial(defaultResources.shaders.skyboxCubemapPS);
            m_BlitCubemapMaterial         = CoreUtils.CreateEngineMaterial(defaultResources.shaders.blitCubemapPS);
            m_OpaqueAtmScatteringMaterial = CoreUtils.CreateEngineMaterial(defaultResources.shaders.opaqueAtmosphericScatteringPS);

            m_OpaqueAtmScatteringBlock = new MaterialPropertyBlock();

            m_LightingOverrideVolumeStack       = VolumeManager.instance.CreateStack();
            m_LightingOverrideLayerMask         = hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask;
            m_StaticLightingSkyRenderingContext = new SkyRenderingContext(iblFilterBSDFArray, (int)hdAsset.currentPlatformRenderPipelineSettings.lightLoopSettings.skyReflectionSize, false);
        }
Exemple #3
0
        public void UpdateCurrentSkySettings(HDCamera hdCamera)
        {
#if UNITY_EDITOR
            if (HDUtils.IsRegularPreviewCamera(hdCamera.camera))
            {
                m_PreviewSky.skySettings     = GetDefaultPreviewSkyInstance();
                m_CurrentSky                 = m_PreviewSky;
                m_CurrentSkyRenderingContext = m_PreviewSkyRenderingContext;
            }
            else
#endif
            {
                m_VisualSky.skySettings      = GetSkySetting(VolumeManager.instance.stack);
                m_CurrentSky                 = m_VisualSky;
                m_CurrentSkyRenderingContext = m_SkyRenderingContext;
            }

            // Update needs to happen before testing if the component is active other internal data structure are not properly updated yet.
            VolumeManager.instance.Update(m_LightingOverrideVolumeStack, hdCamera.volumeAnchor, m_LightingOverrideLayerMask);
            if (VolumeManager.instance.IsComponentActiveInMask <VisualEnvironment>(m_LightingOverrideLayerMask))
            {
                SkySettings newSkyOverride = GetSkySetting(m_LightingOverrideVolumeStack);
                if (m_LightingOverrideSky.skySettings != null && newSkyOverride == null)
                {
                    // When we switch from override to no override, we need to make sure that the visual sky will actually be properly re-rendered.
                    // Resetting the visual sky hash will ensure that.
                    m_VisualSky.skyParametersHash = -1;
                }
                m_LightingOverrideSky.skySettings = newSkyOverride;
                m_CurrentSky = m_LightingOverrideSky;
            }
            else
            {
                m_LightingOverrideSky.skySettings = null;
            }
        }