Apologize for the horrible image, I am in a moving vehicle, but I hope it serves as an illustration of my problem.
The short version of my question is: how do I properly clip only the part of the texture that is in the camera's view?
The longer version with context is this:
I am using a 3D ortho camera to render my sprites as billboards to avoid wasting time on y-sorting.
The next (or previous) step of my rendering pipeline is tilemaps. Instead of rendering individual tiles, I want to bake all my tilemap layers into same-sized textures and only update them as needed / overwrite them on scene changes.
The problem:
I have no idea what I'm doing, the math here seems to be just simple geometry but I can't get it to work. The world-space 2D coordinates match the texture coordinates 1:1, so I know there is a perfectly simple way to achieve this.
Currently I am doing:
I am already calculating an occlusion rectangle that is slightly smaller than the camera view for testing purposes, which works fine.
My next attempt will be maybe blasting it into the world, getting a world-space collision rect between it and the tilemap and using that as the source and dest rect for my billboard? Since they are both 1:1 in size, this should... work. Though I am probably not accounting for something here.
If anyone has any pointers, I would appreciate it.