In the smartphone world, there are basically two brands that matter and then there are a bunch of also-rans. Apple and Samsung are ahead of the pack for a variety of reasons, but it's their ability to create amazing cameras that's difficult to match. Thanks to the efficiencies of the smartphone supply chain, anyone can put together a high-end processor, design a metal unibody phone, put Android on it, and have the appearance of a premium phone. But it’s a lot harder to develop a class-leading mobile camera. Only Google itself has managed to come close, and only in the past year.

OnePlus is one of those challenger companies that’s been chasing the leaders. It’s received acclaim for its premium phones that have high-end specs and performance without a high-end price tag. But despite that, OnePlus has never built a phone that could match the best cameras on the market. “The OnePlus 3 can compete with the flagships, but the camera is a good camera, it’s not an amazing camera,” admits co-founder Carl Pei about the company’s 2016 phone.

So for its latest phone, the OnePlus 5, which will be officially announced tomorrow, the company focused its efforts on fixing that. The stakes here are high — OnePlus has already proven it can make a phone with fast performance and quality design, but it hasn’t proven it can play on the same level with its cameras. That attention to detail has won OnePlus a huge cadre of dedicated fans who believe that great smartphones don't have to be expensive, and that they don't have to come from the biggest companies.

Yet the OnePlus 5 doesn’t have the same low-cost advantage its predecessors enjoyed; it’s the most expensive phone OnePlus has ever sold. Making a great smartphone is tough, making a great smartphone that also has a great camera is an even harder challenge.

OnePlus is not a startup — it’s wholly owned by BBK Electronics, which also owns the Oppo and Vivo brands — but it tries to behave like one. It has roughly 700 employees, far fewer than the tens of thousands employed by competitors Apple, Samsung, or Google. It does not maintain a sprawling product portfolio; instead it throws all of its eggs into one basket and tries to make the single best Android phone it can, roughly once per year. That gives OnePlus an advantage, as it can move quickly: CEO Pete Lau says the company’s typical development time for a new phone is about 12 months, as opposed to the 18 to 24 months other companies take. But it also is a disadvantage, as it might not be able to develop new technology advancements in the same way larger companies can, since it lacks their scale.

OnePlus does take advantage of its location in Shenzhen, China. “If you're making hardware, Shenzhen might be the best place in the world,” says Lau. “Not only are we near the factory, there are also suppliers nearby.”

Shenzhen is a unique city. In 1980, it was the first city designated by the Chinese government as a special economic zone, which permitted it to run under different business regulations than the rest of the country. This allowed Shenzhen’s economic growth to explode: today it’s the epicenter of China’s tech industry. Both the supply chain that’s necessary to acquire the components to build a smartphone and the factories to actually put it all together exist within Shenzhen’s greater area.

It’s the perfect place to be if you’re a small company that wants to build a world-class phone that competes with Apple and Samsung. Those bigger players can afford to have all of their prototyping and tooling for product development in house, but that’s not something a smaller company can manage. Being in Shenzhen helps mitigate that, says Lau. “As an example, when we want to make a mock-up, we can make a call before lunch on day one and have the mock-up in our hands before lunch on day two. It’s very fast,” he says. “Some people say in software you can iterate very quickly, but in Shenzhen, you can iterate hardware very quickly.”

Compared to the sprawling campuses of Apple or Samsung, OnePlus maintains a small office. Most of its employees are found on the 18th floor of one of Shenzhen’s many new high-rise buildings, while a smaller engineering team is a few floors down. The office is reminiscent of startups I’ve seen in New York or San Francisco: there are rows of desks in an open floor plan with young people working on computers. You’ll find a game room, a number of conference rooms, and a showcase of OnePlus’ past and current products in the lobby.

“In Shenzhen, you can iterate hardware very quickly.”

What I didn’t see is an extensive design and prototyping lab, like what Apple is famous for. Shenzhen is basically OnePlus’ design and prototyping lab: it can whip up a CAD of its new phone and just have a nearby factory crank a handful of test samples out as it develops the product.

