|
|
|
|
|
|
|
|
|
|
while (true) |
|
|
|
{ |
|
|
|
int wastedSampleCount = 0; |
|
|
|
int acceptedSampleCount = 0; |
|
|
|
int shiftedSampleIndex = 0; |
|
|
|
|
|
|
|
for (int i = 0; i < sampleCount; i++) |
|
|
|
{ |
|
|
|
|
|
|
SampleVisibleAnisoGGXDir(u, V, k_identity3x3, roughness, roughness, localL, NdotL, NdotH, LdotH, true); |
|
|
|
|
|
|
|
if (NdotL <= 0) wastedSampleCount++; |
|
|
|
if (NdotL > 0) |
|
|
|
{ |
|
|
|
if (acceptedSampleCount == sampleIndex) shiftedSampleIndex = i; |
|
|
|
acceptedSampleCount++; |
|
|
|
} |
|
|
|
if (validSampleCount == sampleCount - wastedSampleCount) break; |
|
|
|
if (acceptedSampleCount == validSampleCount) |
|
|
|
{ |
|
|
|
sampleIndex = shiftedSampleIndex; |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
sampleCount++; |
|
|
|
} |
|
|
|
|
|
|
|