summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Braendli <matthias.braendli@u-blox.com>2013-12-04 12:54:36 +0100
committerMatthias Braendli <matthias.braendli@u-blox.com>2013-12-04 12:54:36 +0100
commita515b2adda5c93da698cda7315de57ecc535c898 (patch)
tree085ff02c46085de98239208bb88a8dfb948cbc84
parent10370eabf97f0737d6c32965e745baed6932eac7 (diff)
downloadhaskell-a515b2adda5c93da698cda7315de57ecc535c898.tar.gz
haskell-a515b2adda5c93da698cda7315de57ecc535c898.tar.bz2
haskell-a515b2adda5c93da698cda7315de57ecc535c898.zip
fix glitch in sphere reflection
-rw-r--r--raytracer.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/raytracer.hs b/raytracer.hs
index fa960f8..0ade439 100644
--- a/raytracer.hs
+++ b/raytracer.hs
@@ -55,10 +55,10 @@ beta2 = 120 * degrees
floorscale = 4
-w = 192 * 6
-h = 108 * 6
+w = 192 * 8
+h = 108 * 8
-oversampling = 2 -- each pixel is oversampling^2 rays
+oversampling = 4 -- each pixel is oversampling^2 rays
black :: Color
black = (0,0,0)
@@ -187,9 +187,9 @@ checkerboard_pattern x y attn
intersect_floor :: Coord -> Direction -> (Coord, Double, Color)
intersect_floor source (alpha, beta)
+ | beta <= 90*degrees = ((x, y, z), 0, (128, 128, 128))--checkerboard_pattern x y 128)
| x > (-0.5) && x < 0.5 = ((x, y, z), t, (0, attn, attn)) -- x near 0 : cyan
| y > (-0.5) && y < 0.5 = ((x, y, z), t, (attn, attn, 0)) -- y near 0 : yellow
- | beta <= 90*degrees = ((x, y, z), 0, (128, 128, 128))--checkerboard_pattern x y 128)
| otherwise = ((x, y, z), t, checkerboard_pattern x y attn)
where attn = max 0 (round (255 - 4*(sqrt $ abs t)))
((x, y, z), t) = intersect_point_floor source (alpha, beta)