{"id":2619,"date":"2018-07-21T19:21:46","date_gmt":"2018-07-21T19:21:46","guid":{"rendered":"http:\/\/julius-ihle.de\/?p=2619"},"modified":"2018-07-21T19:35:26","modified_gmt":"2018-07-21T19:35:26","slug":"lpe-quick-tip-1-light-path-splitting-for-transmission","status":"publish","type":"post","link":"https:\/\/julius-ihle.de\/?p=2619","title":{"rendered":"LPE Quick Tip #1: Light Path Splitting for Transmission"},"content":{"rendered":"<p><a href=\"https:\/\/julius-ihle.de\/?p=2619\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-2620 size-full\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/lpe01.png\" alt=\"lpe01\" width=\"1280\" height=\"533\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/lpe01.png 1280w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/lpe01-300x125.png 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/lpe01-1024x426.png 1024w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/p>\n<p>This will be a quick one.\u00a0Light Path Expressions offer a lot of flexibility over the AOV&#8217;s you would like to pass off to Compositing. Most modern path tracing render engines like Arnold, RenderMan, Blender&#8217;s Cycles, VRay, etc. have support for it by now. With LPE&#8217;s you can split pretty much any light path you desire, which brings me to\u00a0the solution to this first problem.<\/p>\n<p><!--more--><\/p>\n<p>Usually when you have a refractive object in your scene everything that is being refracted lands in 1 single AOV (usually called refraction, transmission, or something along those lines).<br \/>\nSo if I have a scene like this&#8230;<\/p>\n<p><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/01beauty0000.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2621\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/01beauty0000.png\" alt=\"01beauty0000\" width=\"946\" height=\"526\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/01beauty0000.png 946w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/01beauty0000-300x167.png 300w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>My\u00a0transmission\u00a0AOV will usually look like this:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/03refr0000.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2623\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/03refr0000.png\" alt=\"03refr0000\" width=\"946\" height=\"526\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/03refr0000.png 946w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/03refr0000-300x167.png 300w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&#8230;and my diffuse like this:<\/p>\n<p><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/02diff0000.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2628\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/02diff0000.png\" alt=\"02diff0000\" width=\"946\" height=\"526\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/02diff0000.png 946w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/02diff0000-300x167.png 300w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>As you can imagine tweaking the diffuse in comp will be a bit of\u00a0a cumbersome task as the color of the teapot for example is in 2 different AOVs. Luckily what you can do is to modify the default LPE&#8217;s a bit to include\u00a0transmissive paths in other AOVs like diffuse, specular, subsurface scattering, etc.<\/p>\n<p>I won&#8217;t go into too much details of how it works. If you want a proper overview on LPE&#8217;s you can read up on them\u00a0<a title=\"LPE Documentation\" href=\"https:\/\/github.com\/imageworks\/OpenShadingLanguage\/wiki\/OSL-Light-Path-Expressions\" target=\"_blank\">HERE<\/a>.<br \/>\nThe default diffuse_direct looks like this usually:<br \/>\nC&lt;RD&gt;[&lt;L.&gt;O]<br \/>\nWhich simply means the lightpath Camera (C) -&gt; Diffuse Reflection event (&lt;RD&gt;) -&gt; Light Source \/ Emissive Object ([&lt;L.&gt;O])<\/p>\n<p>To make\u00a0all the light paths include refraction events as well you can\u00a0tell the light paths to look for zero or more\u00a0transmissive specular events before evaluating the rest of the light path.<br \/>\nSo if you modify the diffuse_direct like this:<br \/>\nC&lt;TS&gt;*&lt;RD&gt;[&lt;L.&gt;O]<\/p>\n<p>&#8230; then the diffuse will be a lot more useful for tweaking in Compositing:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/04newdiff0000.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2624\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/04newdiff0000.png\" alt=\"04newdiff0000\" width=\"946\" height=\"526\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/04newdiff0000.png 946w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/04newdiff0000-300x167.png 300w\" sizes=\"auto, (max-width: 946px) 100vw, 946px\" \/><\/a><br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p>Likewise to make sure everything adds back together nicely you can modify the refraction pass to only include pure transmissive events:<br \/>\nC&lt;TS&gt;+[&lt;L.&gt;O]<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/05newrefr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2623\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/07\/05newrefr.png\" alt=\"05newrefr\" width=\"946\" height=\"526\" \/><\/a><br \/>\n&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>As a TL;DR here is the stuff I personally like using:<br \/>\ndiffuse_direct: lpe:C&lt;TS&gt;*&lt;RD&gt;[&lt;L.&gt;O]<br \/>\ndiffuse_indirect: lpe:C&lt;TS&gt;*&lt;RD&gt;[DS]+[&lt;L.&gt;O]<br \/>\ndiffuse_albedo: lpe:C&lt;TS&gt;*&lt;RD&gt;A<br \/>\nspecular_direct: lpe:C&lt;TS&gt;*&lt;RS&gt;[&lt;L.&gt;O]<br \/>\nspecular_indirect: lpe:C&lt;TS&gt;*&lt;RS&gt;[DS]+[&lt;L.&gt;O]<br \/>\nrefraction: lpe:C&lt;TS&gt;+[&lt;L.&gt;O]<br \/>\nsss: lpe:C&lt;TS&gt;*&lt;TD&gt;[DS]*[&lt;L.&gt;O]<br \/>\n&nbsp;<br \/>\n&nbsp;<\/p>\n<p><span style=\"color: #808080;\">_________________________________________________<\/span><br \/>\n<span style=\"color: #808080;\"><span style=\"font-size: small;\"> If this post has helped you in any way you can express your gratefulness by using the <em>Donate\u00a0<\/em>Button below to buy me a coffee! :)<\/span><\/span><br \/>\n<a href=\"https:\/\/www.paypal.com\/cgi-bin\/webscr?cmd=_s-xclick&amp;hosted_button_id=VH5RW3YDWDJSQ\" target=\"_blank\" rel=\"nofollow\"><img decoding=\"async\" src=\"https:\/\/www.paypal.com\/en_US\/i\/btn\/x-click-but21.gif\" alt=\"\" \/><\/a><\/p>\n<div class=\"moz-text-html\" lang=\"x-unicode\">\n<div><span style=\"font-size: small;\"><span style=\"color: #808080;\">3M5xNSV7g2NzVpHMqzYKhgoKJZ8CWa644m<\/span><\/span><br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2576\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2018\/03\/bc_ldgr_qrcode.png\" alt=\"bc_ldgr_qrcode\" width=\"128\" height=\"128\" \/><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>This will be a quick one.\u00a0Light Path Expressions offer a lot of flexibility over the AOV&#8217;s you would like to pass off to Compositing. Most modern path tracing render engines like Arnold, RenderMan, Blender&#8217;s Cycles, VRay, etc. have support for it by now. With LPE&#8217;s you can split pretty much any light path you desire, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2619","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3MXK6-Gf","jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2619"}],"version-history":[{"count":11,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions"}],"predecessor-version":[{"id":2640,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2619\/revisions\/2640"}],"wp:attachment":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}