<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Round corners don't render. in 3ds Max Shading, Lighting and Rendering Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955054#M9782</link>
    <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1739489"&gt;@madsd&lt;/a&gt; - I want to mark your post as the solution because it apparently works. But I am missing something... Your result looks great, but my render of your file has dark edges where I should see highlights. I've attached my rendering - the small box is a chamfer-box from the extended primitives to show the effect I was hoping for, but your renderings are much closer to this effect than mine. What am I missing?</description>
    <pubDate>Tue, 24 Apr 2018 09:42:18 GMT</pubDate>
    <dc:creator>pcrawley</dc:creator>
    <dc:date>2018-04-24T09:42:18Z</dc:date>
    <item>
      <title>Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7936905#M9775</link>
      <description>&lt;P&gt;If I import a model in from another Autodesk application - say, Inventor - it brings with it the Autodesk Material assignment from the sending application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the case of the attached sample, I put "Wall Paint" on the object in Inventor, then imported it into max.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the slate material editor, I can see the default "Round_Corner_Source" option - but it's not supported by either the&amp;nbsp;ART or Arnold renderers.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea how I can simulate a similar effect in max 2018 or 2019?&amp;nbsp; (Reference material &lt;A title="3ds max help file" href="https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/3DSMax-Lighting-Shading/files/GUID-2BE2265A-E1BA-40ED-9D0B-A627054CA963-htm.html" target="_blank"&gt;here&lt;/A&gt;.)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally, I'd like to find a shader solution if possible because there are hundreds of objects in hundreds of files that need updating and they don't look as good without the rounded corners provided by the old mental ray shader.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 04:12:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7936905#M9775</guid>
      <dc:creator>pcrawley</dc:creator>
      <dc:date>2018-04-17T04:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7937082#M9776</link>
      <description>We actually talked about this yesterday. You can do an approximation with OSL which will look fine from a distance since it works on the normals. I don't have time right now, else I was already on the move to implement a first attempt to replicate the one you mention, as OSL or C .dll in worst case scenario. I hope I can find time, it is an interesting task to solve.</description>
      <pubDate>Tue, 17 Apr 2018 06:37:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7937082#M9776</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-04-17T06:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7937587#M9777</link>
      <description>This should be in Arnold. Also the ability to bake it in normal maps &lt;A href="https://forums.autodesk.com/t5/3ds-max-ideas/bake-rounded-edge-shader-to-normal-maps/idi-p/7894686" target="_blank"&gt;https://forums.autodesk.com/t5/3ds-max-ideas/bake-rounded-edge-shader-to-normal-maps/idi-p/7894686&lt;/A&gt; Apparently they are considering the possibility of baking textures with Arnold, that I think is quite basic and should be implemented since it was integrated in Max. &lt;A href="https://forums.autodesk.com/t5/3ds-max-ideas/bake-rounded-edge-shader-to-normal-maps/idi-p/7894686" target="_blank"&gt;https://forums.autodesk.com/t5/3ds-max-ideas/bake-rounded-edge-shader-to-normal-maps/idi-p/7894686&lt;/A&gt;</description>
      <pubDate>Tue, 17 Apr 2018 10:21:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7937587#M9777</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-17T10:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7939409#M9778</link>
      <description>&lt;P&gt;I'm not there yet, but the Arnold Curvature map does an excellent job of finding concave and convex edges. Now I need to turn that into a highlight, not a flipped normal!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Judging by the comments, I'm not alone. OSL sounds like a good plan, but no use for a customer stuck at 2018 &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; I'm looking at this for someone who moved from 2016 to 2018 and lost mental ray but doesn't yet have access to OSL.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looking good from a distance is all I'm after - the models are all machinery clad in painted sheet metal, so it doesn't require subdivision or displacement techniques. "Round Edges" was such a useful tick-box option - I had no idea how hard it was to replicate!&lt;/P&gt;</description>
      <pubDate>Tue, 17 Apr 2018 20:32:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7939409#M9778</guid>
      <dc:creator>pcrawley</dc:creator>
      <dc:date>2018-04-17T20:32:05Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7940116#M9779</link>
      <description>&lt;P&gt;Check this one, works fine, you can make a dublicate and do the convex part as well and mix them together.&lt;/P&gt;&lt;P&gt;Also added a max file saved back to 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://i.imgur.com/keb6Cac.jpg" target="_blank"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2018-04-18_07-11-55.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/489935i5F7F1026C92FCDB4/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-04-18_07-11-55.jpg" alt="2018-04-18_07-11-55.jpg" /&gt;&lt;/span&gt;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 05:23:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7940116#M9779</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-04-18T05:23:27Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7941632#M9780</link>
      <description>&lt;P&gt;Great! We only need it to bake as normal maps... but even without it is cool.&lt;/P&gt;&lt;P&gt;This is also using denoise.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/490220i78F7694BA5085721/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/490225i18EC272BB48388E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Apr 2018 14:38:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7941632#M9780</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-04-18T14:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7941914#M9781</link>
      <description>Super, Baking is not yet supported, but dev knows the need for it.</description>
      <pubDate>Wed, 18 Apr 2018 15:38:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7941914#M9781</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-04-18T15:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955054#M9782</link>
      <description>&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1739489"&gt;@madsd&lt;/a&gt; - I want to mark your post as the solution because it apparently works. But I am missing something... Your result looks great, but my render of your file has dark edges where I should see highlights. I've attached my rendering - the small box is a chamfer-box from the extended primitives to show the effect I was hoping for, but your renderings are much closer to this effect than mine. What am I missing?</description>
      <pubDate>Tue, 24 Apr 2018 09:42:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955054#M9782</guid>
      <dc:creator>pcrawley</dc:creator>
      <dc:date>2018-04-24T09:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955063#M9783</link>
      <description>&lt;P&gt;The "nice" one looks good. We already talked about this another place, Martin Breidt caught it some days ago and told me. I found that installing a domelight with no maps in solved a uniform distribution, it is like the normals are inverted, but not in a way you would expect. Now, here is a thing to try first, Martin mentioned that if you restart the render session it will clear up, it should only happen if you are moving around in the view. It has been reported as a bug report already. I will however, look into it and see if we can fix it with some work around, or just aviod what breaks it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try disable the HDR map, and use just pure white in a test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can see here, the technical foundament is working. Evenly distributed masks.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2018-04-24_11-54-59.jpg" style="width: 394px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/492563iBB3D13003B09E6B8/image-size/large?v=v2&amp;amp;px=999" role="button" title="2018-04-24_11-54-59.jpg" alt="2018-04-24_11-54-59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Apr 2018 09:56:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955063#M9783</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-04-24T09:56:21Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955922#M9784</link>
      <description>I remember old thread in blender comunnity where Round corners was coded on OSL for blender &lt;A href="https://blenderartists.org/forum/showthread.php?329295-Bevel-shader" target="_blank"&gt;https://blenderartists.org/forum/showthread.php?329295-Bevel-shader&lt;/A&gt;</description>
      <pubDate>Tue, 24 Apr 2018 15:11:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955922#M9784</guid>
      <dc:creator>RGhost77</dc:creator>
      <dc:date>2018-04-24T15:11:16Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955926#M9785</link>
      <description>Right, that also works in max.</description>
      <pubDate>Tue, 24 Apr 2018 15:12:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7955926#M9785</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-04-24T15:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7982696#M9786</link>
      <description>&lt;P&gt;Here's an OSL rounded edges shader from 2014, created for Blender. I'm no programmer but I'm guessing that the script is universal across all renderers considering the whole OSL factor..... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Just thought I'd post it here in case somebody like Mads knows what to do with it.(if anything)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;rng_seed&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;output &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; rng, &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; seed&lt;/SPAN&gt;)&lt;/SPAN&gt;{
  &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; chash = seed;
  &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (chash == &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;) chash = &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;;
  rng = chash * &lt;SPAN class="hljs-number"&gt;30391861&lt;/SPAN&gt;;
}

