HDR Light Studio 5 has seen the biggest set of changes we have ever made in the software. Some of those changes can at first seem like a step backwards for our existing users. The way version 5 handles loading image files is a good example.
We had a customer recently report that when a photographer client comes into the studio to art direct the lighting on CGI shots, then it is taking too long to load the huge HDRI maps he brings with him into HDR Light Studio 5, and that HDR Light Studio 4 was much faster.
We decided this subject was worthy of an article to explain the difference between version 4 and 5 in this respect, and check these load times for ourselves.
Loading background images into HDR Light Studio 4
In HDR Light Studio version 4, the only imagery users could load was a single HDR or EXR file as a background. When loading this background image, HDR Light Studio read the file and quickly calculated a 646 x 323 rough version of the image to use on the HDR canvas. This provided a very fast, but very low resolution lighting experience, where the HDR image was very noticeably pixelated. The Picture Lights files also included a lo-res proxy version that was used on the HDR canvas. It was only when rendering the final hi-res and sub-sampled HDRI map, that the render code loaded the hi-res versions of those files.
In HDR Light Studio 5 we wanted to make the following improvements:
- Allow users to load their own HDR and LDR imagery for lights, reflections, alpha, background etc, supporting a wide range of file formats and potentially huge image sizes, and potentially many images.
- Have a resizable HDR Canvas that was not limited to being 646 x 323 pixels, so it could be resized on the interface to much larger, or smaller sizes.
- Enable users to zoom into regions of the HDR Canvas to position lights and content with more accuracy, and allow the user to explore the fine details when a hi-res image was loaded.
- To be able to share a live HDRI map with 3D apps at higher resolutions than 646 x 323 pixels
- Keep the software as fast and responsive as version 4
We managed to achieve all of the above in HDR Light Studio 5. This has been facilitated by loading images that have been mip-mapped and tiled. This is a new approach for version 5.
When loading images you may have noticed if their resolution exceeds 1,500 pixels wide, you are presented with the following dialog:
If you press ‘Open Anyway’, the original file is loaded from disc into HDR Light Studio. If this is a very high resolution image it can take a very long time to load and store in our image cache, if the cache gets full, we start caching on disc, not in RAM, and this is very very slow. In fact it’s unusably slow and horrible.
But if you press the ‘Convert’ button, HDR Light Studio will mip-map and tile the image for you, and save it on disc with the same file name appended with a .tx at the end. It will then automatically load this .tx file. By using the .tx file, HDR Light Studio will remain very fast and responsive. Now this image has been processed into a .tx, the next time you load it, it will load in an instant, no need to wait for the conversion again. It is this conversion process that takes a little time.
Why use Mip Mapped and Tiled images?
When you mip-map an image, you process it to create multiple lower resolution versions of the same image, and put them into a single file on disc. Here is an example showing the image sizes contained if you were to mip-map a 32,768 x 16,384 pixel image.
So when this .tx file is referenced by HDR Light Studio 5, the software only retrieves the image at the resolution that is required. So for example if the HDR Canvas is very small, the 512 x 256 pixel version could be retrieved from the mip-mapped file. HDR Light Studio is only ever loading and handling images at a resolution it needs. It doesn’t need to access the full resolution image, unless this level of detail is required.
Because a mip-mapped image file is a container for all of these multiple resolution images, it will be larger than the original file, roughly twice the size.
The tiling of the image also helps keep things fast. Images are normally saved scanline, so to load a specific area of an image, then each full line of pixels needs to be read. With a tiled image, the image is split into discrete tiles, and the section of the full image required can be quickly read by reading the only the tiles from the location of the image needed.
Image Load Times – V4 vs V5
Here is a comparison of load times for a 30,000 x 15,000 HDR file.
You can see that HDR Light Studio 4 indeed opens the very large HDR file faster than version 5. In fact version 5 is unusable when loading this image, HDR Light Studio 5 just hangs for many minutes (we waited for 17 minutes and gave up). Its texture system is not designed to load all the images at full resolution like this, without being mip-mapped first.
Pressing the ‘Convert’ button when opening the image in HDR Light Studio will convert this file into a mip-mapped and tiled version, and then load this new file instead. This process of converting and opening takes around twice as long as opening the original HDR file in HDR Light Studio 4. So yes, so far this is slower.
But, if you load this .tx file into HDR Light Studio in the future, it will load in 1 second. Very fast indeed. A huge improvement over version 4.
So for example all of our Preset Lights are .tx files. Every time you run HDR Light Studio, the thumbnails are generated on the fly by reading the .tx files, and getting the lowest resolution necessary. This makes it fast. Imagine trying to load hundreds of 4k images into memory to do this, impossible.
Getting back to our customer working with a photographer. They are correct that the first time they convert and load the HDR image, then HDR Light Studio 5 is slower. About half the speed of version 4 on a massive HDR file (30k). However you can do so much more in HDR Light Studio 5 once this image is loaded: Pan and zoom into the finest detail of the HDRI map, place lights with 100 times more precision, load any imagery onto lights, have a HDR Canvas at any size not fixed to 646 pixels wide, and share a HDRI map up to 3k through a ‘Connection’ with their 3D app, this is 22 times larger than the resolution available in V4. None of this would be possible without converting the file first.
The second time this customer loads this same converted image, they will be no worse off now than using version 4, as it will load in 1 second, making up for the extra time taken to convert it the first time. The third time this image is loaded, we are now saving a lot of time compared to version 4.
Users should always convert their images to .tx files when loading them into HDR Light Studio 5. The small investment of time to wait for the conversion will definitely be worth it thereafter. HDR Light Studio 5 will remain fast and responsive whilst loading many images converted to .tx files, and these files will always load instantly.