The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
How to do "culling/occluded edges" effect? (like in Minecraft demo)
I am curious what is the technique used to "boolean/occlusion cull" (not sure how else to describe) objects inside of a volume, as demo'd in the E3 Minecraft video or this one right here? https://youtu.be/0rE4MwLK1eE?t=56
(sorry, fast forward to 55 seconds)
I was using depth-masked border geo but that is a bad solution since they will cut out everything behind them, whereas this has more of a proper "boolean" effect that I find is perfect for my needs..
Best Answer
-
Optionsahillier mod
There are probably multiple solutions to this, and I don't have enough shader experience to tell you which is best, but here is what I would try....
One way is to put an occlusion mask on your bounding object (use the HoloToolkit's Occlusion shader, or Unity's' Legacy Shaders / Diffuse Fast' and set the color to black (0,0,0,0)). For all of your other assets, use a shader that only renders when the object is occluded (set 'ZWrite Off' and 'ZTest Greater'). You can find a shader that does this in the Holograms 230 - Spatial Mapping class (OcclusionGrid.shader). Now, the only objects that should be visible, are those within the bounding volume.
This image shows the effect (clylinders and cubes rendered within an ellipsoid volume):
Another solution might be to have a single shader that only renders objects within a specified bounding volume. You'll have to get the position of each vertex in world coordinates and then check that a pixel falls within the coordinates of the bounding volume before it is rendered.
I hope this helps,
~Angela5
Answers
There are probably multiple solutions to this, and I don't have enough shader experience to tell you which is best, but here is what I would try....
One way is to put an occlusion mask on your bounding object (use the HoloToolkit's Occlusion shader, or Unity's' Legacy Shaders / Diffuse Fast' and set the color to black (0,0,0,0)). For all of your other assets, use a shader that only renders when the object is occluded (set 'ZWrite Off' and 'ZTest Greater'). You can find a shader that does this in the Holograms 230 - Spatial Mapping class (OcclusionGrid.shader). Now, the only objects that should be visible, are those within the bounding volume.
This image shows the effect (clylinders and cubes rendered within an ellipsoid volume):
Another solution might be to have a single shader that only renders objects within a specified bounding volume. You'll have to get the position of each vertex in world coordinates and then check that a pixel falls within the coordinates of the bounding volume before it is rendered.
I hope this helps,
~Angela