If I wanted to create an animation, each frame would have several seconds of rendering a completely transparent part, which adds up obviously. Is there a way to eliminate this waste of time?
There is nothing specifically designed into Blender to tell it to ignore the transparent areas currently.
That being said, there are some things we can do to help speed up the render somewhat.
- Transparent Background - Choose transparent in the Film section of the Render properties panel. This will render faster than a coloured background (whether full black or not)
- Tile Size- Choose a smaller tile size than your current (this tip is mostly for CPU rendering as GPU rendering generally uses larger tiles). This will help the render times when the buckets are processing the edge of the foreground element.
- Targeted Sampling - Use the Branched Path Tracing option in the Sampling section of the Render Properties panel. If you reduce the AA sample some what and raise the bounce samples (Diffuse, Glossy, etc.), you will reduce time spent on rendering the sky/transparent background.
- Cropped Render - this option is a little more extreme, but if you have an object that doesn't move much on screen, you can crop the render to only include the portions of the screen it's in. You'd then composite it together with the rest of the full frame renders.
Full disclosure, the add-on I'm about to recommend is a paid for add-on created by me, but I think it does what you need as it was built partially for the very task of skipping transparent parts of an image.
If you were rendering a still image you could use the 'render border' feature of blender to skip areas outside of the chosen area. For animations you can use my add-on, the Animated Render Border (link to Blender Market product page for add-on). This updates the render border every frame so it always surrounds the selected object or group and works both in the viewport and the final render, allowing the skipping of transparent parts for all frames. It also has an adjustable margin to allow for a slight border around the object.
Here is a (choppy) gif showing it in action: