<?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 z-depth element not rendering when antialiasing disabled in 3ds Max Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12911672#M2725</link>
    <description>&lt;P&gt;I need to use the texture obtained from the z-depth renderElement for depth testing to perform some occlusion culling. For extreme cases, such as when the model is particularly small and occupies only a few pixels in the z-depth map, if anti-aliasing is enabled, its grayscale value will be "polluted," making it hard to make correct judgments. However, the problem is, when I try to turn off anti-aliasing, the z-depth simply does not render at all?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Max 2023.3.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20240722-162738.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1389402iDDE81E39689E7CB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="20240722-162738.gif" alt="20240722-162738.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2024 08:36:31 GMT</pubDate>
    <dc:creator>futengda</dc:creator>
    <dc:date>2024-07-22T08:36:31Z</dc:date>
    <item>
      <title>z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12911672#M2725</link>
      <description>&lt;P&gt;I need to use the texture obtained from the z-depth renderElement for depth testing to perform some occlusion culling. For extreme cases, such as when the model is particularly small and occupies only a few pixels in the z-depth map, if anti-aliasing is enabled, its grayscale value will be "polluted," making it hard to make correct judgments. However, the problem is, when I try to turn off anti-aliasing, the z-depth simply does not render at all?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Max 2023.3.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="20240722-162738.gif" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1389402iDDE81E39689E7CB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="20240722-162738.gif" alt="20240722-162738.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2024 08:36:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12911672#M2725</guid>
      <dc:creator>futengda</dc:creator>
      <dc:date>2024-07-22T08:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12913995#M2726</link>
      <description>&lt;P&gt;I messed around for a while trying to find a way to trick it, but failed. I'm assuming you need to use scanline specifically.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;The filtering checkbox seems to have no effect, which isn't helpful.&lt;/LI&gt;
&lt;LI&gt;The behavior seems to be different by renderer, so it must be a quirk with scanline specifically.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Tried to find an AA method that let me set the value to 0 to try to trick it, but no.&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Tried to find a command that might let me do it but also failed.&amp;nbsp;&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;Tried disable all samplers checkbox, no dice.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;You might have some luck with &lt;A href="https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-3667A33C-E3E4-4F39-A480-3713240838F1" target="_blank" rel="noopener"&gt;this&lt;/A&gt; if you are comfortable scripting, otherwise maybe the trick is to put the zdepth channel info in an output map and tweak the min / max value or possibly adjust the gamma.&amp;nbsp; If you could clip out the very top and bottom it might help. Otherwise, the answer is probably a programmatical version of compositing methods, perhaps &lt;A href="https://help.autodesk.com/view/MAXDEV/2023/ENU/?guid=GUID-9F6ABEE1-0728-4B39-8903-D909634C1304" target="_blank" rel="noopener"&gt;this documentation&lt;/A&gt; can help, specifically GetPixels().&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 08:36:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12913995#M2726</guid>
      <dc:creator>Diffus3d</dc:creator>
      <dc:date>2024-07-23T08:36:04Z</dc:date>
    </item>
    <item>
      <title>Re: z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914032#M2727</link>
      <description>&lt;P&gt;Thanks for the reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, this is the problem I encountered while using MaxScript. Since I need to use a 16-bit depth map for high-precision judgments, the &lt;STRONG&gt;`getChannelAsMask`&lt;/STRONG&gt; method mentioned in this &lt;A href="https://help.autodesk.com/view/MAXDEV/2024/ENU/?guid=GUID-3667A33C-E3E4-4F39-A480-3713240838F1" target="_blank" rel="noopener"&gt;link&lt;/A&gt; is not sufficient. Therefore, my approach is to use the &lt;STRONG&gt;Render API&lt;/STRONG&gt;, along with &lt;STRONG&gt;`maxOps.GetCurRenderElementMgr.AddRenderElement zDepthElement`&lt;/STRONG&gt;. In this process, I use the Render API's &lt;STRONG&gt;`renderElements:true`&lt;/STRONG&gt; and &lt;STRONG&gt;`renderElementBitmaps:&amp;amp;reb`&lt;/STRONG&gt; properties. Everything works perfectly until I encounter the antialiasing issue mentioned above. So, I tried adding the &lt;STRONG&gt;`antiAliasing:false`&lt;/STRONG&gt; property in the Render API, but the resulting depth map turned out completely black. Then, I tried to replicate the Render API usage through the GUI, and found that the result was the same, as shown above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the complete code is:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;render camera:MyCam outputsize:[512,512] channels:#(#zDepth) \
    renderElements:true renderElementBitmaps:&amp;amp;reb renderhiddenobjects:false vfb:off  \
    antiAliasing:false -- !!!NOTE: this will make the depthmap completely black&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I believe this issue is common and unrelated to whether it's through the GUI or a script.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Finally, based on the current situation, the only solution for me at the moment is to increase the resolution of the output size.&lt;/DIV&gt;</description>
      <pubDate>Tue, 23 Jul 2024 08:59:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914032#M2727</guid>
      <dc:creator>futengda</dc:creator>
      <dc:date>2024-07-23T08:59:28Z</dc:date>
    </item>
    <item>
      <title>Re: z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914047#M2728</link>
      <description>&lt;P&gt;It's a bit beyond me I'm afraid.&amp;nbsp; Problem turned out to be much trickier than anticipated.&amp;nbsp; You might have more luck in the programming subforum.&amp;nbsp; Best of luck, sorry things didn't pan out yet.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 09:05:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914047#M2728</guid>
      <dc:creator>Diffus3d</dc:creator>
      <dc:date>2024-07-23T09:05:11Z</dc:date>
    </item>
    <item>
      <title>Re: z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914066#M2729</link>
      <description>Thank you, but how can I move this issue to another board?</description>
      <pubDate>Tue, 23 Jul 2024 09:15:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914066#M2729</guid>
      <dc:creator>futengda</dc:creator>
      <dc:date>2024-07-23T09:15:22Z</dc:date>
    </item>
    <item>
      <title>Re: z-depth element not rendering when antialiasing disabled</title>
      <link>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914089#M2730</link>
      <description>&lt;P&gt;You can maybe report your own thread and ask the moderators.&amp;nbsp; Not sure if that's the proper way, but I don't have the user level to move a thread.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best Regards,&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2024 09:24:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-forum/z-depth-element-not-rendering-when-antialiasing-disabled/m-p/12914089#M2730</guid>
      <dc:creator>Diffus3d</dc:creator>
      <dc:date>2024-07-23T09:24:43Z</dc:date>
    </item>
  </channel>
</rss>