&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;rng_uniform&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;output &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; rng&lt;/SPAN&gt;)&lt;/SPAN&gt;{
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; res = rng / &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt;(&lt;SPAN class="hljs-number"&gt;2137483647&lt;/SPAN&gt;) * &lt;SPAN class="hljs-number"&gt;0.5&lt;/SPAN&gt; + &lt;SPAN class="hljs-number"&gt;0.5&lt;/SPAN&gt;;
  rng *= &lt;SPAN class="hljs-number"&gt;30391861&lt;/SPAN&gt;;
  &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; res;
}

&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;to_unit_disk&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;&lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; x, &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; y, output &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; x_out, output &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; y_out&lt;/SPAN&gt;)&lt;/SPAN&gt;{
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; r, phi;
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; a = &lt;SPAN class="hljs-number"&gt;2.0&lt;/SPAN&gt; * x - &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; b = &lt;SPAN class="hljs-number"&gt;2.0&lt;/SPAN&gt; * y - &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
    
  &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(a &amp;amp;gt; -b) 
  { &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(a &amp;amp;gt; b) 
    { r = a;
      phi = M_PI_4 *(b/a);
    }
    &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; 
    { r = b;
      phi = M_PI_4 *(&lt;SPAN class="hljs-number"&gt;2.0&lt;/SPAN&gt; - a/b);
  } }
  &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; 
  { &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(a &amp;amp;lt; b) 
    { r = -a;
      phi = M_PI_4 *(&lt;SPAN class="hljs-number"&gt;4.0&lt;/SPAN&gt; + b/a);
    }
    &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; 
    { r = -b;
      &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(b != &lt;SPAN class="hljs-number"&gt;0.0&lt;/SPAN&gt;) phi = M_PI_4 *(&lt;SPAN class="hljs-number"&gt;6.0&lt;/SPAN&gt; - a/b);
      &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; phi = &lt;SPAN class="hljs-number"&gt;0.0&lt;/SPAN&gt;;
  } }
  x_out = r * cos(phi);
  y_out = r * sin(phi);
}

