phong shading is minimally wrong - perhaps due to still incorrect precomputed vertex-normals

This commit is contained in:
Nicole Dresselhaus 2014-12-04 01:04:32 +01:00
parent 8502861b17
commit 66f728f2ba

View File

@ -205,9 +205,10 @@ intersect r@(Ray ro rd) m@(M (Mesh s _ v f vn fn b)) = case catMaybes . elems $
det2 = det2v ^. _x >= 0 && det2v ^. _y >= 0 det2 = det2v ^. _x >= 0 && det2v ^. _y >= 0
&& det2v ^. _x + det2v ^. _y <= 1 && det2v ^. _x + det2v ^. _y <= 1
vns = normalize $ vns = normalize $
(0.5 - sqrt ((sqr (det2v ^. _x) + sqr (det2v ^. _y))/2)) *^ (vnorm IM.! w1) --(0.5 - sqrt ((sqr (det2v ^. _x) + sqr (det2v ^. _y))/2)) *^ (vnorm IM.! w1)
+ ((det2v ^. _y)/2) *^ (vnorm IM.! w2) (1 - det2v ^. _x - det2v ^. _y) *^ (vnorm IM.! w1)
+ ((det2v ^. _x)/2) *^ (vnorm IM.! w3) + ((det2v ^. _x)/2) *^ (vnorm IM.! w2)
+ ((det2v ^. _y)/2) *^ (vnorm IM.! w3)
sqr = \x -> x * x sqr = \x -> x * x