Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
fogleman committed Sep 1, 2016
1 parent 871d459 commit 0bb0332
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions pt/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,7 @@ func render(scene *Scene, camera *Camera, sampler Sampler, samplesPerPixel int,
for x := 0; x < w; x++ {
if samplesPerPixel <= 0 {
// random subsampling
samples := absSamples
v := buf.Variance(x, y)
if v.R > 0.5 || v.G > 0.5 || v.B > 0.5 {
samples *= 64
}
for i := 0; i < samples; i++ {
for i := 0; i < absSamples; i++ {
fu := rnd.Float64()
fv := rnd.Float64()
ray := camera.CastRay(x, y, w, h, fu, fv, rnd)
Expand All @@ -68,6 +63,17 @@ func render(scene *Scene, camera *Camera, sampler Sampler, samplesPerPixel int,
}
}
}
v := buf.Variance(x, y)
if v.R < 0.3 && v.G < 0.3 && v.B < 0.3 {
continue
}
for i := 0; i < 128; i++ {
fu := rnd.Float64()
fv := rnd.Float64()
ray := camera.CastRay(x, y, w, h, fu, fv, rnd)
sample := sampler.Sample(scene, ray, rnd)
buf.AddSample(x, y, sample)
}
}
ch <- 1
}
Expand Down

0 comments on commit 0bb0332

Please sign in to comment.