Convert a .png to .hdr

Hi, I was just comparing the results of using a .png panorama a an identical .hdr to light up my scene. To my surprise I found that while the png gave a very dull result the .hdr just made my scene look perfect.

Now I don’t really understand how a .hdr works - other than it stores color values differently - but is there some tool to create these amazing .hdr’s from simple .png panoramas?

Thanks!

What makes a HDR is not that it stores color values differently, but that it can store a higher range of brightness values than a LDR image.

Of course you can convert a LDR file format to a HDR file format, but you will imho gain nothing from it, as you will just get a file that still has the meagre dynamic range of the LDR… The missing brightness values won’t appear out of thin air with the conversion - unfortunately…

Converting a PNG to a HDR file is like taking a MP3 file and encoding it to a FLAC and expecting better audio quality, you’ve changed the file format but the information contained in the file is exactly the same.

The only way to do this correctly is to have several PNG files that were taken with different exposures. Then you could combine them all into a HDR file. One way to do it is if you have a camera that will take multiple frames at different exposure values. Then you can combine those into a HDR file.

There is another way to do it, in that you can take a LDR file and add in extra depth where it’s needed. For instance there is software that will allow you to add higher values for the sun in the image and create an HDR file from it.

Like HDR light studio here: https://www.lightmap.co.uk/

or if – and this is a very BIG if –
if the png is a 16 bit per channel png - then it already is a High Dynamic Range ( hdr) image

and exactly what format “.hdr” file
i consider a *.hdr to be a ESRI DEM file or a Envi header file ( detached image header )

A hdr is 32 bit per channel not 16.
Anyway, if you go the route of taking the pictures yourself and have a Canon camera save yourself some major pain and hack its firmware with magic lantern. That is an addon for cameras that gives you a whole bunch of new fearures,. The one relevant for hdri is that you can take as many images at differen exposures at once (automatic exposure bracketing). Most standard cameras are artificially reduced to 3 exposures but for good hdri you need a minimum of 5. More often you will need 7 or 9.

http://www.magiclantern.fm

Banty’s toolkit - http://www.banterle.com/francesco/toolkit.php - free plugins for “Hdrshop” or “PictureNaut” can create a hdr from png.

.hdr is a rather widely used High Dynamic Range raster format and one of the oldest in this field. Nothing ambiguous in that.

Dynamic range depends on what is stored in the file, not bit depth. A 32bit float image can be as low dynamic range as any 8bit png. Higher bit depth and floating point storage only gives the possibility to store a wide range of values. And range as in range of magnitude (exposure levels) not range of different values. 32bit int can have a lot of different values but it does not necessarily mean it has a wide dynamic range.

Sounds perfect! I know how to tonemap an image, what shall I do with it then?

By the way, can gimp be used for this?

If you want to create proper HDR images Luminance HDR is what you want to use because it can save images in a few different HDR formats and is open source, http://qtpfsgui.sourceforge.net/
It can take some time to learn how to use it correctly but once you figure it out it works great.

Gimp in the past didn’t support high dynamic range 32 bit images, but I think that they are adding in the ability for it in 2.9? Krita does support this bit depth.

Tonemapping would be one use for the imagery, but in 3d graphics it has mostly been used for background and lighting of a scene. Here is a good introduction and how to make them:

Here is an scene I rendered that is lit by an HDR image:


You can even go farther if you have a HDR image sequence then you can animate your environment. Here is a short animation I did with an HDR image sequence: