{"id":1010,"date":"2011-12-07T14:16:18","date_gmt":"2011-12-07T14:16:18","guid":{"rendered":"https:\/\/www.cg-blog.com\/?p=1010"},"modified":"2014-03-16T17:16:09","modified_gmt":"2014-03-16T17:16:09","slug":"dof-vray-faster","status":"publish","type":"post","link":"https:\/\/www.cg-blog.com\/index.php\/2011\/12\/07\/dof-vray-faster.htm","title":{"rendered":"How to render faster Dof in V-Ray with Shade Map"},"content":{"rendered":"<p style=\"text-align: center;\">&#8211; Click\u00c2\u00a0<strong>LIKE<\/strong>\u00c2\u00a0above, if you like this post\u00c2\u00a0\u00c2\u00a0&#8211;<\/p>\n<p>Have you ever rendered with <a title=\"How to get a nice depht of field\" href=\"https:\/\/www.cg-blog.com\/index.php\/2010\/08\/12\/depht-of-field-dof-vray.htm\" target=\"_blank\">Depth of Field<\/a> effect in <strong>V-Ray<\/strong>?<\/p>\n<p>Render Time increase significantly, especially if you use high subdivs values (in the sampling rollout)\u00c2\u00a0to reducing the graininess. In this case the time increases even more. First of all I wanto to clear that I prefer\u00c2\u00a0\u00c2\u00a0to create such effects in postproduction, but in this post I&#8217;ll tell you how to render faster with DOF\u00c2\u00a0directly in the V-Ray.<\/p>\n<p>Here is a simple Dof example:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1012\" alt=\"\" src=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/1-dof-cgb2.jpg\" width=\"540\" height=\"600\" srcset=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/1-dof-cgb2.jpg 540w, https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/1-dof-cgb2-270x300.jpg 270w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>These image takes 7-8 mins without Dof, and the same image takes 19min with Dof and subdivs = 15: <strong>time is doubled!<\/strong> In this case the difference is just 10 mins, that might be irrilevant. But what happen if render time increase from 5h to 10h? It&#8217;s better to know this trick to go faster with Dof \ud83d\ude09<\/p>\n<p>It&#8217;s a simple trick: we can reduce time calculation with <strong>Shademap<\/strong> feature.<\/p>\n<p style=\"text-align: center;\"><em>OMG&#8230; Ciro!! What hell is shademap???\u00c2\u00a0<\/em><\/p>\n<p><span style=\"line-height: 1.5em;\">Shademap is a feature for Stereoscopic images, but we can use it for a trick in 3 steps. Start flaggin &#8220;depth of field&#8221; in the V-Ray Camera, then:<\/span><\/p>\n<ol>\n<li>Put in the scene the object <strong>VRayStereoscopic\u00c2\u00a0<\/strong>(create&gt;\u00c2\u00a0helpers&gt;\u00c2\u00a0vray)<\/li>\n<li>Set\u00c2\u00a0Shademap as &#8220;<strong>Render\u00c2\u00a0shape\u00c2\u00a0map<\/strong>&#8221; and then run a first render<\/li>\n<li>Set Shademap as &#8220;<strong>Use Shape map<\/strong>&#8221; and run the\u00c2\u00a0final render<\/li>\n<\/ol>\n<p style=\"text-align: center;\">That&#8217;s just a summary. Let&#8217;s go to see the tutorial step-by-step.<\/p>\n<p style=\"text-align: center;\">.<\/p>\n<p><strong>1)<\/strong> Insert\u00c2\u00a0the object\u00c2\u00a0<strong>create&gt;\u00c2\u00a0helpers&gt;\u00c2\u00a0VRay&gt;\u00c2\u00a0VRayStereoscopic<\/strong>.\u00c2\u00a0Set eye-distance =\u00c2\u00a00.0\u00c2\u00a0and set &#8220;mode&#8221; = &#8220;Render Shade Map&#8221;, then assign a file to store the result.<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1013\" alt=\"\" src=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/stereo-cgb.jpg\" width=\"540\" height=\"304\" srcset=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/stereo-cgb.jpg 540w, https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/stereo-cgb-300x168.jpg 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><br \/>\n( Actually\u00c2\u00a0<strong>VRayStereoscopic\u00c2\u00a0<\/strong>is used to create stereoscopic images for\u00c2\u00a03D\u00c2\u00a0glasses,\u00c2\u00a0but for now it&#8217;s the only way\u00c2\u00a0to access Shademap.\u00c2\u00a0This feature\u00c2\u00a0will be\u00c2\u00a0opened to the public, but\u00c2\u00a0for now we need this trick.)<\/p>\n<p style=\"text-align: center;\">.<\/p>\n<p><strong>2)<\/strong> Run the first render and got an image without Dof in 7mins. Even if I activated Dof, this first image does not calculate it. Don&#8217;t worry about \ud83d\ude09<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1014\" alt=\"\" src=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/2-rendershade-cgb.jpg\" width=\"540\" height=\"600\" srcset=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/2-rendershade-cgb.jpg 540w, https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/2-rendershade-cgb-270x300.jpg 270w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><br \/>\n(I don&#8217;t need this first image, it&#8217;s just a first step to calculate and store the shademap)<\/p>\n<p style=\"text-align: center;\">.<\/p>\n<p><strong>3)<\/strong> Back in\u00c2\u00a0<strong>VRayStereoscopic<\/strong> object and <strong>change its mode in &#8220;Use Shape Map&#8221;<\/strong>. In the next render I&#8217;ll use the data stored in the previous one!<\/p>\n<p>Hit render and get a\u00c2\u00a0render with\u00c2\u00a0DOF\u00c2\u00a0(approximate)\u00c2\u00a0in 2 &#8217;50 &#8220;:<br \/>\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-1015\" alt=\"\" src=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/3-useshade-cgb.jpg\" width=\"540\" height=\"600\" srcset=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/3-useshade-cgb.jpg 540w, https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/3-useshade-cgb-270x300.jpg 270w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/p>\n<p>(When you run a stereoscopic render you got 2 different images,\u00c2\u00a0slightly different,\u00c2\u00a0as the distance\u00c2\u00a0deviated\u00c2\u00a0eye\u00c2\u00a0set.\u00c2\u00a0In this\u00c2\u00a0case the output is identical so\u00c2\u00a0stop the\u00c2\u00a0calculation after\u00c2\u00a0the 1st image)<\/p>\n<p><strong>HERE THE TOTALS<\/strong>:<\/p>\n<ul>\n<li><strong>Regular Dof<\/strong>\u00c2\u00a0=\u00c2\u00a018&#8242; 50&#8243;<\/li>\n<li><strong>Approximate Dof<\/strong> =\u00c2\u00a07&#8242; 30 &#8220;+\u00c2\u00a02&#8242; 50&#8243;\u00c2\u00a0=\u00c2\u00a010&#8242; 10 &#8220;<\/li>\n<\/ul>\n<p><a name=\"premium\"><\/a><br \/>\nIt&#8217;s clear there is a difference\u00c2\u00a0between the two results in terms of &#8220;pixels&#8217; : A mathematically\u00c2\u00a0more precise\u00c2\u00a0rendering\u00c2\u00a0takes longer than\u00c2\u00a0an\u00c2\u00a0approximate one,\u00c2\u00a0this is pretty\u00c2\u00a0obvious.<\/p>\n<p><strong>Your skill is in deciding how to balance mathematical precision and visual perception. In this case the approximation does not affect the perception, so you can use this trick.<\/strong><\/p>\n<p><strong style=\"line-height: 1.5em;\">WATCH THE VIDEO<\/strong><span style=\"line-height: 1.5em;\"> :<\/span><\/p>\n<p><iframe loading=\"lazy\" src=\"http:\/\/player.vimeo.com\/video\/34401603?color=ff9933\" height=\"337\" width=\"599\" frameborder=\"0\"><\/iframe><\/p>\n<p><strong>VIDEO SUMMARY<\/strong>:<\/p>\n<ol>\n<li>Download the <a href=\"https:\/\/www.cg-blog.com\/wp-content\/uploads\/2011\/12\/dof-faster-start.zip\">start scene<\/a>;<\/li>\n<li>Enable dof, add VRay Stereoscopic (eye distance = 0,0);<\/li>\n<li>Enable &#8220;Render Shade map&#8221; option;<\/li>\n<li>click <strong>Browse<\/strong> to give a name to the shademap file (.vrst format);<\/li>\n<li>Hit a pre render&#8230; (don&#8217;t save it!);<\/li>\n<li>Change shade map mode in &#8220;Use Shade Map&#8221;;<\/li>\n<li>Hit render once again;<\/li>\n<li>Render just the first half image.<\/li>\n<\/ol>\n<p><strong>EXERCISE:<\/strong><br \/>\nDownload pack: <a href=\"https:\/\/www.cg-blog.com\/files\/Premium\/dof-faster.zip\">dof-faster.zip<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever rendered with Depth of Field effect in V-Ray? There&#8217;s a significant increase in rendering time. We can use an hidden feature called Shademap to reduce time rendering with Dof directly in V-Ray.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false},"categories":[24,60],"tags":[40],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/posts\/1010"}],"collection":[{"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/comments?post=1010"}],"version-history":[{"count":0,"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/posts\/1010\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/media?parent=1010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/categories?post=1010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cg-blog.com\/index.php\/wp-json\/wp\/v2\/tags?post=1010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}