add multiple samples per pixel
This commit is contained in:
parent
7367a2abaf
commit
48e78fedda
|
@ -78,6 +78,12 @@ void main()
|
||||||
int bounces = (1-sky) * BOUNCES;
|
int bounces = (1-sky) * BOUNCES;
|
||||||
pixel.xyz = mix(pixel.xyz, _skyColor, sky);
|
pixel.xyz = mix(pixel.xyz, _skyColor, sky);
|
||||||
|
|
||||||
|
// sample
|
||||||
|
int samples = 2;
|
||||||
|
for (int i = 0; i < samples; i++)
|
||||||
|
{
|
||||||
|
float sampleDepth = 0;
|
||||||
|
|
||||||
// trace the ray's path around the scene
|
// trace the ray's path around the scene
|
||||||
for (int j = 0; j < bounces; j++)
|
for (int j = 0; j < bounces; j++)
|
||||||
{
|
{
|
||||||
|
@ -90,6 +96,9 @@ void main()
|
||||||
if (length(ray.energy) < 0.001) break;
|
if (length(ray.energy) < 0.001) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
depth += sampleDepth / float(samples);
|
||||||
|
}
|
||||||
|
|
||||||
pixel.xyz = mix(pixel.xyz, vec3(1.0), depth);
|
pixel.xyz = mix(pixel.xyz, vec3(1.0), depth);
|
||||||
|
|
||||||
// output to a specific pixel in the image
|
// output to a specific pixel in the image
|
||||||
|
|
Loading…
Reference in New Issue