Last Monday Eric mentioned focus stacking. At one of the meetings awhile back (Aug, 2022 maybe) I did a little spiel on focus stacking.
Here's one of the photos I used for that. If you look at the photos FS1-FS8, those are the individual photos I took to stack, Shot front to rear, you can see how the focus moves to the rear. FS9 is the completed image after stacking.
FS10 is a screenshot of how photoshop put the images together. If you look at the black and white masks, you can see in the white areas where the sharpest part of each image that PS chose for the composite. FS11 is one of those sections, the third one up from the bottom.