I would recommend just using volume shapes instead of excessive raycasting because it is likely more performant than the resolution you’d want with raycasting. That suggestion was given assuming the developer needed to be able to blend ambience dynamically between multiple large adjacent biomes. If you don’t need this kind of behavior, and blending fully into one ambience or the next is sufficient, I would recommend just using volumes.
These would have to be statically placed by the developer, or generated once and then registered however.
This was bumped recently, maybe check this out:
Or you can write your own, Fractality has written a cool article about doing this in an optimized way:
- Single-matrix point-OBB test. Testing a point against a box is a… | by Fractality | Medium
- Fast trigger volumes · GitHub
I’m currently experimenting with this in my own game. I use a “priority stack” to track which biome a player is currently active in, so you can have overlapping volumes, and cave volumes within biome volumes.