<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>README.md - +/ray @ main</title>
<meta name="description" content="README.md in +/ray at main.">
<meta property="og:title" content="README.md - +/ray @ main">
<meta property="og:description" content="README.md in +/ray at main.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="main" data-tip="2bf660ea39def9717bd805608e7c9821c5be78d4">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>+/ray</h1>
<p class="desc">a toy raytracer</p>
</div>
<pre class="clone">git clone https://git.julia.blue/+/ray</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Joseph Ryan</span><span class="commit-message" data-commit="be692709862fd6ac5aab149d90a9ceed5ce69e95">Tweak todos</span><span class="snapshot-sha sha" data-commit="be692709862fd6ac5aab149d90a9ceed5ce69e95">be69270</span><time datetime="2020-01-13T17:37:50-05:00" title="2020-01-13 17:37:50 -0500">2020-01-13</time></p>
<header class="topbar"><details class="switcher"><summary>main</summary><div class="menu"><strong>branches</strong><a class="current" href="/%2B/ray/ref/main/">main</a><a href="/%2B/ray/ref/master/">master</a><a class="all" href="/%2B/ray/refs">all refs →</a></div></details><nav class="crumbs"><a href="/%2B/ray/">ray</a> / <span class="cur">README.md</span></nav>
<span class="view-stats"><span>5.5 KiB</span><span>55 lines</span></span><span class="actions"><a class="raw" href="/%2B/ray/raw/f93eb8767c3d66c8e5ffebffe61ea133262b1897/README.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Ray</h1>
<p>A toy unbiased path tracer made by following the excellent tutorials: "Ray Tracing in One Weekend" and "Ray Tracing: the Next Week".</p>
<h2>Examples</h2>
<p><img src="https://i.imgur.com/nRxOnPy.png" alt="Cornell Box" />
<img src="https://i.imgur.com/oCkkcKU.png" alt="Ray Tracing In One Weekend" />
<img src="https://i.imgur.com/Vgl8uKd.png" alt="Ray Tracing: The Next Week" /></p>
<p>If I do more renders I'll put them <a href="https://imgur.com/a/CIZrqYd">here</a>.</p>
<h2>Features</h2>
<ul>
<li>Geometric primatives: sphere, rectangle, and rectancular prism</li>
<li>3D Mesh support (using .obj files)</li>
<li>Materials: diffuse, specular, dielectric, isotropic, and emissive</li>
<li>Textures: constant, image based (including hdr), and procedural (checkered/perlin noise/gradient)</li>
<li>Acceleration using bounded volume heirarchy and <a href="https://github.com/rayon-rs/rayon">parallelization</a></li>
<li>Global illumination using radiant textured world sphere and emmisive entities</li>
<li>Camera with depth of field</li>
</ul>
<p>See <a href="/%2B/ray/ref/main/blob/todo.md">the todo file</a> for stuff that I'm considering implementing in the future.</p>
<h2>Non-Features</h2>
<p>These are techniques or features I've given up on implementing due to difficulty or lack of interest.</p>
<ul>
<li>Motion blur</li>
<li>Animation</li>
<li>Importance sampling</li>
<li>GPU acceleration</li>
<li>Networked/distributed rendering</li>
<li>Tone mapping</li>
<li>Non-code scene description</li>
</ul>
<h2>Resources</h2>
<ul>
<li><a href="http://www.realtimerendering.com">Real Time Rendering</a> hosts a bunch of free ray tracing books including the "in One Weekend" series. They also link to <a href="http://www.pbr-book.org/3ed-2018/contents.html">"Physically Based Rendering"</a> which is like the bible of raytracing (haven't read it myself but everyone recommends it) and <a href="http://www.jagregory.com/abrash-black-book/">Abrash's Black Book</a> which has nothing to do with raytracing but is full of really cool optimizations for graphics code.</li>
<li><a href="http://in1weekend.blogspot.com">Peter Shirley's blog</a> is a great companion to his books. It goes more in depth on the topics covered as well as showing off more modern ray tracing techniques.</li>
<li><a href="https://www.scratchapixel.com">Scratchapixel</a> is my favorite comprehensive resource for computer graphics basics. It covers many techniques and algorithms used in raytracing with code samples and visualizations.</li>
<li>In terms of inspiration, I've always loved minimalist graphics programs like <a href="http://fabiensanglard.net/rayTracing_back_of_business_card/">the business card raytracer</a>, <a href="http://www.kevinbeason.com/smallpt">smallpt</a>, and <a href="https://www.a1k0n.net/2011/07/20/donut-math.html">donut.c</a>. I also watch a youtube series called <a href="https://www.youtube.com/channel/UCbfYPyITQ-7l4upoX8nvctg">Two Minute Papers</a> which gives brief explanations of academic papers mostly in the fields of computer graphics and machine learning. The guy who runs it also happens to teach a <a href="https://www.cg.tuwien.ac.at/courses/Rendering/VU.SS2017.html">college level raytracing course</a> which I quite enjoyed the lectures from.</li>
<li>I've mostly stayed away from reading academic papers or following real college level graphics courses, but there are a few that I've skimmed and gotten something out of. These inlcude <a href="https://www.cs.utexas.edu/users/fussell/courses/cs384g-fall2011">UT Austin's graphics course</a> which had a good lesson on adaptive super sampling, an <a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-837-computer-graphics-fall-2012">MIT OCW graphics course</a>, and the <a href="https://cglearn.codelight.eu/pub/computer-graphics/environment-mapping#material-sphere-map-1">University of Tartu's online resources</a>.</li>
<li>I've looked at dozens of blog posts and repos from others building their own ray tracers varrying in complexity from just as "toy" as mine to large scale projects. They've been a great source of inspiration, as well as being good mini-lessons for raytracing problems like <a href="https://karthikkaranth.me/blog/generating-random-points-in-a-sphere">generating random points in a sphere</a>. In no particular order here are some that I read while working on mine:
<ul>
<li><a href="https://www.willusher.io/projects">Will Usher</a> made a bunch of awesome graphics projects. In particular I really like <a href="https://github.com/Twinklebear/tray_rust">tray_rust</a></li>
<li><a href="http://seenaburns.com/benchmarking-rust-with-cargo-bench/">Seena Burns</a> followed Ri1W and the next week in rust</li>
<li><a href="https://github.com/arshiamufti/tracy">Arshia Mufti</a> followed Ri1W in rust</li>
<li><a href="https://bheisler.github.io/post/writing-gpu-accelerated-path-tracer-part-1/">Brook Heisler</a> wrote a GPU accelerated path tracer in rust</li>
<li><a href="https://bitshifter.github.io/2018/04/29/rust-ray-tracer-in-one-weekend/">bitshifter</a> followed Ri1W in rust and went on to optimize the heck out of it</li>
<li><a href="http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-Intro/">Aras Pranckevičius</a> wrote a few raytracers using different languages and technologies (including WASM!) and they have a bunch of posts on general graphics stuff</li>
<li><a href="https://blog.demofox.org/2016/09/21/path-tracing-getting-started-with-diffuse-and-emissive/">demofox</a> has written dozens of informative posts on ray tracing techniques</li>
<li><a href="http://www.kevinbeason.com/worklog/">Kevin Beason</a> wrote a fairly advanced raytracer and has great doccumentation of their progress</li>
</ul>
</li>
<li>The <a href="https://www.merl.com/brdf/">MERL BDRF database</a>, <a href="https://hdrihaven.com/">HDRI Haven</a>, and <a href="http://texturify.com/">texturify</a> are great free resources for texturing and environment mapping.</li>
<li><a href="https://all3dp.com/3d-file-format-3d-files-3d-printer-3d-cad-vrml-stl-obj/">This</a> is a great comparison of popular 3d file formats.</li>
<li>Adam Perry wrote <a href="https://blog.anp.lol/rust/2016/07/24/profiling-rust-perf-flamegraph/">a great walkthrough</a> for performance profiling rust with flamegraphs.</li>
</ul>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Ray</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">A toy unbiased path tracer made by following the excellent tutorials: &quot;Ray Tracing in One Weekend&quot; and &quot;Ray Tracing: the Next Week&quot;.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text"><a-p>##</a-p> <a-tt>Examples</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text">![Cornell Box](https://i.imgur.com/nRxOnPy.png)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text">![Ray Tracing In One Weekend](https://i.imgur.com/oCkkcKU.png)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">![Ray Tracing: The Next Week](https://i.imgur.com/Vgl8uKd.png)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text">If I do more renders I&#39;ll put them [here](https://imgur.com/a/CIZrqYd).</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text"><a-p>##</a-p> <a-tt>Features</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text"><a-p>- </a-p>Geometric primatives: sphere, rectangle, and rectancular prism</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"><a-p>- </a-p>3D Mesh support (using .obj files)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"><a-p>- </a-p>Materials: diffuse, specular, dielectric, isotropic, and emissive</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"><a-p>- </a-p>Textures: constant, image based (including hdr), and procedural (checkered/perlin noise/gradient)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text"><a-p>- </a-p>Acceleration using bounded volume heirarchy and [parallelization](https://github.com/rayon-rs/rayon)</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text"><a-p>- </a-p>Global illumination using radiant textured world sphere and emmisive entities</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text"><a-p>- </a-p>Camera with depth of field</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"><a-p>See [the todo file](todo.md) for stuff that I&#39;m considering implementing in the future.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"><a-p>## </a-p><a-tt>Non-Features</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>These are techniques or features I&#39;ve given up on implementing due to difficulty or lack of interest.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"><a-p>- Motion blur</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"><a-p>- Animation</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"><a-p>- Importance sampling</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"><a-p>- GPU acceleration</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"><a-p>- Networked/distributed rendering</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"><a-p>- Tone mapping</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"><a-p>- Non-code scene description</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"><a-p>## </a-p><a-tt>Resources</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"><a-p>- [Real Time Rendering](http://www.realtimerendering.com) hosts a bunch of free ray tracing books including the &quot;in One Weekend&quot; series. They also link to [&quot;Physically Based Rendering&quot;](http://www.pbr-book.org/3ed-2018/contents.html) which is like the bible of raytracing (haven&#39;t read it myself but everyone recommends it) and [Abrash&#39;s Black Book](http://www.jagregory.com/abrash-black-book/) which has nothing to do with raytracing but is full of really cool optimizations for graphics code.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>- [Peter Shirley&#39;s blog](http://in1weekend.blogspot.com) is a great companion to his books. It goes more in depth on the topics covered as well as showing off more modern ray tracing techniques.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"><a-p>- [Scratchapixel](https://www.scratchapixel.com) is my favorite comprehensive resource for computer graphics basics. It covers many techniques and algorithms used in raytracing with code samples and visualizations.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>- In terms of inspiration, I&#39;ve always loved minimalist graphics programs like [the business card raytracer](http://fabiensanglard.net/rayTracing_back_of_business_card/), [smallpt](http://www.kevinbeason.com/smallpt), and [donut.c](https://www.a1k0n.net/2011/07/20/donut-math.html). I also watch a youtube series called [Two Minute Papers](https://www.youtube.com/channel/UCbfYPyITQ-7l4upoX8nvctg) which gives brief explanations of academic papers mostly in the fields of computer graphics and machine learning. The guy who runs it also happens to teach a [college level raytracing course](https://www.cg.tuwien.ac.at/courses/Rendering/VU.SS2017.html) which I quite enjoyed the lectures from.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>- I&#39;ve mostly stayed away from reading academic papers or following real college level graphics courses, but there are a few that I&#39;ve skimmed and gotten something out of. These inlcude [UT Austin&#39;s graphics course](https://www.cs.utexas.edu/users/fussell/courses/cs384g-fall2011) which had a good lesson on adaptive super sampling, an [MIT OCW graphics course](https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-837-computer-graphics-fall-2012), and the [University of Tartu&#39;s online resources](https://cglearn.codelight.eu/pub/computer-graphics/environment-mapping#material-sphere-map-1).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>- I&#39;ve looked at dozens of blog posts and repos from others building their own ray tracers varrying in complexity from just as &quot;toy&quot; as mine to large scale projects. They&#39;ve been a great source of inspiration, as well as being good mini-lessons for raytracing problems like [generating random points in a sphere](https://karthikkaranth.me/blog/generating-random-points-in-a-sphere). In no particular order here are some that I read while working on mine:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>  - [Will Usher](https://www.willusher.io/projects) made a bunch of awesome graphics projects. In particular I really like [tray_rust](https://github.com/Twinklebear/tray_rust)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"><a-p>  - [Seena Burns](http://seenaburns.com/benchmarking-rust-with-cargo-bench/) followed Ri1W and the next week in rust</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"><a-p>  - [Arshia Mufti](https://github.com/arshiamufti/tracy) followed Ri1W in rust</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>  - [Brook Heisler](https://bheisler.github.io/post/writing-gpu-accelerated-path-tracer-part-1/) wrote a GPU accelerated path tracer in rust</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"><a-p>  - [bitshifter](https://bitshifter.github.io/2018/04/29/rust-ray-tracer-in-one-weekend/) followed Ri1W in rust and went on to optimize the heck out of it</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"><a-p>  - [Aras Pranckevičius](http://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-Intro/) wrote a few raytracers using different languages and technologies (including WASM!) and they have a bunch of posts on general graphics stuff</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"><a-p>  - [demofox](https://blog.demofox.org/2016/09/21/path-tracing-getting-started-with-diffuse-and-emissive/) has written dozens of informative posts on ray tracing techniques</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"><a-p>  - [Kevin Beason](http://www.kevinbeason.com/worklog/) wrote a fairly advanced raytracer and has great doccumentation of their progress</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"><a-p>- The [MERL BDRF database](https://www.merl.com/brdf/), [HDRI Haven](https://hdrihaven.com/), and [texturify](http://texturify.com/) are great free resources for texturing and environment mapping.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text"><a-p>- [This](https://all3dp.com/3d-file-format-3d-files-3d-printer-3d-cad-vrml-stl-obj/) is a great comparison of popular 3d file formats.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text"><a-p>- </a-p>Adam Perry wrote [a great walkthrough](https://blog.anp.lol/rust/2016/07/24/profiling-rust-perf-flamegraph/) for performance profiling rust with flamegraphs.</span></span></pre></div></div>
</main>
</body>
</html>
