{"id":156,"date":"2009-06-06T11:40:09","date_gmt":"2009-06-06T18:40:09","guid":{"rendered":"http:\/\/www.kevinbeason.com\/worklog\/?p=156"},"modified":"2009-06-09T11:53:28","modified_gmt":"2009-06-09T18:53:28","slug":"dispersion-and-spectral-filtering","status":"publish","type":"post","link":"http:\/\/www.kevinbeason.com\/worklog\/2009\/06\/06\/dispersion-and-spectral-filtering\/","title":{"rendered":"Dispersion, Spectral Filtering, Subpixel Sampling"},"content":{"rendered":"\n\t\t<style type=\"text\/css\">\n\t\t\t#gallery-1 {\n\t\t\t\tmargin: auto;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-item {\n\t\t\t\tfloat: left;\n\t\t\t\tmargin-top: 10px;\n\t\t\t\ttext-align: center;\n\t\t\t\twidth: 33%;\n\t\t\t}\n\t\t\t#gallery-1 img {\n\t\t\t\tborder: 2px solid #cfcfcf;\n\t\t\t}\n\t\t\t#gallery-1 .gallery-caption {\n\t\t\t\tmargin-left: 0;\n\t\t\t}\n\t\t\t\/* see gallery_shortcode() in wp-includes\/media.php *\/\n\t\t<\/style>\n\t\t<div id='gallery-1' class='gallery galleryid-156 gallery-columns-3 gallery-size-thumbnail'><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/bunny.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/bunny-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/ajax.png'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/ajax-150x150.png\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" srcset=\"http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/ajax-150x150.png 150w, http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/ajax-300x300.png 300w, http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/ajax.png 1024w\" sizes=\"auto, (max-width: 150px) 100vw, 150px\" \/><\/a>\n\t\t\t<\/dt><\/dl><dl class='gallery-item'>\n\t\t\t<dt class='gallery-icon landscape'>\n\t\t\t\t<a href='http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/cubo.jpg'><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"http:\/\/www.kevinbeason.com\/worklog\/wp-content\/uploads\/2009\/06\/cubo-150x150.jpg\" class=\"attachment-thumbnail size-thumbnail\" alt=\"\" \/><\/a>\n\t\t\t<\/dt><\/dl><br style=\"clear: both\" \/>\n\t\t<\/div>\n\n<p>Bunny model <a href=\"http:\/\/graphics.stanford.edu\/data\/3Dscanrep\/\">available here<\/a>. Ajax bust <a href=\"http:\/\/forum.jotero.com\/viewtopic.php?t=3\">available here<\/a> (thanks jotero!). Bunny scene was under 3 hours, Ajax scene was 8 hours.<\/p>\n<p>The Cubo prism model is <a href=\"http:\/\/www.winosi.onlinehome.de\/Gallery_t19.htm\">available here<\/a>. For comparison, here is a <a href=\"http:\/\/www.luxrender.net\/gallery\/main.php?g2_itemId=1928\">proper rendering<\/a> by luxrender. The prism shows off a new feature, spectral rendering. I used 20,000,000 photons which took about 1h20m to emit, and another 10 hours for rendering. (Without diffuse final gather it renders in about 2.5 hours.)<\/p>\n<p>Dispersion in the glass is computed using <a href=\"http:\/\/en.wikipedia.org\/wiki\/Cauchy%27s_equation\">Cauchy&#8217;s equation<\/a> with dense flint glass (SF10) coefficients. Spectral computations are done in a way similar to <a href=\"http:\/\/www-graphics.stanford.edu\/courses\/cs348b-competition\/cs348b-05\/gems2\/index.html\">this project<\/a>, but with support for arbitrary wavelengths. I sample a wavelength from the visible spectrum and compute a &#8220;wavelength filter&#8221;, which is just an RGB color. I convert the CIE XYZ <a href=\"http:\/\/cvrl.ioo.ucl.ac.uk\/database\/text\/cmfs\/ciexyzjv.htm\">response<\/a> for that wavelength to RGB and normalize such that a uniform sampling of the entire spectrum produces white (1, 1, 1) instead of (0.387463, 0.258293, 0.240652). Then I scale the emitted photon color and primary rays&#8217; radiance by the normalized color. I sample the wavelengths with importance sampling according to the average CIE XYZ response. <\/p>\n<p>With this spectral filtering I have to take more samples to eliminate the chromatic noise, but the result is consistent with the non-spectral result, provided there is no wavelength dependent reflection such as dispersion. That is, without dispersion, the spectral and non-spectral results match. If there <i>is<\/i> wavelength dependent reflection, then you get results like the prism image.<\/p>\n<p>Finally, the cubo prism image and the last batch of sphere BRDF tests use subpixel sampling (similar to what&#8217;s done in smallpt). I divide each pixel up into 4&#215;4 subpixels. Basically I scale the image resolution by 4, render, do all the tone mapping, and then shrink the image back down to the desired resolution using averaging. This produces much sharper results at the cost of increased memory usage. This is partially based on what Sunflow does, whose source I used as a guide, but without the adaptive anti-aliasing.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bunny model available here. Ajax bust available here (thanks jotero!). Bunny scene was under 3 hours, Ajax scene was 8 hours. The Cubo prism model is available here. For comparison, here is a proper rendering by luxrender. The prism shows off a new feature, spectral rendering. I used 20,000,000 photons which took about 1h20m to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-156","post","type-post","status-publish","format-standard","hentry","category-general"],"_links":{"self":[{"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/posts\/156","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":8,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"predecessor-version":[{"id":168,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/posts\/156\/revisions\/168"}],"wp:attachment":[{"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.kevinbeason.com\/worklog\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}