Community
3ds Max Forum
Welcome to Autodesk’s 3ds Max Forums. Share your knowledge, ask questions, and explore popular 3ds Max topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

z-depth element not rendering when antialiasing disabled

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
futengda
397 Views, 5 Replies

z-depth element not rendering when antialiasing disabled

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? 

 

I'm using Max 2023.3.4

 

20240722-162738.gif

 

 

Tags (1)
Labels (3)
5 REPLIES 5
Message 2 of 6
Diffus3d
in reply to: futengda

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. 

 

  • The filtering checkbox seems to have no effect, which isn't helpful.
  • The behavior seems to be different by renderer, so it must be a quirk with scanline specifically. 
  • Tried to find an AA method that let me set the value to 0 to try to trick it, but no. 
  • Tried to find a command that might let me do it but also failed.  
  • Tried disable all samplers checkbox, no dice.

You might have some luck with this 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.  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 this documentation can help, specifically GetPixels().


Best Regards,

Alfred (AJ) DeFlaminis

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

View Max Tips/Tricks Megathread
Message 3 of 6
futengda
in reply to: Diffus3d

Thanks for the reply!

 

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 `getChannelAsMask` method mentioned in this link is not sufficient. Therefore, my approach is to use the Render API, along with `maxOps.GetCurRenderElementMgr.AddRenderElement zDepthElement`. In this process, I use the Render API's `renderElements:true` and `renderElementBitmaps:&reb` properties. Everything works perfectly until I encounter the antialiasing issue mentioned above. So, I tried adding the `antiAliasing:false` 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.

 

the complete code is:

 

 

render camera:MyCam outputsize:[512,512] channels:#(#zDepth) \
    renderElements:true renderElementBitmaps:&reb renderhiddenobjects:false vfb:off  \
    antiAliasing:false -- !!!NOTE: this will make the depthmap completely black

 

 

So, I believe this issue is common and unrelated to whether it's through the GUI or a script.

 

Finally, based on the current situation, the only solution for me at the moment is to increase the resolution of the output size.
Message 4 of 6
Diffus3d
in reply to: futengda

It's a bit beyond me I'm afraid.  Problem turned out to be much trickier than anticipated.  You might have more luck in the programming subforum.  Best of luck, sorry things didn't pan out yet.  

 

Best Regards,

Alfred (AJ) DeFlaminis

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

View Max Tips/Tricks Megathread
Message 5 of 6
futengda
in reply to: Diffus3d

Thank you, but how can I move this issue to another board?
Message 6 of 6
Diffus3d
in reply to: futengda

You can maybe report your own thread and ask the moderators.  Not sure if that's the proper way, but I don't have the user level to move a thread.  

 

Best Regards,

Alfred (AJ) DeFlaminis

EESignature


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

View Max Tips/Tricks Megathread

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report