I eat a lot of eggs.

There’s a pretty solid argument that this is, by far, my greatest moral failing as a person. Egg-laying chickens have some of the most miserable lives of any animals on the planet. They never see the sun, and spend their short lives in intensely crowded, dirty, chemical-treated conditions. (Animal advocates have worked to phase out cages, but this only soothes my conscience a little.)

Which is why, as meatless meat becomes more popular, one of the innovations in the realm of food science that I’ve been watching closely is, well, eggless eggs.

Eggless eggs are what they sound like: they’re egg-like products, but no chickens were actually harmed in the making of them. But they’re in some ways harder to get right than plant-based meats, which have made tremendous strides in recent months.

If someone hands you a meatless burger, made from plants, you can take a bite and decide if you like it. That’s it — that’s all you need to know.

What if, instead, they hand you an eggless egg?

You’d probably need about a dozen, prepared in different ways, to find out how they stack up to the real thing. Do they hard-boil? Do they scramble? Do they fry? Can you make bread with them? Cake? Meringue? Eggs are one of the most astonishingly versatile foods out there. We use them in dozens of different ways. It makes sense then that crafting a convincing substitute might be something of a challenge.

As meatless meat rises in popularity, plant-based meat companies soar in the stock market, and consumers increasingly push for more sustainable and less cruel food, plant-based proteins are having a moment. And the arguments for plant-based proteins don’t just apply to meat — many of the concerns about meat production apply to eggs just as strongly.

While eggs are a harder problem from a food science perspective, they’re not an impossible one. As a survey of the state of food research shows, the eggless egg future might be closer than you think.

The problem with egg agriculture

Here’s something most people probably don’t realize: Factory farming of animals for their eggs is as ugly as factory farming of animals for their meat.

Egg-laying chickens are packed by the tens of thousands into small barns where they often don’t have enough space to spread their wings, and experience horrific health problems thanks to the rate at which they produce eggs. Watchdogs have found that it’s not even rare for chickens’ intestines to partially fall out under the strain.

The overcrowded conditions lead to massive problems with disease outbreaks. In 2014-2015, repeat outbreaks of H5N1 avian flu struck birds in 223 separate outbreaks across the country. More than 50 million hens were killed, either dying of the flu or slaughtered in efforts to prevent it from spreading further.

That’s not the only problem. While in nature a chicken might lay 10 to 15 eggs per year, on farms they lay 250 to 300 a year, and the strain does them immense internal damage. Plus, farms kill economically useless male chicks at birth, sometimes just by tossing them into a meat grinder.

What about natural or organic eggs? Disappointingly, most of those labels are meaningless. The USDA lets companies label their eggs as organic even if they come from chickens that have never been outdoors; as long as the barn where they’re stocked with thousands or tens of thousands of other chickens technically has a screened porch. The term “naturally raised” is even worse — it means nothing at all — while “natural” is about additives, not about how the birds were treated.

Another label, “cage-free” isn’t meaningless — it’s a real improvement in welfare for the chickens, who get enough space to flap their wings and turn around. But massive barns, no outdoor access, dangerous overcrowding, and intestinal damage remain risks.

The quest for an egg without the egg

That’s the bad news. Here’s the good news: food scientists are hard at work developing the eggless egg.

Plant-based meats are hard to make. But it doesn’t compare to the difficulty of making a plant-based egg. In order to satisfy consumers with an imitation meat, you need the food to cook like meat, have the same taste and flavor once cooked, and be comparable in price.

To satisfy consumers with an imitation egg, it has to do all of the things eggs do. And eggs are an incredibly versatile food.

They scramble. They hard-boil. They fry. They are a baking ingredient in breads, pies, and cakes. You can use the whites to make meringues. They’re used in custards and omelets and fried rice and deviled eggs. They’re used to coat nuggets for breading. Each of these recipes relies on different features of the egg. And an imitation egg needs to imitate all of them — or at least a lot of them — to catch on with consumers.

“Eggs are absolutely miraculous,” Chris Jones, food scientist and chef at plant-based egg company JUST, told me.

The earliest efforts at plant-based eggs took a piecemeal approach. Many bakers identified acceptable egg substitutes for individual recipes. Vegan products went on the market that copied one or two properties of eggs — JUST made a mayonnaise, for example. Other properties remained elusive.

“If you’re using eggs to create a flan or a frosting, you’re imparting foaming,” M.J. Kinney, a food scientist at the Good Food Institute, which works toward plant-based proteins, told me. “If you’re using it in a cake or a bread, you’re imparting the function for it to bind ingredients and serve as a leavening ingredient” — in other words, you’re relying on the fact the egg will help the bread rise.

You can tackle those one at a time — finding something that will make bread rise just like an egg, for example, without necessarily getting anything else right.

Finding a scramble substitute

“What we really focused on at the beginning was bakery and emulsification but also gelation,” Jones told me, “which is how the protein heats.”

Most things behave very differently from eggs when they get hot. They might brown, or boil, or stick to the pan. Food scientists had to cast a wide net to find any protein in the plant kingdom that behaved like that. JUST tested hundreds.

The winner? Mung beans, legumes from Southeast Asia that give plant-based eggs the texture (and, crucially, the scramble-ability) of chicken eggs.

That triumph does need to be qualified. “That’s only one function,” Jones noted. “Just because it can do some things like an egg doesn’t mean it can do others.”

The JUST egg, while a great egg replacement in scrambles and in fried rice, does not bake quite like an egg, and the company doesn’t recommend it for that purpose yet. The day when you can make a meringue, save the yolk to use for breading, and use the leftover eggs for scrambled eggs the next morning is a long way away.

“Does it work as well as an egg? Absolutely not,” Jones told me. “We have to keep working.”

But even that one function makes for an impressive triumph. JUST’s eggless egg scrambles satisfyingly, looks incredible, and tastes pretty eggy — not there yet, but getting close. It doesn’t feel like the final answer, but it does feel like a milestone.

JUST has competitors, too — Follow Your Heart sells vegan egg replacements that can be used for both scrambling and baking.

Eggless eggs don’t come in a shell. They come in a plastic container for now, although you can still overall reduce packaging waste, since you don’t have to cushion fragile eggs for transit.

Eggless eggs may still be a ways off as a mainstream substitute in the broader marketplace, but I’m optimistic. First, consumers seem genuinely interested in plant-based foods, and willing to tolerate some bumps in the road once there are tasty options on the market. Right now, JUST egg is 40 percent of liquid egg sales (that is, sales of eggs that are pre-cracked) in “natural” grocery stores, suggesting many people don’t care if their eggs come from chickens.

And astonishing numbers of eggs aren’t sold to consumers at all, but used in prepared food in restaurants and retailers. In that market, the challenges ahead look a little different: there’s no consumer aversion to weird new products to overcome and strong pressures to economize on price. Suppliers just care about product quality and price point. Plant-based eggs, though pricier than chicken eggs today, could eventually offer serious advantages in terms of price, preservation, and ease in preparation (there’s no risk of getting bits of eggshell in a diner’s food).

Some of the problems facing the world today look really tough. But the problem of animal agriculture looks like it might be simplifying down to something that we’re getting good at: making tasty, cheap, plant-based food, and getting consumers to try it.

Sign up for the Future Perfect newsletter. Twice a week, you’ll get a roundup of ideas and solutions for tackling our biggest challenges: improving public health, decreasing human and animal suffering, easing catastrophic risks, and — to put it simply — getting better at doing good