浏览代码

Use GenerateLightCullDataIndex to properly index bounds/volumes

Fetching raw light indices from the coarse list, and running them through GenerateLightCullDataIndex to get stereo eye dependent light culling data.
/main
Robert Srinivasiah 7 年前
当前提交
4b9402f6
共有 1 个文件被更改,包括 14 次插入11 次删除
  1. 25
      ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute

25
ScriptableRenderPipeline/HDRenderPipeline/HDRP/Lighting/LightLoop/lightlistbuild-clustered.compute


// XRTODO - DONE: Stereo-ize CheckIntersection by passing in eyeIndex to GetViewPosFromLinDepth
if(offs<(start+iSpaceAvail) && i<nrClusters && CheckIntersection(l, i, viTilLL.xy, viTilUR.xy, suggestedBase, eyeIndex) )
{
// XRTODO: Stereo-ize index into _LightVolumeData, run coarseList[l] thru GenerateLightCullDataIndex
uint lightCategory = _LightVolumeData[coarseList[l]].lightCategory;
// XRTODO - DONE: Stereo-ize index into _LightVolumeData, run coarseList[l] thru GenerateLightCullDataIndex
const int lightVolIndex = GenerateLightCullDataIndex(coarseList[l], g_iNrVisibLights, eyeIndex);
uint lightCategory = _LightVolumeData[lightVolIndex].lightCategory;
++categoryListCount[lightCategory];
g_vLayeredLightList[offs++] = coarseList[l] - shiftIndex[lightCategory]; // reflection lights will be last since we sorted

// Pass in eyeIndex
float4 FetchPlane(int l, int p, uint eyeIndex)
{
// XRTODO: Use eyeIndex and coarseList[l] to index into g_data
// XRTODO - DONE: Use eyeIndex and coarseList[l] to index into g_data
SFiniteLightBound lgtDat = g_data[coarseList[l]];
const int lightBoundIndex = GenerateLightCullDataIndex(coarseList[l], g_iNrVisibLights, eyeIndex);
SFiniteLightBound lgtDat = g_data[lightBoundIndex];
const float3 boxX = lgtDat.boxAxisX.xyz;
const float3 boxY = lgtDat.boxAxisY.xyz;

for(int l=threadID; l<iNrCoarseLights; l+=NR_THREADS)
{
// XRTODO: Stereo-ize access with eyeIndex and GenerateLightCullDataIndex
// XRTODO - DONE: Stereo-ize access with eyeIndex and GenerateLightCullDataIndex
SFiniteLightBound lgtDat = g_data[coarseList[l]];
const int lightBoundIndex = GenerateLightCullDataIndex(coarseList[l], g_iNrVisibLights, eyeIndex);
SFiniteLightBound lgtDat = g_data[lightBoundIndex];
if( !DoesSphereOverlapTile(V, halfTileSizeAtZDistOne, lgtDat.center.xyz, lgtDat.radius, g_isOrthographic!=0) )
coarseList[l]=UINT_MAX;

#if !defined(SHADER_API_XBOXONE) && !defined(SHADER_API_PSSL)
GroupMemoryBarrierWithGroupSync();
#endif
// XRTODO: stereo-ize index used to access _LightVolumeData (and g_data), use GenerateLightCullDataIndex and eyeIndex
const int idxCoarse = coarseList[l];
UNITY_BRANCH if (_LightVolumeData[idxCoarse].lightVolume != LIGHTVOLUMETYPE_SPHERE) // don't bother doing edge tests for sphere lights since these have camera aligned bboxes.
// XRTODO - DONE: stereo-ize index used to access _LightVolumeData (and g_data), use GenerateLightCullDataIndex and eyeIndex
const int lightCullIndex = GenerateLightCullDataIndex(coarseList[l], g_iNrVisibLights, eyeIndex);
UNITY_BRANCH if (_LightVolumeData[lightCullIndex].lightVolume != LIGHTVOLUMETYPE_SPHERE) // don't bother doing edge tests for sphere lights since these have camera aligned bboxes.
// XRTODO: stereo-ize index used to access g_data, use the same index generated above from idxCoarse
SFiniteLightBound lgtDat = g_data[idxCoarse];
// XRTODO - DONE: stereo-ize index used to access g_data, use the same index generated above from idxCoarse
SFiniteLightBound lgtDat = g_data[lightCullIndex];
const float3 boxX = lgtDat.boxAxisX.xyz;
const float3 boxY = lgtDat.boxAxisY.xyz;

正在加载...
取消
保存