&lt;SPAN class="hljs-function"&gt;&lt;SPAN class="hljs-keyword"&gt;void&lt;/SPAN&gt; &lt;SPAN class="hljs-title"&gt;make_orthonormals&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;vector N, output vector a, output vector b&lt;/SPAN&gt;)&lt;/SPAN&gt;{
  &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(N[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;] != N[&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;] || N[&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;] != N[&lt;SPAN class="hljs-number"&gt;2&lt;/SPAN&gt;]) a = cross(vector(&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;), N);
  &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; a = cross(vector(&lt;SPAN class="hljs-number"&gt;-1&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;, &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;), N);
  
  a = normalize(a);
  b = cross(N, a);
}

&lt;SPAN class="hljs-function"&gt;vector &lt;SPAN class="hljs-title"&gt;sample_cos_hemisphere&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;vector N, &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; randu, &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; randv&lt;/SPAN&gt;)&lt;/SPAN&gt;{
  vector T, B;
    
  make_orthonormals(N, T, B);
  to_unit_disk(randu, randv, randu, randv);
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; costheta = sqrt(max(&lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt; - randu * randu - randv * randv, &lt;SPAN class="hljs-number"&gt;0.0&lt;/SPAN&gt;));

  &lt;SPAN class="hljs-keyword"&gt;return&lt;/SPAN&gt; randu * T + randv * B + costheta * N;
}

