So I am currently making a little game that uses a Minecraft-esque (voxel) system to generate terrain. It runs using a compressed matrix that tracks where all of the pieces of the map are. (simplified explanation) So each cell says if a building, road, river, or ground is at that point, along with the z position. This gives me amazing control over terrain and allows me to generate random terrain with code.
So with large towering mountains I find myself having to render objects that lay behind the mountain where the player can obviously not see, so I am trying to write code that makes all the objects that can’t be seen invisible using obj.visible = False . I have done test and it does reduce the rasterizing calculations dramatically. I am having trouble with figuring out what is seen by the player and what is not seen. I was thinking of using a ray trace, but the amount of ray traces I would have to do would be outrageous and slow the game down. I have also been trying to utilize my point cloud matrix (which is what the world is spawned on) to ray trace per object in a simpler matrix (as opposed to using the blender engine), little success there too. So I am wondering if there is something I missed where the engine can detect which objects are “hit” by a light. I could put a light where the camera is, make it invisible to the player, and whatever it hits I would tell to be visible, and anything not hit would be invisible. That would be the ideal situation, but I have no idea if that can even be done in the engine. I know the engine already “skips” over rendering the objects behind the camera, but that only goes so far.
I would really like to utilize my point cloud matrix to do the calculations because it would be faster to calculate scanning a matrix than it would be scanning in the the engine. So if you can think there is a way to do it like that, that would also be useful.
If you would like me to go into further detail on something just ask and I will do my best to clear it up.