浏览代码

Make SampleInScatteredRadianceAndTransmittance() return transmittance

/Yibing-Project-2
Evgenii Golubev 7 年前
当前提交
170a4fb7
共有 4 个文件被更改,包括 14 次插入11 次删除
  1. 2
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs
  2. 1
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs
  3. 4
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/VBuffer.hlsl
  4. 18
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/AtmosphericScattering/AtmosphericScattering.hlsl

2
ScriptableRenderPipeline/HDRenderPipeline/HDRP/HDRenderPipeline.cs


int viewId = hdCamera.camera.GetInstanceID(); // Warning: different views can use the same camera
// Warning: (resolutionChanged == false) is you open a new Editor tab of the same size!
// Warning: (resolutionChanged == false) if you open a new Editor tab of the same size!
if (m_VolumetricLightingPreset != VolumetricLightingPreset.Off)
ResizeVBuffer(viewId, texWidth, texHeight);

1
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/LightLoop.cs


// Set up clustered lighting for volumetrics.
cmd.SetGlobalBuffer(HDShaderIDs.g_vLightListGlobal, s_PerVoxelLightLists);
}
}
}

4
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/VBuffer.hlsl


}
}
// Returns interpolated {volumetric radiance, opacity}. The sampler clamps to edge.
// Returns interpolated {volumetric radiance, transmittance}. The sampler clamps to edge.
float4 SampleInScatteredRadianceAndTransmittance(TEXTURE3D_ARGS(VBufferLighting, trilinearSampler),
float2 positionNDC, float linearDepth,
float4 VBufferResolution,

#endif
// TODO: add some animated noise to the reconstructed radiance.
return float4(L.rgb, 1 - Transmittance(L.a));
return float4(L.rgb, Transmittance(L.a));
}
#endif // UNITY_VBUFFER_INCLUDED

18
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Sky/AtmosphericScattering/AtmosphericScattering.hlsl


// Returns fog color in rgb and fog factor in alpha.
float4 EvaluateAtmosphericScattering(PositionInputs posInput)
{
float3 fogColor = 0;
float fogFactor = 0;
return SampleInScatteredRadianceAndTransmittance(TEXTURE3D_PARAM(_VBufferLighting, s_trilinear_clamp_sampler),
posInput.positionNDC, posInput.linearDepth,
_VBufferResolution, _VBufferScaleAndSliceCount,
_VBufferDepthEncodingParams);
#endif
float4 volFog = SampleInScatteredRadianceAndTransmittance(TEXTURE3D_PARAM(_VBufferLighting, s_trilinear_clamp_sampler),
posInput.positionNDC, posInput.linearDepth,
_VBufferResolution, _VBufferScaleAndSliceCount,
_VBufferDepthEncodingParams);
fogColor = volFog.rgb;
fogFactor = 1 - volFog.a;
float3 fogColor; float fogFactor;
#else
if (_AtmosphericScatteringType == FOGTYPE_EXPONENTIAL)
{

}
else // NONE
{
return float4(0.0, 0.0, 0.0, 0.0);
#endif
return float4(fogColor, fogFactor);
}
正在加载...
取消
保存