浏览代码

Merge pull request #1236 from Unity-Technologies/Fix-sky-in-preview-and-fog-in-sceneView

Fix sky in preview and fog in sceneView
/main
GitHub 7 年前
当前提交
50c728b8
共有 4 个文件被更改,包括 50 次插入7 次删除
  1. 30
      ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/CHANGELOG.md
  3. 3
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs
  4. 22
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkyManager.cs

30
ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs


{
string msg = "AR/VR devices are not supported, no rendering will occur";
DisplayUnsupportedMessage(msg);
}
}
// Returns 'true' if "Animated Materials" are enabled for the view associated with the given camera.
public static bool AreAnimatedMaterialsEnabled(Camera camera)

}
}
}
// TODO: how to handle reflection views? We don't know the parent window they are being rendered into,
// so we don't know whether we can animate them...
//

#endif
return animateMaterials;
}
public static bool IsSceneViewFogEnabled(Camera camera)
{
bool fogEnable = true;
#if UNITY_EDITOR
fogEnable = Application.isPlaying;
if (camera.cameraType == CameraType.SceneView)
{
fogEnable = false;
// Determine whether the "Animated Materials" checkbox is checked for the current view.
foreach (UnityEditor.SceneView sv in Resources.FindObjectsOfTypeAll(typeof(UnityEditor.SceneView)))
{
if (sv.camera == camera && sv.sceneViewState.showFog)
{
fogEnable = true;
break;
}
}
}
#endif
return fogEnable;
}
}
}

2
ScriptableRenderPipeline/HDRenderPipeline/CHANGELOG.md


-
### Bug fixes
- Fix fog flags in scene view is now taken into account
- Fix sky in preview windows that were disappearing after a load of a new level
- Fix numerical issues in IntersectRayAABB().
- Fix alpha blending of volumetric lighting with transparent objects.
- Fix the near plane of the V-Buffer causing out-of-bounds look-ups in the clustered data structure.

3
ScriptableRenderPipeline/HDRenderPipeline/HDRP/RenderPipeline/FrameSettings.cs


aggregate.enableObjectMotionVectors = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableObjectMotionVectors && renderPipelineSettings.supportMotionVectors;
aggregate.enableDBuffer = srcFrameSettings.enableDBuffer && renderPipelineSettings.supportDBuffer;
aggregate.enableAtmosphericScattering = srcFrameSettings.enableAtmosphericScattering;
// We must take care of the scene view fog flags in the editor
if (!CoreUtils.IsSceneViewFogEnabled(camera))
aggregate.enableAtmosphericScattering = false;
aggregate.enableRoughRefraction = srcFrameSettings.enableRoughRefraction;
aggregate.enableTransparentPostpass = srcFrameSettings.enableTransparentPostpass;
aggregate.enableDistortion = camera.cameraType != CameraType.Reflection && srcFrameSettings.enableDistortion;

22
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/SkyManager.cs


#if UNITY_EDITOR
if (camera.camera.cameraType == CameraType.Preview)
{
m_VisualSky.skySettings = m_DefaultPreviewSky;
m_VisualSky.skySettings = GetDefaultPreviewSkyInstance();
}
#endif

cmd.SetGlobalFloat(HDShaderIDs._SkyTextureMipCount, mipCount);
}
#if UNITY_EDITOR
ProceduralSky GetDefaultPreviewSkyInstance()
{
if (m_DefaultPreviewSky == null)
{
m_DefaultPreviewSky = ScriptableObject.CreateInstance<ProceduralSky>();
}
return m_DefaultPreviewSky;
}
#endif
public void Build(HDRenderPipelineAsset hdAsset, IBLFilterGGX iblFilterGGX)
{
m_BakingSkyRenderingContext = new SkyRenderingContext(iblFilterGGX, (int)hdAsset.renderPipelineSettings.lightLoopSettings.skyReflectionSize, false);

m_LightingOverrideVolumeStack = VolumeManager.instance.CreateStack();
m_LightingOverrideLayerMask = hdAsset.renderPipelineSettings.lightLoopSettings.skyLightingOverrideLayerMask;
#if UNITY_EDITOR
m_DefaultPreviewSky = ScriptableObject.CreateInstance<ProceduralSky>();
#endif
#if UNITY_EDITOR
CoreUtils.Destroy(m_DefaultPreviewSky);
#endif
CoreUtils.Destroy(m_StandardSkyboxMaterial);
CoreUtils.Destroy(m_BlitCubemapMaterial);
CoreUtils.Destroy(m_OpaqueAtmScatteringMaterial);

正在加载...
取消
保存