-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with dds format #4
Comments
Ouch! That's painful xD The DDS is rgb9e5, and maybe that's the problem for those loaders... You could try https://github.com/h3r2tic/tony-mc-mapface/blob/main/OCIO/lut-converter/tony_mc_mapface_f32.dds which is f32 :) |
I can confirm Godot 4.0.rc3 can't open the DDS provided on GitHub. Godot doesn't support KTX2 files either, so #2 isn't an option.
Could a Radiance HDR or OpenEXR image also be created in 2D format (with vertical or horizontal slices)? This would be the easiest to import in Godot as a 3D texture. |
Does Godot choke on both the rgb9e5 and the rgba32f DDS files? |
Yes, it can't open RGBA32F either. The DDS loader code is here: https://github.com/godotengine/godot/blob/master/modules/dds/texture_loader_dds.cpp Running from a terminal prints more information:
GIMP's DDS plugin also can't open both of those formats. It should be feasible to add support for more DDS formats in a future Godot 4.x release. @fire may be interested in this 🙂 |
Thanks for confirming! FWIW I exported the DDS using RenderDoc :) Will check whether it can output an unrolled 2D image instead. |
Perhaps this works? No guarantees about the precision of those; I used RenderDoc for the conversion. Please check against some of the images in the README for whether there's no banding, and if the black levels look the same |
Both import successfully in Godot 🙂 However, the green channel's direction is flipped compared to what Godot expects for color correction LUT textures (Y+ is downwards, not upwards). I've flipped the 48 layers individually in GIMP to make the OpenEXR texture work correctly in Godot. The image is included in this Godot project as As a result, I'd recommend making Y-flipped textures available as part of the package if possible (that is, with individual layers flipped, not the entire image). Edit: The finished project I used for testing is available here: godotengine/godot-demo-projects#857 Linear tonemappingLinear tonemapping + Tony Mc Mapface as color correction textureClipping appears as white, as linear tonemapping in Godot doesn't support whitepoint adjustments. When used with an appropriate whitepoint value (typically around 6), other tonemapping modes supported by Godot (Reinhard, Filmic, ACES) don't exhibit this white clipping as much when using the color correction texture. |
Are you using HDR stimulus to look up into the LUT using the It might need to be its own separate tone mapper in Godot -- or, if Godot's Reinhard is exactly Also note that the range remap for the LUT is important (the * 47.0/48 + 0.5/48 thing). Perhaps Godot does that for its color correction textures, but perhaps not. |
No, I'm using Godot's built-in color correction functionality, which doesn't provide a way to do this. It's possible to run custom post-processing shaders but they're slower and have various limitations.
Unfortunately, color correction runs after tonemapping, and the output data from all tonemappers is clamped between 0 and 1: https://github.com/godotengine/godot/blob/19c9fd6926b958016d562e3b2e93b0e9480300f5/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl#L491-L493
The Reinhard tonemap formula used is here: https://github.com/godotengine/godot/blob/19c9fd6926b958016d562e3b2e93b0e9480300f5/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl#L243-L245 The color correction doesn't look too bad with Reinhard – it helps against the "desaturated" effect that Reinhard often has. It's quite close to Linear without any color correction, but without visible clipping. Reinhard tonemapping, whitepoint = 6.0Reinhard tonemapping, whitepoint = 6.0 + Tony Mc Mapface as color correction texture
It's not doing any remap: https://github.com/godotengine/godot/blob/19c9fd6926b958016d562e3b2e93b0e9480300f5/servers/rendering/renderer_rd/shaders/effects/tonemap.glsl#L343-L353 I agree this will need to be a built-in tonemap mode to be implemented correctly in Godot (without the limitations of custom post-processing). PS: Sorry for going off-topic on this thread, I figure I'd go down this Godot rabbit hole so others don't have to 🙂 |
Yeah let's not hijack this topic more 😅 With the formulation that Godot uses for its Reinhard and color correction, TonyMcMapface will not work correctly. It's not really intended to be a color correction LUT; there was a chance it would work if all the planets aligned, but it doesn't seem like they are aligning. Please open a separate issue about Godot if you wish to discuss it further 🙏 |
@h3r2tic Thanks for this! The NVIDIA Texture Tools app doesn't complain now, but... Unity of course doesn't open it. Unity's .dds importer is quite limited in scope apparently. That being said, with the knowledge that I'm dealing with 32bit uncompressed RGBA and a proper read of the microsoft docs, I wrote a Unity importer, which I will publish today when I clean it up. @Calinou Maybe my C# importer will be a useful starting point for Godot as well. |
Nice, happy to hear you've convinced Unity to load it :) Looks like someone else managed that too, including the rgb9e5 format: https://github.com/Dan3dd/tony-mc-mapface_unity |
Hello @h3r2tic and thanks for your great work!
Unfortunately I had issues trying to open the .dds LUT in Unity 2022, therefore I tried converting it, without luck.
I also tried using the ktx2 file provided in #2, but both software mentioned above had issues opening that file as well.
Even an up-to-date Unity ktx importer failed.
Do the above ring a bell ?
Suggestion: A raw data dump of the LUT's contents would be useful, and trivial to directly load into an HLSL Texture3D object. I assume it's a W x H x D array of 32-bit floats ?
Thanks for your time!
The text was updated successfully, but these errors were encountered: