I'd like to animate a train car entering and exiting a diorama from left to right. As the train car exits the station, "breaking the plane" that is the boundary of the station, the parts of the train car outside the station should be transparent.
Here's what the train car would look like passing through if there were no masking or holdouts or anything:
What I'd like is for it to be "chopped off" outside the diorama bounding box, resulting in something like this:
...but I don't want to accomplish this with booleans. It's way too expensive and intense, as the train will have many objects and shaders involved with it.
I can achieve the desired effect behind the station with compositing and render layers using holdouts. But the foreground part of the train as it exits, I'm lost on how to achieve that.