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
Solved! Go to Solution.
Solved by Diffus3d. Go to Solution.
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.
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
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.
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
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
Can't find what you're looking for? Ask the community or share your knowledge.