浏览代码

Clean up

/main
Evgenii Golubev 8 年前
当前提交
9ec4d867
共有 7 个文件被更改,包括 33 次插入26 次删除
  1. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/BuildProbabilityTables.compute
  2. 4
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/GGXConvolve.shader
  3. 1
      Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs
  4. 32
      Assets/ScriptableRenderLoop/ShaderLibrary/Fibonacci.hlsl
  5. 11
      Assets/ScriptableRenderLoop/ShaderLibrary/Hammersley.hlsl
  6. 5
      Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl
  7. 2
      ProjectSettings/ProjectVersion.txt

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


int cubeFaceId; // Cubemap face index
TEXTURE2D(EnvMap) // Cubemap face (s.t. MIP 1: [textureSize x textureSize])
TEXTURE2D(envMap) // Cubemap face (s.t. MIP 1: [textureSize x textureSize])
/* --- Output --- */

// We use MIP level 1 to account for interpolation during light sampling.
// Ref: PBRT v3, page 847.
float3 color = LOAD_TEXTURE2D_LOD(EnvMap, int2(i, j), 1).rgb;
float3 color = LOAD_TEXTURE2D_LOD(envMap, int2(i, j), 1).rgb;
float intensity = color.r + color.g + color.b;
rowIntegralValue += intensity / textureSize;

4
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/Resources/GGXConvolve.shader


TEXTURECUBE(_MainTex);
SAMPLERCUBE(sampler_MainTex);
float _Level;
float _MipMapCount;
float _InvOmegaP;
half4 Frag(Varyings input) : SV_Target

V,
N,
PerceptualRoughnessToRoughness(perceptualRoughness),
_MipMapCount,
55, // Matches the size of the precomputed Fibonacci point set
55, // Must be a Fibonacci number
true);
return val;

1
Assets/ScriptableRenderLoop/HDRenderLoop/Sky/SkyManager.cs


float invOmegaP = (6.0f * input.width * input.width) / (4.0f * Mathf.PI); // Solid angle associated to a pixel of the cubemap;
m_GGXConvolveMaterial.SetTexture("_MainTex", input);
m_GGXConvolveMaterial.SetFloat("_MipMapCount", mipCount);
m_GGXConvolveMaterial.SetFloat("_InvOmegaP", invOmegaP);
for (int mip = 1; mip < ((int)EnvConstants.SpecCubeLodStep + 1); ++mip)

32
Assets/ScriptableRenderLoop/ShaderLibrary/Fibonacci.hlsl


}
static const int k_FibonacciSeq[] = {
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610
};
static const float2 k_Fibonacci2dSeq21[] = {

float2(0.98181820, 0.38181686)
};
// Loads elements from one of the precomputed tables for sequence lengths of 9, 10, 11.
// Computes the values at runtime otherwise.
// For sampling, the size of the point set is given by { k_FibonacciSeq[sequenceLength - 1] }.
float2 Fibonacci2d(uint i, uint sequenceLength)
// Loads elements from one of the precomputed tables for sample counts of 21, 34, 55.
// Computes sample positions at runtime otherwise.
// Sample count must be a Fibonacci number (see 'k_FibonacciSeq').
float2 Fibonacci2d(uint i, uint sampleCount)
int fibN1 = k_FibonacciSeq[sequenceLength - 1];
int fibN2 = k_FibonacciSeq[sequenceLength - 2];
switch (fibN1)
switch (sampleCount)
default: Fibonacci2dSeq(fibN1, fibN2, i);
default:
{
int fibN1 = sampleCount;
int fibN2 = sampleCount;
// These are all constants, so this loop will be optimized away.
for (int j = 0; j < 16; j++)
{
if (k_FibonacciSeq[j] == fibN1)
{
fibN2 = k_FibonacciSeq[j - 1];
}
}
return Fibonacci2dSeq(fibN1, fibN2, i);
}
}
}

11
Assets/ScriptableRenderLoop/ShaderLibrary/Hammersley.hlsl


float2(0.99609375, 0.99609375)
};
// Loads elements from one of the precomputed tables for sequence lengths of 16, 32, 64, 256.
// Computes the values at runtime otherwise.
// For sampling, the size of the point set is the same as the sequence length.
float2 Hammersley2d(uint i, uint sequenceLength)
// Loads elements from one of the precomputed tables for sample counts of 16, 32, 64, 256.
// Computes sample positions at runtime otherwise.
float2 Hammersley2d(uint i, uint sampleCount)
switch (sequenceLength)
switch (sampleCount)
default: return Hammersley2dSeq(i, sequenceLength);
default: return Hammersley2dSeq(i, sampleCount);
}
}

5
Assets/ScriptableRenderLoop/ShaderLibrary/ImageBasedLighting.hlsl


float3 V,
float3 N,
float roughness,
float mipmapcount,
uint sampleCount, // Matches the size of the precomputed Fibonacci point set
uint sampleCount, // Must be a Fibonacci number
bool prefilter = true) // static bool
{
float3 acc = float3(0.0, 0.0, 0.0);

for (uint i = 0; i < sampleCount; ++i)
{
float2 u = k_Fibonacci2dSeq55[i];
float2 u = Fibonacci2d(i, sampleCount);
u = frac(u + randNum);
float3 L;

2
ProjectSettings/ProjectVersion.txt


m_EditorVersion: 5.6.0b1
m_EditorVersion: 5.6.0b3
正在加载...
取消
保存