Even with the advantage of being based in Shenzhen, OnePlus still can’t always get the best components other companies might have. After all, both Apple and Samsung make their own processors, and Samsung is one of the leading manufacturers of display technologies in the world. Those in-house display and chip technologies show up in their phones long before they make it anywhere else. (Or in the case of Apple's chips, they never show up in other companies’ products at all.)

For the OnePlus 5, that meant the company wasn’t able to utilize the tall, edge-to-edge screens that Samsung and LG have pushed this year. “This is something we want to try,” says Lau. “But we don't currently have the resources or access to those displays.”

So OnePlus zeroed in its efforts on the part it can get: a better camera. The OnePlus 5 features a dual-camera system, a first for the company. Dual-camera systems are becoming increasingly popular in smartphones, but they aren’t always implemented in the same way. LG uses a extra wide angle camera in addition to its standard one, while Huawei utilizes a second monochrome camera to pull out more detail than just a single color sensor can capture.

OnePlus opted to go for a standard and telephoto lens combination, similar to the one used by Apple in the iPhone 7 Plus. “We were exploring dual cameras last year, but we knew the education cost would be too high,” explains Lau. “We have to thank Apple for educating the market for us.” The main camera is a 16-megapixel Sony unit with an f/1.7 aperture lens. The second camera has a 20-megapixel Sony sensor with an f/2.6 “telephoto” lens. OnePlus claims that this is “the highest resolution dual-camera system on a smartphone today.”

The OnePlus 5’s dual camera provides zooming and DSLR-like blurring capabilities

It was able to access these camera components by leveraging its larger sister company Oppo’s buying power. (A similar version of this camera system shows up in Oppo’s new R11.) But OnePlus insists that once the components were procured, all of the engineering and software development was its own.

The second camera acts like a zoom: it allows you to get closer to your subject without having to crop the photo. More importantly, it also allows for another thing familiar to iPhone 7 Plus owners: a special portrait mode that emulates the shallow depth of field effects you can get with a large DSLR camera. Lau says “the largest consumer value [from dual cameras] is in the portrait mode.”

“There are technologies that allow portrait mode with single camera,” says OnePlus’ imaging director, Simon Liu. “But at this point, the output is still not as good as those with [a] dual-camera module.”

Doubling the number of cameras in the back of the phone introduces a variety of new engineering challenges. Liu says that OnePlus had looked at dual cameras in the past, but the components available at the time could not withstand the daily rigors of life in a smartphone. Should one of the modules get knocked out of alignment, the whole system falls apart. Liu says that the system in the OnePlus 5 is fused together, so one camera can’t shift position away from the other.

That decision to use a dual-camera system also had ramifications throughout the rest of the phone’s design. The OnePlus 3 and 3T both had their cameras in the center of the back of the phone, but that wasn’t possible when using two cameras. “Because the dual camera has a larger size, we found the camera bump would have been too large,” explains Liu. “To reduce the thickness we have to find another location, which was the upper left side of the phone.”

The end result is, well, familiar looking. The OnePlus 5 has its rear camera system in the same spot as the iPhone 7 Plus, but Liu contends this was an inevitability. “It’s a little difficult to make two cameras, two holes in the back not look ugly,” he says.

Liu says more work went into the camera’s software than the hardware — as much as 80 percent of the work in building the camera was developing software. OnePlus is able to leverage the image signal processor, or the main processing chip that runs the camera, that Qualcomm provides with the Snapdragon platform. That way, it doesn’t have to build one of its own, but it still has to do a lot of work to make the dual-camera system sing. “Two sensors take a lot more power, so this tilts the entire balance of the whole system,” says Liu. “It causes a butterfly effect that almost affects everything.”

Solving complex photographic problems requires a lot of clever engineering and software work — even Apple released the iPhone 7 Plus’ portrait mode in beta first. OnePlus is constantly iterating to make it better. The best camera components in the world aren’t worth anything if there isn’t good software there to get the best results from them.

Perfecting the dual camera’s performance is a slow, iterative process

Based on the early image samples I saw while at OnePlus’ office, it’s clear that perfecting the depth-effect portrait mode is a difficult job. Many times, the software blurs the background too aggressively or doesn’t blur every area that would be if the image was taken by a proper DSLR camera with a fast lens. It wasn’t hard to tell which images were taken using OnePlus’ software enhancements. Since then, the company has released sample images that are a bit more pleasing to look at, so it’s clear the algorithms are still works in progress.

The level of difficulty in making this all work isn’t lost on Liu. “I don't know if this is the right time to do it. I hope it is,” he says about the new dual camera. “But I do know the hardware is ready.” Simply put, the software will make or break whether or not the OnePlus 5’s camera is a success.

The rest of the phone maintains OnePlus’ established hallmarks: it has Qualcomm’s latest and greatest processor, more RAM than you might find in a laptop, and a polished, aluminum body. OnePlus’ software is similar to what Google ships on its own Pixel phones, but with added touches like a special Reading Mode that makes the display mimic the look of a Kindle e-reader. Like its predecessors, the OnePlus 3 and 3T, the OnePlus 5 feels every bit like a premium phone that you might spend upwards of $700 on, but it costs closer to $500.

It may seem like a lot of importance is being placed on just one thing, but OnePlus has a lot riding on this camera system: it’s the last frontier in building “the best Android phone” that the company has to conquer. If the new dual camera doesn’t impress, it could leave many of OnePlus’ most ardent fans wondering how exactly the new phone is better than the prior model.

And those fans are key to OnePlus' success so far. Last year, Pei told me that the typical OnePlus customer is an early adopter with high demands: it wants every latest and greatest spec, and it won’t tolerate missing features. The company learned this lesson the hard way with 2015’s OnePlus 2, which lacked basic features such as NFC or quick charging, which upset many of those fans. “We’re shifting our thinking toward that and giving them what they’re asking for,” Pei said. Since then, those fans have been asking for a better camera, and they don’t want to have to buy a Galaxy or iPhone or Pixel to get it.

Nailing the camera is the last frontier in building the best Android phone OnePlus has to conquer

Failing to deliver on the camera will mean that the OnePlus 5 can't be a truly viable alternative to those premium phones. That’s been fine in the past: aggressive pricing allowed OnePlus to get by with an average camera. But it won’t work forever, especially as it moves into higher-priced segments.

Perhaps even worse, if OnePlus’ fanbase isn’t impressed with the OnePlus 5’s new camera, they could look elsewhere for their next phone, by either paying a little more for a mainstream premium phone or paying a little less and getting most of the same experience from a midrange device.

Once you get past the basics, the first question anybody asks about an Android phone is simply this: "Is the camera any good?" If OnePlus is going to prove that it's possible to stay in the game, that answer has to be equally simple: "Yes."