3 ms·
I've done some similar implementations years ago (but with C/OCaml, nothing on the GPU), so I didn't refer to many things for this. Fresnel reflectance is base
by muyyatin 12y ago
I've done some similar implementations years ago (but with C/OCaml, nothing on the GPU), so I didn't refer to many things for this.
Fresnel reflectance is based off of http://mathinfo.univ-reims.fr/IMG/pdf/Combined_rendering_of_polarization_and_fluorescence_effects_-_Wilkie.pdf http://mathinfo.univ-reims.fr/IMG/pdf/Combined_rendering_of_..., although I'm not doing any spectral or polarization-dependent code right now (I wanted to leave that open, and it allows accurate metal simulation).
I tinkered with a blend of some pseudorandomness functions until getting something that worked.
https://www.siggraph.org/education/materials/HyperGraph/raytrace/rtinter3.htm https://www.siggraph.org/education/materials/HyperGraph/rayt... was used for ray-box intersection.
The distance function experiment for the drinking glass is based off of the concept of http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm http://www.iquilezles.org/www/articles/distfunctions/distfun... (like raymarching, includes normal computation).
I consulted http://madebyevan.com/webgl-path-tracing/ http://madebyevan.com/webgl-path-tracing/ to see the best way to do accumulation (and made some realism fixes in https://github.com/jonathanolson/webgl-path-tracing https://github.com/jonathanolson/webgl-path-tracing, see https://github.com/evanw/webgl-path-tracing/pull/1 https://github.com/evanw/webgl-path-tracing/pull/1 for details).
Many other things can be pulled from online or from books like http://www.amazon.com/Game-Engine-Design-Interactive-Technology/dp/0122290631 http://www.amazon.com/Game-Engine-Design-Interactive-Technol....
Please let me know if you have any questions, (see my email at http://jonathan-olson.com/about http://jonathan-olson.com/about), and please feel free to use my code however you like (things I wrote are MIT, but I use CC-by and CC-by-non-commercial HDR images).
- cdi 12y agoThanks!