Constraining a slippy map to a tabletop
I have an idea for a VR project, but not sure how to implement a specific piece of it.
I'm using the Mapbox SDK for Unity (https://www.mapbox.com/unity-sdk/) and have that working so I can move an empty object around and have the map load more tiles as the target pans around the XZ plane. Like this: https://i2.wp.com/unity3d.college/wp-content/uploads/2017/05/Slippy-Demo.gif (not my gif). The map is a dynamic container for tiles which are generated on the fly, and have 3D shape (so its not a single terrain object).
I want to constrain that map to a tabletop (in VR), and let the user pan it around. Sort of like this game (http://store.steampowered.com/app/542770/Castle_Must_Be_Mine/ , but that game doesn't move the map at all; and it's not real world data). I want the 3D map surface to truncate at the edge of the table (and thus new tiles pre-load off-table). The table may not be rectangular, ideally -- circular or polygonal should be possible too.
What is the technique for doing this? I've looked into alpha-masking, but that seems to be only for 2D surfaces. I feel like it should be a secondary camera with custom culling, but not sure.
$$anonymous$$aybe masking with the Stencil Buffer is what you're looking for. Do some research on that.