{"id":581,"date":"2015-08-23T10:01:01","date_gmt":"2015-08-23T10:01:01","guid":{"rendered":"http:\/\/julius-ihle.de\/?p=581"},"modified":"2018-04-04T08:39:34","modified_gmt":"2018-04-04T08:39:34","slug":"lookdeving-iridescence-in-nuke","status":"publish","type":"post","link":"https:\/\/julius-ihle.de\/?p=581","title":{"rendered":"LookDev&#8217;ing Iridescence in Nuke"},"content":{"rendered":"<p><a href=\"https:\/\/julius-ihle.de\/?p=581\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-604\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_2d.png\" alt=\"iridescence_2d\" width=\"800\" height=\"333\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_2d.png 1280w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_2d-300x125.png 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_2d-1024x426.png 1024w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><a title=\"Iridescence\" href=\"https:\/\/en.wikipedia.org\/wiki\/Iridescence\" target=\"_blank\">Iridescence<\/a><\/span> on surfaces is an interesting effect and can be a challenge to get looking correctly. This effect occurs for example on some <span style=\"text-decoration: underline;\"><a title=\"animal skin\" href=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/d\/df\/Female_Golden_Stag_Beetle.jpg\" target=\"_blank\">animal skin<\/a><\/span> as well as on <span style=\"text-decoration: underline;\"><a title=\"surfaces covered in oil\" href=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/0\/06\/Dieselrainbow.jpg\" target=\"_blank\">surfaces covered in oil<\/a><\/span> under certain conditions. Because it is a very specific look it can often times require lots of iterations until the client is happy with the result, so quick turnarounds are often neccessery. Luckily it also often times is quite a subtle effect so it&#8217;s a good candidate to try and look develop in 2D instead of constantly re-rendering your CG.<br \/>\n<!--more-->On a recent project I was working on an environment that has been covered in oil. The client requested a subtle iridescence effect on it. The whole environment was expensive to render so turnaround would be very slow so here&#8217;s what I did to lookdev the iridescence effect in Comp.<br \/>\nThe theory of iridescence is pretty simple. It&#8217;s the change of hue over a surface depending on the angle you are viewing the surface. First of all getting that hue range in across an image is fairly simple. Hue is represented in Nuke in a 0-1 range. values above 1 and below 0 repeat the hue pattern. With the help of a Colorspace node you can easily transfer a black and white ramp into a shifting hue across the image. Assuming you have a ramp for red (Hue), constant white for green (Saturation) and constant white for blue (value\/luminance) you can get a simple hue ramp:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/01_ramp.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-582\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/01_ramp.jpg\" alt=\"01_ramp\" width=\"449\" height=\"220\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/01_ramp.jpg 1397w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/01_ramp-300x147.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/01_ramp-1024x501.jpg 1024w\" sizes=\"auto, (max-width: 449px) 100vw, 449px\" \/><\/a><br \/>\nNow it would be great to have a bit more control over the hue. You might want to compress\/expand or offset the hue range. Unfortunately Nuke&#8217;s built-in Hueshift node does&#8230; some weird stuff. So I created a simple Gizmo to adjust the Hue properly:<\/p>\n<div style=\"width: 1910px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-581-1\" width=\"1910\" height=\"664\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/hue_comparison2.mp4?_=1\" \/><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/hue_comparison2.mp4\">https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/hue_comparison2.mp4<\/a><\/video><\/div>\n<p>As you can just use a black-&gt;white ramp and transform it to a hue range it&#8217;s simple to do that on a rendering depending on viewing angle as well. All you need is a Fresnel pass. If you don&#8217;t have one another option would be to output camera normals and use the blue channel, which is essentially the same thing:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/02_fresnel.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-583\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/02_fresnel.jpg\" alt=\"02_fresnel\" width=\"543\" height=\"217\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/02_fresnel.jpg 1875w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/02_fresnel-300x120.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/02_fresnel-1024x410.jpg 1024w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/a><br \/>\nIt looks slightly psychadelic as is, but if you mix it into your speculars for example towards the glancing angles it doesn&#8217;t look too bad :)<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/03_baseRender.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-584\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/03_baseRender.jpg\" alt=\"03_baseRender\" width=\"455\" height=\"256\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/03_baseRender.jpg 1280w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/03_baseRender-300x169.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/03_baseRender-1024x576.jpg 1024w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/a><br \/>\nSomething that always helps making things look more realistic is variation. At the moment There&#8217;s a constant change in color across the surface. Every angle that faces 60\u00b0 away from the camera has exactly the same color for example. It would be nice to add some variation to that. In most shading systems you could modify this falloff with a few noises and luckily you can do exactly the same thing in Nuke. Nuke features some basic expressions that allow for the creation of noises through 3d Position data (Pref for moving objects such as characters, Pref or Pworld for static objects such as environments). Those expressions would be the turbulence, random and fBm noise functions &#8211; syntax reference <a title=\"Nuke Expression Reference Docs\" href=\"file:\/\/\/usr\/local\/Nuke9.0v6\/Documentation\/Tcl\/group__tcl__expressions.html#gabf493eb25499aba0afb6d4112c256480\" target=\"_blank\">HERE<\/a>.<br \/>\nSo we could start with a simple fBm noise function to wrap around our model. If you shuffle out the 3d Position data and add an expression node you can specify the function in there:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/04_baseNoise.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-585\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/04_baseNoise.jpg\" alt=\"04_baseNoise\" width=\"540\" height=\"242\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/04_baseNoise.jpg 1708w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/04_baseNoise-300x135.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/04_baseNoise-1024x459.jpg 1024w\" sizes=\"auto, (max-width: 540px) 100vw, 540px\" \/><\/a><br \/>\nIn this case I&#8217;m using fBm(r,g,b,10,1.3,1) which, if you refer to the docs, creates an fBm on the x,y,z positions (r,g,b here), with 10 octaves, a lacunarity of 1.3 and a gain of 1. Now, as you can see the noise is very uniform, which gives away the fact that it has been procedurally generated. What I usually do to get a bit more randomness is mixing multiple noises together. One thing I often do in 3d shading networks is to experiment with modifying noise parameters (such as time offset, lacunarity, etc.) with other noises. This usually gives a good starting point for random patterns. In nuke this is possible as well, even tough it&#8217;s a bit more cumbersome.<br \/>\nSo I&#8217;d like to create a second noise to drive the lacunarity for example. I will use a simple random function which gives me a simple normalized random noise. I would however like my lacunarity rather be between 0.4 and 1.4 instead of between 0 and 1, so I&#8217;m offsetting the random function by 0.4 after its generated. Also I would like to pipe the output of this noise in an arbitrary secondary channel (in this case noise01), because it&#8217;s sole purpose will be to drive the lacunarity of the other noise:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/05_driveLacunarityNoise.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-586\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/05_driveLacunarityNoise.jpg\" alt=\"05_driveLacunarityNoise\" width=\"549\" height=\"217\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/05_driveLacunarityNoise.jpg 1918w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/05_driveLacunarityNoise-300x119.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/05_driveLacunarityNoise-1024x405.jpg 1024w\" sizes=\"auto, (max-width: 549px) 100vw, 549px\" \/><\/a><br \/>\nSo what I can do now, is to use this noise01 channel to modify the lacunarity of my fBm noise. This will give me random lacunarity values across the surface:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/06_drivenLacunaritySwirls.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-587\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/06_drivenLacunaritySwirls.jpg\" alt=\"06_drivenLacunaritySwirls\" width=\"565\" height=\"255\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/06_drivenLacunaritySwirls.jpg 1916w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/06_drivenLacunaritySwirls-300x135.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/06_drivenLacunaritySwirls-1024x462.jpg 1024w\" sizes=\"auto, (max-width: 565px) 100vw, 565px\" \/><\/a><br \/>\nThis gives a nice swirly look which can be used to randomize the oil a bit. In this case I&#8217;m multiplying the final noise by a factor of 0.2 with the fresnel pass before converting it to HSV. Here&#8217;s a comparison of just the fresnel pass and the fresnel pass multiplied with the swirly noise:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/07_orig_iridescence.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-588\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/07_orig_iridescence.jpg\" alt=\"07_orig_iridescence\" width=\"401\" height=\"226\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/07_orig_iridescence.jpg 1280w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/07_orig_iridescence-300x169.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/07_orig_iridescence-1024x576.jpg 1024w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/08_modified_iridescence.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-589 \" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/08_modified_iridescence-300x169.jpg\" alt=\"08_modified_iridescence\" width=\"401\" height=\"226\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/08_modified_iridescence-300x169.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/08_modified_iridescence-1024x576.jpg 1024w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/08_modified_iridescence.jpg 1280w\" sizes=\"auto, (max-width: 401px) 100vw, 401px\" \/><\/a><br \/>\nAs Iridescence is an effect that often has stronger presence towards the glancing angles you can mix it into your speculars with the fresnel mask. Of course you can take it further and modify that mask you mix it in with other noises, etc. to give it an even more random appearance. The options are limitless :)<br \/>\nHere&#8217;s a testrender with just simple modifications that gives a good starting point:<\/p>\n<div style=\"width: 1266px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-581-2\" width=\"1266\" height=\"798\" loop preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_comp_v0011.mp4?_=2\" \/><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_comp_v0011.mp4\">https:\/\/julius-ihle.de\/wp-content\/uploads\/2015\/08\/iridescence_comp_v0011.mp4<\/a><\/video><\/div>\n<p>Also for anyone interested the Nuke script with all the examples shown can be obtained <span style=\"text-decoration: underline;\"><a title=\"example files\" href=\"http:\/\/53035544.de.strato-hosting.eu\/data\/comp_iridescence.zip\" target=\"_blank\">HERE<\/a><\/span>.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<br \/>\n<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>Iridescence on surfaces is an interesting effect and can be a challenge to get looking correctly. This effect occurs for example on some animal skin as well as on surfaces covered in oil under certain conditions. Because it is a very specific look it can often times require lots of iterations until the client is [&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_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-581","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3MXK6-9n","jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/581","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=581"}],"version-history":[{"count":22,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions"}],"predecessor-version":[{"id":2595,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/581\/revisions\/2595"}],"wp:attachment":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=581"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=581"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=581"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}