浏览代码

Re-add sky support to volumetrics

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
189e75df
共有 2 个文件被更改,包括 20 次插入4 次删除
  1. 7
      ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/HDRenderPipelineResources.asset
  2. 17
      ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader

7
ScriptableRenderPipeline/HDRenderPipeline/RenderPipelineResources/HDRenderPipelineResources.asset


debugFullScreenShader: {fileID: 4800000, guid: e874aca2df8300a488258738c31f85cf,
type: 3}
deferredShader: {fileID: 4800000, guid: 00dd221e34a6ab349a1196b0f2fab693, type: 3}
screenSpaceAmbientOcclusionShader: {fileID: 4800000, guid: cf0db7f5267ad944dbf4326b7102c9ca,
type: 3}
combineLightingPass: {fileID: 4800000, guid: 2e37131331fbdca449b1a2bc47a639ca, type: 3}
type: 3}
volumetricLightingCS: {fileID: 7200000, guid: 799166e2ee6a4b041bba9e74f6942097,
type: 3}
gaussianPyramidCS: {fileID: 7200000, guid: 6dba4103d23a7904fbc49099355aff3e, type: 3}
depthPyramidCS: {fileID: 7200000, guid: 64a553bb564274041906f78ffba955e4, type: 3}

deferredComputeShader: {fileID: 7200000, guid: 0b64f79746d2daf4198eaf6eab9af259,
type: 3}
deferredDirectionalShadowComputeShader: {fileID: 7200000, guid: fbde6fae193b2a94e9fd97c163c204f4,
type: 3}
volumetricLightingCS: {fileID: 7200000, guid: 799166e2ee6a4b041bba9e74f6942097,
type: 3}
cameraMotionVectors: {fileID: 4800000, guid: 035941b63024d1943af48811c1db20d9, type: 3}
blitCubemap: {fileID: 4800000, guid: d05913e251bed7a4992c921c62e1b647, type: 3}

17
ScriptableRenderPipeline/HDRenderPipeline/Sky/HDRISky/Resources/SkyHDRI.shader


#pragma only_renderers d3d11 ps4 xboxone vulkan metal
#include "ShaderLibrary/Common.hlsl"
#include "../../../ShaderVariables.hlsl"
#include "ShaderLibrary/VolumeRendering.hlsl"
#ifdef VOLUMETRIC_LIGHTING_ENABLED
SamplerState s_linear_clamp_sampler;
TEXTURE3D(_VBufferLighting);
#endif
float4 _SkyParam; // x exposure, y multiplier, z rotation
float4x4 _PixelCoordToViewDirWS; // Actually just 3x3, but Unity can only set 4x4

dir = float3(dot(rotDirX, dir), dir.y, dot(rotDirY, dir));
float3 skyColor = ClampToFloat16Max(SAMPLE_TEXTURECUBE_LOD(_Cubemap, sampler_Cubemap, dir, 0).rgb * exp2(_SkyParam.x) * _SkyParam.y);
#ifdef VOLUMETRIC_LIGHTING_ENABLED
PositionInputs posInput = GetPositionInput(input.positionCS.xy, _ScreenSize.zw);
float4 volumetricLighting = GetInScatteredRadianceAndTransmittance(posInput.positionNDC,
_VBufferLighting,
s_linear_clamp_sampler,
_VBufferResolutionAndScale.zw);
skyColor *= volumetricLighting.a;
skyColor += volumetricLighting.rgb;
#endif
return float4(skyColor, 1.0);
}

正在加载...
取消
保存