浏览代码

Clean up

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
766db928
共有 4 个文件被更改,包括 9 次插入9 次删除
  1. 6
      ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl
  2. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Deferred.shader
  3. 2
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Deferred.compute
  4. 8
      ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute

6
ScriptableRenderPipeline/Core/ShaderLibrary/VolumeRendering.hlsl


#endif
float4 GetInScatteredRadianceAndTransmittance(float2 positionSS, float depthVS,
TEXTURE3D(VBufferLighting), SAMPLER3D(sampler_LinearXY_PointZ_Clamp),
TEXTURE3D(VBufferLighting), SAMPLER3D(linearClampSampler),
float4 VBufferDepthEncodingParams, float2 VBufferScale)
{
int n = VBUFFER_SLICE_COUNT;

float2 uv = positionSS * VBufferScale;
// Perform 2 bilinear taps. The sampler should clamp the values at the boundaries of the 3D texture.
float4 v0 = SAMPLE_TEXTURE3D_LOD(VBufferLighting, sampler_LinearXY_PointZ_Clamp, float3(uv, d0), 0);
float4 v1 = SAMPLE_TEXTURE3D_LOD(VBufferLighting, sampler_LinearXY_PointZ_Clamp, float3(uv, d1), 0);
float4 v0 = SAMPLE_TEXTURE3D_LOD(VBufferLighting, linearClampSampler, float3(uv, d0), 0);
float4 v1 = SAMPLE_TEXTURE3D_LOD(VBufferLighting, linearClampSampler, float3(uv, d1), 0);
float4 vt = lerp(v0, v1, saturate((z - z0) / (z1 - z0)));
return float4(vt.rgb, Transmittance(vt.a));

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Deferred.shader


float4 volumetricLighting = GetInScatteredRadianceAndTransmittance(posInput.positionSS,
posInput.depthVS,
_VBufferLighting,
s_linear_clamp_sampler, // TODO: use the right sampler
s_linear_clamp_sampler,
_VBufferDepthEncodingParams,
_VBufferResolutionAndScale.zw);
diffuseLighting *= volumetricLighting.a;

2
ScriptableRenderPipeline/HDRenderPipeline/Lighting/TilePass/Deferred.compute


float4 volumetricLighting = GetInScatteredRadianceAndTransmittance(posInput.positionSS,
posInput.depthVS,
_VBufferLighting,
s_linear_clamp_sampler, // TODO: use the right sampler
s_linear_clamp_sampler,
_VBufferDepthEncodingParams,
_VBufferResolutionAndScale.zw);
diffuseLighting *= volumetricLighting.a;

8
ScriptableRenderPipeline/HDRenderPipeline/Lighting/Volumetrics/Resources/VolumetricLighting.compute


float4 depthParams = _VBufferDepthEncodingParams;
float z0 = depthParams.x; // View space Z coordinate of the near plane
float t0 = z0 * cameraRay.ratioLenToZ; // Distance to the near plane
float t0 = cameraRay.ratioLenToZ * z0; // Distance to the near plane
float de = rcp(VBUFFER_SLICE_COUNT); // Log-encoded distance between slices
float3 totalRadiance = 0;

{
float e1 = s * de + de; // (s + 1) / sliceCount
float z1 = DecodeLogarithmicDepth(e1, depthParams);
float t1 = z1 * cameraRay.ratioLenToZ;
float t1 = cameraRay.ratioLenToZ * z1;
float z = t * cameraRay.ratioZtoLen;
float z = cameraRay.ratioZtoLen * t;
float3 positionWS = cameraRay.originWS + t * cameraRay.directionWS;
// Get volume properties at 't'.

intensity *= lerp(1, shadow, lightData.shadowDimmer);
}
// Projector lights always have a cookies, so we can perform clipping inside the if().
// Projector lights always have cookies, so we can perform clipping inside the if().
[branch] if (lightData.cookieIndex >= 0)
{
float4 cookie = EvaluateCookie_Punctual(context, lightData, lightToSample);

正在加载...
取消
保存