Skip to content

Instantly share code, notes, and snippets.

@tcsavage
Created May 6, 2013 14:42
Show Gist options
  • Save tcsavage/5525586 to your computer and use it in GitHub Desktop.
Save tcsavage/5525586 to your computer and use it in GitHub Desktop.
Diffuse shading with shadows
diffuseM :: Colour -> Material () (BSDF Colour)
diffuseM col = proc () -> do
out <- diffuse -< col -- Get diffuse shading
shad <- traceM <<< getInidentRay -< () -- Test path to light
returnA -< maybe holdout (\(_,_,_,e) -> if e then out else holdout) shad -- Set BSDF to black if in shadow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment