{"id":2500,"date":"2017-12-17T17:32:47","date_gmt":"2017-12-17T17:32:47","guid":{"rendered":"http:\/\/julius-ihle.de\/?p=2500"},"modified":"2018-04-04T08:37:20","modified_gmt":"2018-04-04T08:37:20","slug":"displaying-useful-information-with-metadata-in-nuke","status":"publish","type":"post","link":"https:\/\/julius-ihle.de\/?p=2500","title":{"rendered":"Displaying Useful Information with Metadata in NUKE"},"content":{"rendered":"<p><a href=\"https:\/\/julius-ihle.de\/?p=2500\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft wp-image-2501 size-full\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats.jpg\" alt=\"arnoldstats\" width=\"1280\" height=\"533\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats.jpg 1280w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats-300x125.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats-1024x426.jpg 1024w\" sizes=\"auto, (max-width: 1280px) 100vw, 1280px\" \/><\/a><\/p>\n<p>Nuke makes it really easy to access metadata from incoming images. You can easily access information from pictures that you shot with your camera or access render stats from CG renderings. This can prove to be really useful in a production environment where you want to make sure that your frames are rendering in a reasonable time without consuming too much memory. This example shows how to access and display that information in Nuke with renderings from Arnold.<\/p>\n<p><!--more--><br \/>\nHere&#8217;s an example of Displaying useful information from a render :<\/p>\n<div style=\"width: 960px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2500-1\" width=\"960\" height=\"540\" loop preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats.mp4?_=1\" \/><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats.mp4\">https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/arnoldstats.mp4<\/a><\/video><\/div>\n<p>(yes,\u00a0you are doing something wrong, if it renders that long and takes this much RAM :))<br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nYou can see the metadata of an image with the ViewMetaData node. This node displays all available metadata from your input.<br \/>\nHere&#8217;s an example of what a default Arnold EXR render comes with:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/01viewmetadata.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2503\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/01viewmetadata.jpg\" alt=\"01viewmetadata\" width=\"676\" height=\"441\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/01viewmetadata.jpg 676w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/01viewmetadata-300x196.jpg 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Quite a lot of stuff&#8230;<br \/>\nMetadata information is accessible in Nuke through TCL expressions which you can use in a Text Node for example. For a full list of what you can do with TCL you can refer to the <a title=\"Nuke TCL doc\" href=\"http:\/\/www.nukepedia.com\/reference\/Tcl\/\" target=\"_blank\">documentation<\/a>.<\/p>\n<p>TCL expressions are evaluated in square brackets. You can access metadata with<em> [metadata name\/of\/metadata]<\/em>. If I want to get the average rays per pixel for example I could use<em> [metadata exr\/arnold\/stats\/rays\/all\/pixel]<\/em> rays\/pixel:<\/p>\n<p><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/02metadatatotext.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2504\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/02metadatatotext.jpg\" alt=\"02metadatatotext\" width=\"1004\" height=\"383\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/02metadatatotext.jpg 1004w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/02metadatatotext-300x114.jpg 300w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>As this is averaging the rays of all the pixels it outputs a floating point number. We can convert it to an integer with int(). Note that whenever you want to manipulate numbers you have to enclose your mathematical operation in <em>[expr ]<\/em>:<br \/>\n<em>[expr int([metadata exr\/arnold\/stats\/rays\/all\/pixel])] rays\/pixels<\/em><\/p>\n<p><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/03expr.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2505\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/03expr.jpg\" alt=\"03expr\" width=\"1004\" height=\"383\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/03expr.jpg 1004w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/03expr-300x114.jpg 300w\" sizes=\"auto, (max-width: 1004px) 100vw, 1004px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You can do the same thing to display your RAM usage. By default Arnold displays memory usage in Megabytes&#8230; Converted to Gigabytes it might be a bit more useful:<\/p>\n<p><em>[expr [metadata exr\/arnold\/stats\/memory\/peak]\/1000]GB<\/em><\/p>\n<p><a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/04mem.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2506\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/04mem.jpg\" alt=\"04mem\" width=\"1103\" height=\"375\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/04mem.jpg 1103w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/04mem-300x102.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/04mem-1024x348.jpg 1024w\" sizes=\"auto, (max-width: 1103px) 100vw, 1103px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Just a few too many decimal places for my taste&#8230; You can use <em>[format]<\/em> similar to how it&#8217;s used in Python to change it to 2 decimal places for example:<\/p>\n<p><em>[format &#8220;%0.2f&#8221; [expr [metadata exr\/arnold\/stats\/memory\/peak]\/1000]]GB<\/em><br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/05memformat.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2507\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/05memformat.jpg\" alt=\"05memformat\" width=\"1161\" height=\"375\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/05memformat.jpg 1161w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/05memformat-300x97.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/05memformat-1024x331.jpg 1024w\" sizes=\"auto, (max-width: 1161px) 100vw, 1161px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The metadata for the render time comes in seconds with Arnold. If you&#8217;re a math genious or have very optimized renders this might work for you. Unfortunately neither applies to me, so a display in hh:mm:ss seems\u00a0a bit easier to decipher :)<\/p>\n<p>I&#8217;m using <em>expr<\/em> to convert the seconds to integers and display them in hours, minutes and seconds separately:<br \/>\n<em>[expr int([metadata exr\/arnold\/stats\/time\/render]\/3600)] [expr int(fmod([metadata exr\/arnold\/stats\/time\/render]\/60,60))] [expr int(fmod([metadata exr\/arnold\/stats\/time\/render],60))]<\/em><br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/06hhmmss.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2508\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/06hhmmss.jpg\" alt=\"06hhmmss\" width=\"557\" height=\"384\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/06hhmmss.jpg 557w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/06hhmmss-300x207.jpg 300w\" sizes=\"auto, (max-width: 557px) 100vw, 557px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&#8230;and use <em>[format]<\/em> similar to the above example to make it nice and tidy:<br \/>\n<em>[format &#8220;%02d:%02d:%02d&#8221; [expr int([metadata exr\/arnold\/stats\/time\/render]\/3600)] [expr int(fmod([metadata exr\/arnold\/stats\/time\/render]\/60,60))] [expr int(fmod([metadata exr\/arnold\/stats\/time\/render],60))]]<\/em><br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/07hhmmssformat.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2509\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/07hhmmssformat.jpg\" alt=\"07hhmmssformat\" width=\"604\" height=\"393\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/07hhmmssformat.jpg 604w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/07hhmmssformat-300x195.jpg 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Another thing that I find useful to colorize the output. If you just have numbers whooshing by when you play an animation it&#8217;s hard to spot potential problematic frames. If you just want a simple heatmap from green to red one way you could do it is to just shift the hue of your text. Looking at a Hue ramp red has a hue of 0 and green has a hue of 0.3333:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/08hue.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2510\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/08hue.jpg\" alt=\"08hue\" width=\"404\" height=\"282\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/08hue.jpg 404w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/08hue-300x209.jpg 300w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>So you could put your text in HSV space and offset the red channel to shift your Hue (the hue shift in Nuke does not work properly &#8211; see <a title=\"LookDev'ing Iridescence in NUKE\" href=\"%20https:\/\/julius-ihle.de\/?p=581\" target=\"_blank\">HERE<\/a>) and make sure you have your saturation at 1:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/09huetext.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2511\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/09huetext.jpg\" alt=\"09huetext\" width=\"883\" height=\"389\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/09huetext.jpg 883w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/09huetext-300x132.jpg 300w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/a><br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nSo all that&#8217;s left to do is to remap the numbers from whichever range you like to 0 as a maximum (red) and 0.3333 as a minimum (green). Remapping numbers can be achieved like this:<br \/>\n<em>outputMin + (value &#8211; inputMin) * (outputMax &#8211; outputMin) \/ (inputMax &#8211; inputMin)<\/em><br \/>\nSo if I for example would like to remap the hue of my render time in seconds to display everything with a time below 2minutes (120 seconds) in green and everything above 10 minutes (600 seconds) in red I can use:<br \/>\n<em>(1\/3) + ([metadata exr\/arnold\/stats\/time\/render] &#8211; 120) * (0 &#8211; (1\/3)) \/ (600 &#8211; 120)<\/em><br \/>\nJust make sure you clamp the whole thing to 0 and 0.3333 so the values outside of this range don&#8217;t shift to another hue:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/10huetextexpr.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2512\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/10huetextexpr.jpg\" alt=\"10huetextexpr\" width=\"1088\" height=\"425\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/10huetextexpr.jpg 1088w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/10huetextexpr-300x117.jpg 300w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/10huetextexpr-1024x400.jpg 1024w\" sizes=\"auto, (max-width: 1088px) 100vw, 1088px\" \/><\/a><br \/>\n&nbsp;<\/p>\n<p>&nbsp;<br \/>\nWrap the whole thing up into a Gizmo and you are good to go&#8230; The <em>min<\/em> values specify up to which point\u00a0the text will stay green and the <em>max<\/em> values specify at which point\u00a0it will be completely red:<br \/>\n<a href=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/11gizmo.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-2513\" src=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/11gizmo.jpg\" alt=\"11gizmo\" width=\"596\" height=\"329\" srcset=\"https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/11gizmo.jpg 596w, https:\/\/julius-ihle.de\/wp-content\/uploads\/2017\/12\/11gizmo-300x166.jpg 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>You can grab the Gizmo from this example <strong><span style=\"text-decoration: underline;\"><a title=\"DOWNLOAD ARNOLDSTATS GIZMO\" href=\"http:\/\/53035544.de.strato-hosting.eu\/data\/ArnoldStats.gizmo\" target=\"_blank\">HERE<\/a><\/span><\/strong>.<\/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>Nuke makes it really easy to access metadata from incoming images. You can easily access information from pictures that you shot with your camera or access render stats from CG renderings. This can prove to be really useful in a production environment where you want to make sure that your frames are rendering in a [&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-2500","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3MXK6-Ek","jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2500","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=2500"}],"version-history":[{"count":29,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2500\/revisions"}],"predecessor-version":[{"id":2586,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=\/wp\/v2\/posts\/2500\/revisions\/2586"}],"wp:attachment":[{"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2500"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2500"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/julius-ihle.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2500"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}