浏览代码

Update comments and store the value of the integral of the image

/main
Evgenii Golubev 8 年前
当前提交
5f0870cc
共有 2 个文件被更改,包括 16 次插入11 次删除
  1. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs
  2. 26
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/BuildProbabilityTables.compute

1
Assets/ScriptableRenderLoop/HDRenderLoop/Material/Lit/Lit.cs


m_LtcGGXMatrix = LoadLUT(TextureFormat.RGBAHalf, s_LtcGGXMatrixData);
m_LtcDisneyDiffuseMatrix = LoadLUT(TextureFormat.RGBAHalf, s_LtcDisneyDiffuseMatrixData);
// TODO: switch to RGBA64 when it becomes available.
m_LtcMultiGGXFresnelDisneyDiffuse = LoadLUT(TextureFormat.RGBAHalf, s_LtcGGXMagnitudeData,
s_LtcGGXFresnelData,
s_LtcDisneyDiffuseMagnitudeData);

26
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/BuildProbabilityTables.compute


/* --- Input --- */
#define textureSize 128 // TODO: make this dynamic
#define textureSize 128 // The size of the MIP level 1 of the input texture
TEXTURE2D(EnvMap) // Cubemap face
TEXTURE2D(EnvMap) // Cubemap face (s.t. MIP 1: [textureSize x textureSize])
RWTexture2D<float> marginalRowDensities; // One column per face
RWTexture2D<float> conditionalDensities; // Cubemap face
RWTexture2D<float> marginalRowDensities; // One row per face: [textureSize x 8]
RWTexture2D<float> conditionalDensities; // Cubemap face: [textureSize x textureSize]
/* --- Shared --- */

uint groupIndex : SV_GroupIndex)
{
// A single thread group processes a row of 'textureSize' texels.
int j = groupThreadId.y;
const int j = groupThreadId.y;
float temp[textureSize];
/* HUGE */ float temp[textureSize];
// Compute the integral of the step function.
float rowIntegralValue = 0.0;

float imgIntegralValue = 0.0;
// TODO: run in parallel.
for (j = 0; j < textureSize; j++)
for (i = 0; i < textureSize; i++)
temp[j] = imgIntegralValue;
temp[i] = imgIntegralValue;
imgIntegralValue += rowIntegralValues[j] / textureSize;
imgIntegralValue += rowIntegralValues[i] / textureSize;
for (j = 0; j < textureSize; j++)
for (i = 0; i < textureSize; i++)
marginalRowDensities[int2(cubeFaceId, j)] = temp[j] / imgIntegralValue;
marginalRowDensities[int2(i, cubeFaceId)] = temp[i] / imgIntegralValue;
// Store the value of the integral of the entire image.
// TODO: find a better place for this.
marginalRowDensities[int2(0, 6)] = imgIntegralValue;
}
}
正在加载...
取消
保存