phong-lighting still wrong. noise is gone.
This commit is contained in:
parent
084069e0a9
commit
8502861b17
@ -204,9 +204,10 @@ intersect r@(Ray ro rd) m@(M (Mesh s _ v f vn fn b)) = case catMaybes . elems $
|
|||||||
det2v = det2m !* (pos - (verts IM.! w1))
|
det2v = det2m !* (pos - (verts IM.! w1))
|
||||||
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 = (sqrt (sqr ( det2v ^. _x) + sqr ( det2v ^. _y))) *^ (vnorm IM.! w1)
|
vns = normalize $
|
||||||
+ (sqrt (sqr (1 - det2v ^. _x) + sqr ( det2v ^. _y))) *^ (vnorm IM.! w2)
|
(0.5 - sqrt ((sqr (det2v ^. _x) + sqr (det2v ^. _y))/2)) *^ (vnorm IM.! w1)
|
||||||
+ (sqrt (sqr ( det2v ^. _x) + sqr (1 - det2v ^. _y))) *^ (vnorm IM.! w3)
|
+ ((det2v ^. _y)/2) *^ (vnorm IM.! w2)
|
||||||
|
+ ((det2v ^. _x)/2) *^ (vnorm IM.! w3)
|
||||||
sqr = \x -> x * x
|
sqr = \x -> x * x
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user