Convert HDRI to DDS

Is Lys the only decent converter for HDRI to DDS.?
DDS is a tricky format.

Pinging @PatrickRyan

@oglu I wouldn’t say that Lys is the only decent authoring tool, but it does parallel the methods we are using in Babylon for rendering PBR materials. Using the GGX Log2 method for power drop in the specular map will align well with our engine. Other tools like CMFT or IBLBaker don’t give us the same methods but they can certainly be used.

I’ve used all of them and I prefer Lys for the control I have over balancing the roughness curve for our rendering. I know that DDS files are a little difficult to work with and once we bake out the precomputed DDS, you are not able to open the file in anything beyond Visual Studio so there is no real editing of a precomputed DDS once it’s baked. With this in mind, you will want to keep your original source files so you can go back and bake other sizes or versions.

You will also want to run the DDS file through the env generator tool in the tools tab of the inspector once you have it open because you will save a lot of file size and speed downloads on mobile. You can see a comparison of DDS and ENV quality here:

Comparison of DDS and ENV

To learn more about our ENV format, you can find it at the bottom of the doc page about using HDR images for PBR lighting. Let me know if you have more questions about creating DDS files.

1 Like

Thats great info Patrick.
Lys it is.

Followup question.

I tried getting Lys and IBLBaker working on the Mac without success.
But with the CMFT command line everything worked great.

I created this shellscript if anyone is interested.

convert.sh

#!/bin/bash

echo "Converting HDR"

SCRIPT_DIR=${0%/*}
HDR_FILE=${1%%.*}

# 16 bits 128x128
/usr/local/opt/cmft \
--input $1 \
--dstFaceSize 128 \
--output0params dds,rgba16f,cubemap \
--generateMipChain true \
--output0 "$SCRIPT_DIR/$HDR_FILE-16bit-128"

# 16 bits 256x256
/usr/local/opt/cmft \
--input $1 \
--dstFaceSize 256 \
--output0params dds,rgba16f,cubemap \
--generateMipChain true \
--output0 "$SCRIPT_DIR/$HDR_FILE-16bit-256"

# 16 bits 512x512
/usr/local/opt/cmft \
--input $1 \
--dstFaceSize 512 \
--output0params dds,rgba16f,cubemap \
--generateMipChain true \
--output0 "$SCRIPT_DIR/$HDR_FILE-16bit-512"

echo "Done Converting to DDS"

Create three versions with 128, 256, 512px cubes

./convert my-hdr-file.hdr

My question is, can I some how run the dds -> .env converter in the console?

That way I could auto convert everything :open_mouth:

2 Likes