- URL: https://www.laruence.com/2026/10/30/7782.html
- Please include attribution when republishing.
A couple of days ago I published an article on my WeChat channel about the internals of a PHP vulnerability. It had just passed 30,000 views when it got taken down. The most frustrating part is that they don't tell you why, and they give you no way to appeal.
So today, no PHP. Let's talk about something else. Over the past half year, we at Realsee have been working on something that I find quite fun: Space HDR.
HDR
What is HDR?
HDR, High Dynamic Range, should be familiar to everyone by now. The HDR toggle in your phone camera, the HDR badge in your photo gallery, they have become basic infrastructure over the past few years.
But what people usually mean by HDR may only be half the story.
When taking an HDR photo, a camera shoots the same scene at several different exposures. The underexposed shots retain highlight detail, and the overexposed ones retain shadow detail. Then they are merged into one image where you can see both.
That is correct, but it is only the capture link.
True HDR needs support across the whole chain. At capture, it must record a sufficiently wide luminance range. Storage and transmission must be able to carry data covering that range. Finally, the display has to be able to actually emit the brightness. If any link does not support it, what reaches your eyes is still SDR.
That is why people often see a photo advertised as HDR, yet when they look at it on the Web, the view outside the window is still a sheet of white and dark areas are still a mass of black. When it is shared on the Web, the result gets “compressed” back into SDR.
To understand this, we first need the unit of luminance: the nit.
A candle flame is about 0.5 nit. An overcast sky is about 200 nit. The surface of the sun is 1.6 billion nit..
In the SDR era, displays generally covered a luminance range from 0.1 to 100 nit. In other words, when we took a photo, the huge luminance range in the real world had to be squeezed into those two numbers.
In the SDR era, everything from capture to storage to display was built around that range.
Now displays can show ever higher brightness. A phone released recently by a certain brand claims a peak instantaneous brightness of 16,000 nit. That means capture needs to retain a wider luminance range, storage needs more bit depth to carry that range, and the image still has to be shown on an HDR-capable display.
We have been working on capture, storage, and packaging for years. This time, the work was mainly on display: getting HDR all the way to a browser screen.
0x1 Galois
Realsee's spatial intelligence camera is called Galois. The latest generation is the P4.
It is already used for Beike's VR house tours, Meituan's restaurant reservations, exhibition halls and museums, cultural heritage preservation, and even crime scene recording. The officers of the Hong Kong Police Bomb Disposal Unit, for example, use this product.
The P4 is a laser scanner. Its body contains a 905nm LiDAR and a color camera module, with a 4/3-inch CMOS sensor and 47 megapixels. It outputs 300-megapixel 24K panoramas, with an absolute laser-ranging error within 10 millimeters.
It rotates once in about 16 seconds, capturing 5 to 6 angles. Algorithms then merge them into one panorama.
Phone HDR usually combines several shots at different exposures. Since the first generation, Galois has captured 5 differently exposed RAW frames at every angle.
RAW is the sensor's original output, before in-camera compression or processing. With five different exposures, the luminance layers are all there. In other words, the HDR information has been present from the very beginning of the capture link.
The problem is display.
Spatial content has to go on the open Web, where people can share and view it easily. In the past, Web support for displaying HDR photos lagged behind video. So at the output link, this data still went out as SDR JPEG or AVIF. The RAW data was stored, but users could not see it.
But as technology has developed, a few things have changed.
Chrome has correctly displayed HDR photos since 2023. AVIF and Ultra HDR JPEG have been available since Chrome 116. Edge on Windows followed. Safari was the last: Safari 26 gained native HDR-image support in 2025, and brought WebGPU with it.
In other words, by last year, a single HDR photo could more or less light up in every mainstream browser.
So the time had come. We spent half a year rewriting the front-end rendering engine with WebGPU, so HDR data in panoramas can make it all the way to the screen too.
0x2 Storage: the Ultra HDR approach
First, how do we store it?
Since many devices still do not support HDR, we had no choice but to use Ultra HDR.
The base is still a JPEG SDR image with the broadest compatibility, plus a gain map, plus metadata that explains the gain.
Ordinary decoders only see the SDR base image. HDR-capable devices read the gain map as well and reconstruct HDR luminance.
The gain map describes the relationship between SDR rendering and HDR rendering at every position. During reconstruction, the base image is first converted to linear light. The gain map is then interpreted according to its gamma, gain range, and offset rules, and the HDR luminance is calculated.
We use the same approach for panoramic spatial data: a base image plus a gain map. Hundreds of megabytes of full lighting data are compressed and packaged into a lightweight format that browsers and phones can handle in real time.
0x3 Adaptation
For a static photo, you can place the base image and the gain map together and leave them there.
But a panorama does not work that way.
Users rotate the view and zoom in on details. Every rotation and zoom operation resamples the textures. The gain data has to change with them.
First, rotation.
The base image and gain map must always remain aligned in orientation and position. The two images can have different resolutions, but the specification requires at least bilinear filtering for resampling. Otherwise they go out of alignment, and gain is applied to the wrong positions.
Then, zooming.
As the view zooms in, the field of view narrows. The system selects an appropriate level of detail (LOD) based on the current view and display size, then brings in local texture data. Newly added textures carry gain data too, so they must be updated in sync.
There is a trap here.
Color textures need to be decoded into linear light, but gain textures must not be handled this way. A gain map is not color. It retains luminance relationships. Once it is mistakenly treated as color and converted again, those luminance relationships are wrong.
That solves the problem inside a viewpoint. There is still the problem between viewpoints.
Each viewpoint has its own set of data: a base image, a gain map, and reconstruction parameters. When users switch viewpoints, the transition needs to determine HDR availability for the two viewpoints separately. If one viewpoint only has an SDR base image, it has to be handled according to the actual content. You cannot force the same gain onto both.
0x4 Display: WebGPU
Once all of these are solved, the luminance data in hand remains correct no matter how users rotate, zoom, or switch viewpoints.
But there is one final link: how do we actually get it onto the screen?
Our previous rendering engine was based on WebGL. A WebGL canvas outputs 8-bit sRGB, with its values pinned to the range from 0 to 1. Anything above 1 is clipped.
Here is a simplified example. On a linear scale, SDR white is 1. S is the base-image luminance, G is the gain, and w is the gain weight:
H = S × G^w w = 0 => H = 0.5 w = 0.5 => H = 1.0 w = 1 => H = 2.0
Here, S = 0.5, G = 4, and the offset is 0.
H = 2.0 represents luminance above SDR reference white. If any step clamps it back to 1.0, the distinction is gone.
The WebGL canvas is that final clipping point. No matter how accurately the gain is calculated before it, it cannot get past the canvas.
So a patch would not work. We had to replace the graphics backend.
Starting with Chrome 129, WebGPU canvases support the rgba16float floating-point format and extended tone mapping. Floating-point luminance in the HDR path can then reach the screen without being clipped. That is why this rendering-engine rewrite took half a year.
Finally, there is drawing timing.
Before every draw, HDR parameters are selected based on user settings, display capability, and the selected backend. If the environment changes, for example when a user turns on system HDR mid-session, the current draw is skipped. Intermediate textures are updated before rendering continues.
After drawing, the gain application and canvas configuration must also be checked. If any link does not line up, the output has the wrong colors.
So how do we know whether the current environment can use HDR?
The dynamic-range: high media query provides that signal. If the user turns off HDR, display capability does not match high, or the renderer is actually running WebGL 2, it falls back to the SDR base image.
So old devices see the same result as before, without errors.
On the Web, we cannot prescribe the whole chain as a television can. So every link has to make its own determination.
0x5 Demo
After all that, let's look at the result:
Look at the content on the left. There is a “24K HDR” badge in the upper-left corner.
This space has Sync view enabled. When you rotate your view, the other side follows to the same position. One side is HDR and the other is SDR. Putting the same scene side by side makes the difference easier to see.
Can you see the difference?
If you cannot see the HDR badge, or the picture does not seem to change, some link in your environment probably does not support HDR. You can try the test button below.
<button id="hdr-check-btn">Check HDR support</button>
It checks three things:
- Whether the browser's graphics capability supports WebGPU;
- Whether the HDR display capability is
dynamic-range: high; - Whether the browser can output HDR.
If all three are supported, go back to the comparison above. You should be able to see the difference.
If something is not supported, try turning on system HDR or updating your browser. Chrome/Edge 113+ can use WebGPU, and HDR output requires 129+. If that still does not work, use a device with an HDR display. Most mainstream phones already meet the requirement.
0x6 Open source
We have open-sourced a tool: panorama-viewer.
It is based on three.js WebGPU. You can drag an Ultra HDR JPEG into it, read the base image, gain map, and metadata from it, and reconstruct the HDR image on the GPU.
It also provides a display-gain slider that you can adjust in real time. Pull the gain from 0 to the maximum and you can directly see what is added to the image.
More Space HDR examples are available on Realsee Discover, where you can browse restaurants, residences, hotels, museums, and retail spaces.
0x7 Value
When people look at photos, the closer the light in an image is to what their eyes experienced at the time, the more real it feels.
VR is the same. HDR can make the experience more immersive, giving users a stronger sense of “being there.” When a window is a sheet of white and dark areas are a mass of black, people feel that this is not “natural light.” Instinctively, they think: “this is a photograph,” not something “real.”
Take Beike. When users look at a house on their phones, whether a room with good daylight actually looks bright and whether a north-facing room looks dark directly affect their judgment.
Or take Meituan restaurant reservations. Before booking a booth, users can tour the space first. The seats by the floor-to-ceiling windows and the atmosphere created by spotlights can feel close to being there in person. The same applies to any use case where people need to inspect a space.
Space HDR listings have now been rolled out at scale in Beike's new-home section and on Meituan. Tujia, Alibaba, and other platforms are also integrating it.
That is all for now. If you are interested, you can open a few examples below:
Be First to Comment