Cull or hide Google building data out bounds

I’m currently working on a project where I need to hide building data and map layers that extend beyond a cylinder collider or any other collider shape. I’ve been unable to find a solution to hide tiles that fall outside of the defined bounds. While frustum culling works effectively, it is not suitable for my VR application. Is there an alternative approach or technique I can use to achieve this as the view points are just too far?

I have also tried getting using the debug hierarchy and getting all children that are active and hiding them if they are out of bounds. This is really not performant. Any help you can provide would be fantastic.

I think implementing a CesiumTileExcluder and a custom material will do what you want. More information here:

1 Like

This is awesome thank you. There is just 1 issue I’m struggling with. I have updated the Mat and Shader, but im still not able to get the clean cut. Any ideas why? I have updated the render with the correct mat

I also seem to be getting the below error too


In our example, the custom function discards fragments that are outside a box centered at the world origin. From your screenshot, the cube (which I assume you’re using as reference?) is not at the world origin, so the material area isn’t aligned with your intended clipping area. I’m surprised that your tileset is rendering despite the difference, but that’s my first guess.

You’ll have to account for the box collider’s actual world position, as well as its size, in the shader. If you’re adding rotation, that will also make things more complicated. You may need to input these elements as variables into the shader so you can more accurately match the area of exclusion on the non-shader side.

As for the error, we’re aware of it and we have a Github issue for it here.

1 Like

Thank you this helped a lot. Would you happen to have a road map for features for the Unity version? I can only find one for js.