Our RGBD support is pretty custom (including some quantization helper functions) and not a standard but we figured it was faster and smaller footprint than embedding an EXR loader or Downloading HDR files.
It is normally exclusively an internal trick to create .env textures.
We allowed the use of them within lightmaps due to the restricted size for the same reasons than the env files.
@Evgeni_Popov playground is the way to go to convert.
About the lightmap usage it would allow values bigger than one which are only possible normally with lightmapTexture.level but this could lead to banding artifacts.
@zylkowski, I am not aware of any in-tool path to export to an RGBD channel format in any of the DCC tools we use. As @sebavan mentioned, we use that format to reduce on size for high dynamic range images, but most of the DCC tools will go as far as .hdr or .exr formats for high dynamic range files and not use this optimization. For one, the optimization is not exact as for RGBD you will need to set an upper range for the value so that RGBD can be used. The formats baked by the standard DCC tools will just use float values to represent an exact value of light, but that comes at the cost of a very large file. The playground that @Evgeni_Popov linked is a shortcut tool to convert for us. Much like being able to drop an .hdr on the sandbox and then save out an .env file for use as an environment.
I would love to see us natively support .hdr and .exr formats, but those files are normally quite large in terms of displaying for the web. The formats themselves, .exr especially, are large with a lot of features to support so we have always opted not to tackle it with the resources available to us. I know this isn’t the answer you are looking for, but in every art pipeline there are things we need to do that the tooling is not equipped for. It may be that writing a stand-alone automation for Blender to convert to the format may be in your best interest if this is something that you do a lot.
Thank you very much for such an answer. I am very much interested in writing such tool for HDR → RGBD in python and even making it available for everyone. In order to do so though I need a few details that are not so easy to get just by going through the code on babylon’s github. I have a few questions answers to which would help me tremendously in this task.
I found this piece of code for RGBD transformation.
What exactly is vec3 color there? Is it Linear or sRGB color? Is it clamped 0 to 1, 0 to 255 or 0 to float32::max?
Answers to these questions would help me a lot in creating Blender script that outputs RGBD lightmap automatically.
If everything else fails, using HDR files with a little RGBE encoding header should work just fine and it shouldn’t be too heavy as long as your scene assets are atlas packed properly to keep the texel density somewhat consistent: https://playground.babylonjs.com/#5KVL6P#8
Hey I just tried the solution with HDR files as you linked https://playground.babylonjs.com/#5KVL6P#8
My HDR files do not work, do you have any tips? I think I might be missing " little RGBE encoding header" but I am not exactly sure.
You can see here: https://playground.babylonjs.com/#5KVL6P#31
It’s your playground with only thing changed to my hdr texture. You can see that it’s checkered texture as if it was not loaded properly.
I must admit, I’m not really sure what was wrong with the HDR texture you used or why BabylonJS wouldn’t load it. In this example, I downloaded your texture, opened it up in Affinity (Blender also works just fine), resaved as 32-bit HDR and it seems to work just fine?: Lightmap Test | Babylon.js Playground (babylonjs.com)
how do you do this? glb doesnt support lightmap exports by default? I know about exporting AO maps in a glb from blender using a custom node , is there some similar setup for doing lightmaps then?