|
|
|
|
|
|
float lightPdf = 0.0; // Pdf of the light sample |
|
|
|
|
|
|
|
float2 u = Hammersley2d(i, sampleCount); |
|
|
|
u = frac(u + randNum + 0.5); |
|
|
|
u = frac(u + randNum); |
|
|
|
|
|
|
|
float4x4 localToWorld = float4x4(float4(lightData.right, 0.0), float4(lightData.up, 0.0), float4(lightData.forward, 0.0), float4(lightData.positionWS, 1.0)); |
|
|
|
|
|
|
|
|
|
|
for (uint i = 0; i < sampleCount; ++i) |
|
|
|
{ |
|
|
|
float2 u = Hammersley2d(i, sampleCount); |
|
|
|
u = frac(u + randNum + 0.5); |
|
|
|
u = frac(u + randNum); |
|
|
|
|
|
|
|
float3 L; |
|
|
|
float NdotL; |
|
|
|
|
|
|
for (uint i = 0; i < sampleCount; ++i) |
|
|
|
{ |
|
|
|
float2 u = Hammersley2d(i, sampleCount); |
|
|
|
u = frac(u + randNum + 0.5); |
|
|
|
u = frac(u + randNum); |
|
|
|
|
|
|
|
float3 L; |
|
|
|
float NdotL; |
|
|
|
|
|
|
float NdotV = GetShiftedNdotV(N, V, false); |
|
|
|
float3 acc = float3(0.0, 0.0, 0.0); |
|
|
|
|
|
|
|
|
|
|
|
// Add some jittering on Hammersley2d |
|
|
|
float2 randNum = InitRandom(V.xy * 0.5 + 0.5); |
|
|
|
|
|
|
|
|
|
|
u = frac(u + randNum + 0.5); |
|
|
|
u = frac(u + randNum); |
|
|
|
|
|
|
|
float VdotH; |
|
|
|
float NdotL; |
|
|
|