Carter Collum used to spend mornings shoulder to shoulder with competitors in the record rooms of East Texas courthouses, hunting for the owners of underground natural-gas deposits. At night, he made house calls, offering payments and royalties for permission to drill. Mr. Collum worked as a landman, tracking the owners of oil and gas trapped in rock layers thousands of feet beneath the earth’s surface and getting their signatures, a job about as old as the American petroleum industry.

He started around 2006, a couple of years before the shale boom took off and pushed prices for drilling rights in East Texas to more than $15,000 an acre from around $250. Successful landmen, racing to knock on doors ahead of rivals, earned six-figure incomes. “It was kind of like the Wild, Wild West,” said Mr. Collum, 39 years old. His predecessors in the field included former President George W. Bush and Aubrey McClendon, the late fracking pioneer who co-founded Chesapeake Energy Corp.

These days, the jobs are going dry. Landmen, after riding the highs of the boom, face weakened demand for fossil fuels and investor indifference to shale companies after years of poor returns. Instead of oil and gas fields, some landmen are securing wind and solar fields, spots where the sun shines brightest and the wind blows hardest. The difference is shale wells eventually empty and, in good times, that keeps landmen on the prowl for new land and new contracts. Wind and solar energy never run out, limiting demand for new leases as well as landmen.

Renewable energy jobs are growing in the U.S., but last year roughly three-quarters of them were construction-related, according to consulting firm Wood Mackenzie. Even after last year’s oil-field job losses, U.S. oil and gas production employment is likely to outnumber renewable energy jobs for roughly another decade, according to the firm’s analysis.

Tami Hughes, one of the relatively few female landmen, contracts for an international oil company divesting U.S. assets. In 2019, there were more than 100 landmen and support staff on the divestment project, she said. Now, there are eight.

“If this job ends, I probably wouldn’t be able to get anything else until the price of oil and gas rises,” Ms. Hughes, 62, said.

Mr. Collum remembers the good times, when shale companies couldn’t find new deposits fast enough. They employed small armies of landmen who tracked down nieces, nephews and grandchildren who owned the rights to underground minerals, sometimes unbeknown to owners of the land above.