浏览代码

Enable volumetric fog by default

/main
Evgenii Golubev 7 年前
当前提交
ad3d1e7c
共有 4 个文件被更改,包括 14 次插入19 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  2. 27
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.cs
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderConfig.cs
  4. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderConfig.cs.hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


m_SkyManager.RenderSky(hdCamera, m_LightLoop.GetCurrentSunLight(), m_CameraColorBuffer, m_CameraDepthStencilBuffer, m_CurrentDebugDisplaySettings, cmd);
if (visualEnv.fogType != FogType.None || m_VolumetricLightingSystem.preset != VolumetricLightingSystem.VolumetricLightingPreset.Off)
if (visualEnv.fogType != FogType.None)
m_SkyManager.RenderOpaqueAtmosphericScattering(cmd);
}

27
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/Volumetrics/VolumetricLighting.cs


public void ResizeVBuffer(HDCamera camera, int screenWidth, int screenHeight)
{
if (preset == VolumetricLightingPreset.Off) return;
var visualEnvironment = VolumeManager.instance.stack.GetComponent<VisualEnvironment>();
if (visualEnvironment == null || visualEnvironment.fogType != FogType.Volumetric) return;
long viewID = camera.GetViewID();

public void PushGlobalParams(HDCamera camera, CommandBuffer cmd)
{
if (preset == VolumetricLightingPreset.Off) return;
var visualEnvironment = VolumeManager.instance.stack.GetComponent<VisualEnvironment>();
if (visualEnvironment == null || visualEnvironment.fogType != FogType.Volumetric) return;
// Modify the near plane.
// Warning: it can screw up the reprojection. However, we have to do it in order for clustered lighting to work correctly.

DensityVolumeList densityVolumes = new DensityVolumeList();
if (preset == VolumetricLightingPreset.Off) return densityVolumes;
if (visualEnvironment.fogType != FogType.Volumetric) return densityVolumes;
if (visualEnvironment == null || visualEnvironment.fogType != FogType.Volumetric) return densityVolumes;
using (new ProfilingSample(cmd, "Prepare Visible Density Volume List"))
{

public void VolumeVoxelizationPass(DensityVolumeList densityVolumes, HDCamera camera, CommandBuffer cmd, FrameSettings settings)
{
if (preset == VolumetricLightingPreset.Off) return;
var visualEnvironment = VolumeManager.instance.stack.GetComponent<VisualEnvironment>();
if (visualEnvironment == null || visualEnvironment.fogType != FogType.Volumetric) return;
using (new ProfilingSample(cmd, "Volume Voxelization"))
{

{
// Clear the render target instead of running the shader.
// Note: the clear must take the global fog into account!
// Use the workaround by running the full shader with 0 density.
// Use the workaround by running the full shader with 0 density
}
VBuffer vBuffer = FindVBuffer(camera.GetViewID());

public void VolumetricLightingPass(HDCamera camera, CommandBuffer cmd, FrameSettings settings)
{
if (preset == VolumetricLightingPreset.Off) return;
var visualEnvironment = VolumeManager.instance.stack.GetComponent<VisualEnvironment>();
if (visualEnvironment == null || visualEnvironment.fogType != FogType.Volumetric) return;
var visualEnvironment = VolumeManager.instance.stack.GetComponent<VisualEnvironment>();
if (visualEnvironment.fogType != FogType.Volumetric)
{
// Clear the render target instead of running the shader.
// CoreUtils.SetRenderTarget(cmd, vBuffer.GetDensityBuffer(), ClearFlag.Color, CoreUtils.clearColorAllBlack);
// return;
// Clearing 3D textures does not seem to work!
// Use the workaround by running the full shader with 0 density.
}
VBuffer vBuffer = FindVBuffer(camera.GetViewID());
Debug.Assert(vBuffer != null);

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderConfig.cs


{
CameraRelativeRendering = 1, // Rendering sets the origin of the world to the position of the primary (scene view) camera
UseDisneySSS = 1, // Allow to chose between Burley Normalized Diffusion (Multi + Fix direction single scattering) or Jimenez diffusion approximation (Multiscattering only - More blurry) for Subsurface scattering
VolumetricLightingPreset = 0 // 0 = disabled, 1 = normal, 2 = ultra
VolumetricLightingPreset = 1 // 0 = disabled, 1 = normal, 2 = ultra
};
// Note: #define can't be use in include file in C# so we chose this way to configure both C# and hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/ShaderConfig.cs.hlsl


//
#define SHADEROPTIONS_CAMERA_RELATIVE_RENDERING (1)
#define SHADEROPTIONS_USE_DISNEY_SSS (1)
#define SHADEROPTIONS_VOLUMETRIC_LIGHTING_PRESET (0)
#define SHADEROPTIONS_VOLUMETRIC_LIGHTING_PRESET (1)
#endif
正在加载...
取消
保存