&lt;SPAN class="hljs-function"&gt;shader &lt;SPAN class="hljs-title"&gt;node_occlusion2&lt;/SPAN&gt;(&lt;SPAN class="hljs-params"&gt;  color Effect = color(&lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;&lt;/SPAN&gt;),
  color No_Effect &lt;/SPAN&gt;= color(&lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;),
  &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; Mode = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;, &lt;SPAN class="hljs-comment"&gt;/* 0: Concave (AO) 1:Convex (Wear) 2:Both */&lt;/SPAN&gt;
  &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; InvertEffect = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;,
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; Distance = &lt;SPAN class="hljs-number"&gt;0.2&lt;/SPAN&gt;,
  &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; Samples = &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;,
  output color Color = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;,
  output &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; Fac = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;,
  output normal outNormal = N
)
{
  &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; i, rng;
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; f, randu, randv, ray_t, hits = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;;
  vector ray_P, ray_R;
  normal hit_normal = N;
  &lt;SPAN class="hljs-keyword"&gt;float&lt;/SPAN&gt; hit_dist;

  f = fmod(cellnoise(P*&lt;SPAN class="hljs-number"&gt;123456.0&lt;/SPAN&gt;), &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;);
  rng_seed(rng, &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt;(f * &lt;SPAN class="hljs-number"&gt;21374647&lt;/SPAN&gt;));
  
  &lt;SPAN class="hljs-keyword"&gt;for&lt;/SPAN&gt;(i = &lt;SPAN class="hljs-number"&gt;0&lt;/SPAN&gt;; i &amp;amp;lt; Samples; i++) 
  { randu = rng_uniform(rng);
    randv = rng_uniform(rng);
       
    ray_P = P;
    ray_R = sample_cos_hemisphere(-N, randu, randv);
    ray_t = Distance;
    
        
    &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (!Mode)
    { &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(trace(ray_P, -ray_R, &lt;SPAN class="hljs-string"&gt;"maxdist"&lt;/SPAN&gt;, ray_t)) {
            hits += &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
            &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; HitNormal = getmessage (&lt;SPAN class="hljs-string"&gt;"trace"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"N"&lt;/SPAN&gt;, hit_normal);
            outNormal = outNormal + (hit_normal);
        }
    }
    &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt; (Mode == &lt;SPAN class="hljs-number"&gt;1&lt;/SPAN&gt;)
    { &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(trace(ray_P, ray_R, &lt;SPAN class="hljs-string"&gt;"maxdist"&lt;/SPAN&gt;, ray_t)) {
           hits += &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
           &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; HitNormal = getmessage (&lt;SPAN class="hljs-string"&gt;"trace"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"N"&lt;/SPAN&gt;, hit_normal);
           outNormal = outNormal - (hit_normal);
        }
    }
    &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; { 
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(trace(ray_P, -ray_R, &lt;SPAN class="hljs-string"&gt;"maxdist"&lt;/SPAN&gt;, ray_t)) {
            hits += &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
            &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; HitNormal = getmessage (&lt;SPAN class="hljs-string"&gt;"trace"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"N"&lt;/SPAN&gt;, hit_normal);
            outNormal = outNormal + (hit_normal);
        }
        &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(trace(ray_P, ray_R, &lt;SPAN class="hljs-string"&gt;"maxdist"&lt;/SPAN&gt;, ray_t)) {
           hits += &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt;;
           &lt;SPAN class="hljs-keyword"&gt;int&lt;/SPAN&gt; HitNormal = getmessage (&lt;SPAN class="hljs-string"&gt;"trace"&lt;/SPAN&gt;, &lt;SPAN class="hljs-string"&gt;"N"&lt;/SPAN&gt;, hit_normal);
           outNormal = outNormal - (hit_normal);
        }
    } 
  }
  Fac = &lt;SPAN class="hljs-number"&gt;1.0&lt;/SPAN&gt; - (hits/Samples);
  &lt;SPAN class="hljs-keyword"&gt;if&lt;/SPAN&gt;(InvertEffect) Color = mix(No_Effect, Effect, Fac);
  &lt;SPAN class="hljs-keyword"&gt;else&lt;/SPAN&gt; Color = mix(Effect, No_Effect, Fac);
  outNormal = normalize(outNormal);
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 06 May 2018 04:23:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7982696#M9786</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-06T04:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7982921#M9787</link>
      <description>&lt;P&gt;I had to correct 4 things for it to compile in 3dsmax, else base is identical to the one I posted in "OSL tip of the day thread" - with a normal hook in addition.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 06 May 2018 11:20:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7982921#M9787</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-05-06T11:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983300#M9788</link>
      <description>&lt;P&gt;Thanks Mads, can you post up the recompiled version? There are people going insane at Polycount forums for this feature to be native in Max. Baking clean tangent Normal maps from rounded edges shader is like the holy grail to us game asset creators. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Who knows, maybe someday we'll have the open-source MIKK tangent basis added to Max so we can finally be on par with every other program.....RTT certainly needs some love after all these years.&lt;/P&gt;</description>
      <pubDate>Sun, 06 May 2018 19:36:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983300#M9788</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-06T19:36:49Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983379#M9789</link>
      <description>&lt;P&gt;Got a link to this open source code? I'd like to port it to OSL if possible.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm making an attempt to make xNormal redundant, I have a good stack of features done already, including some of the tool converters. Bitmap to Normal and Cavity / displacement, reflection etc are done already. AO I suspect wont take long either, a guy requested Density and Subsurfacemap, I looked into those too, but need to study some more.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached the fixed recomile.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;A href="https://www.dropbox.com/s/9xblpttxyys4hf3/Normal_Mesh.osl?dl=0" target="_blank"&gt;https://www.dropbox.com/s/9xblpttxyys4hf3/Normal_Mesh.osl?dl=0&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 06 May 2018 21:26:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983379#M9789</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-05-06T21:26:23Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983977#M9790</link>
      <description>&lt;P&gt;Mads, that is some seriously encouraging news. I know you're probably creating this with Arch-vis/VFX artists in mind, but we poor folk in the games industry could do with some love. :)And the one single thing that would change people's entire concept of baking in Max is the MIKK Tangent basis. It basically ensures that tangents and bi-normals are synced across all programs that use it. f you were to implement MikkT into Max you better be prepared for some serious adulation from the games dev community! The main maps we bake in game dev are: (straight from substance)&lt;/P&gt;&lt;P&gt;Normal map&lt;/P&gt;&lt;P&gt;ID map&lt;/P&gt;&lt;P&gt;World space normal&lt;/P&gt;&lt;P&gt;AO&lt;/P&gt;&lt;P&gt;Curvature&lt;/P&gt;&lt;P&gt;Position&lt;/P&gt;&lt;P&gt;Thickness&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the MIKKT source code. It comes in 2 files: mikktspace.h and mikktspace.c&lt;/P&gt;&lt;P&gt;And here's the link to the Blender dev page where the file links are located with a description. &lt;A href="https://wiki.blender.org/index.php/Dev:Shading/Tangent_Space_Normal_Maps" target="_blank"&gt;https://wiki.blender.org/index.php/Dev:Shading/Tangent_Space_Normal_Maps&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And thanks a lot for the recompile. Excited to test it. Will post results.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers man,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Danny.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit: I pasted the code here but it exceeds the post character amount.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 07:50:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983977#M9790</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-07T07:50:17Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983985#M9791</link>
      <description>&lt;P&gt;Ok super, I'll have a go at it.&lt;/P&gt;&lt;P&gt;Everyone is on my mind, VFX, game devs, viz folks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 07:58:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983985#M9791</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-05-07T07:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983992#M9792</link>
      <description>&lt;P&gt;Brilliant. I'm very nerdy when it comes to normal maps so I'm very excited. Haha! Looking forward to seeing how you go.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 08:04:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7983992#M9792</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-07T08:04:43Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7984109#M9793</link>
      <description>&lt;P&gt;First test of the OSL you recompiled. Not really sure how to proceed. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Obviously it's picking up convex/concave normals and intersecting geo, but not the rounded edges effect.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="E1PzjRm" style="width: 360px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/497355iA343E98877A04582/image-size/large?v=v2&amp;amp;px=999" role="button" title="E1PzjRm" alt="E1PzjRm" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="D1TTYGW" style="width: 729px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/497356i6E5C881BA6C6B8AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="D1TTYGW" alt="D1TTYGW" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 09:07:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7984109#M9793</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-07T09:07:20Z</dc:date>
    </item>
    <item>
      <title>Re: Round corners don't render.</title>
      <link>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7984136#M9794</link>
      <description>&lt;P&gt;Yeah that's not how you would want to do it.&lt;/P&gt;&lt;P&gt;You need to create a filter, you do that with sampling the edges first with the mode 2 convex/concave, you parse that into an RGBA Mix OSL node, and pipe the filter to mix and the normals to color A and color B is 50% grey, this way all your edges gets normal if you pipe it to color.&lt;/P&gt;&lt;P&gt;Using diffuse slot is good for debugging.&lt;/P&gt;</description>
      <pubDate>Mon, 07 May 2018 09:23:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-shading-lighting-and/round-corners-don-t-render/m-p/7984136#M9794</guid>
      <dc:creator>madsd</dc:creator>
      <dc:date>2018-05-07T09:23:04Z</dc:date>
    </item>
  </channel>
</rss>

