klepto2 Posted October 26, 2023 Share Posted October 26, 2023 (edited) Here it is a first release of my PBR Texture generator made with UltraEngine: UltraPBRTextureGen.zip [New-Version with real hdr and Exposure] UltraPBRTextureGen_v0_8.zip Features: Standalone UI-App with preview and settings Allows single import of panorama (*.hdr) and cubemap (*dds and *.tex) files Adjustments for samples / lodbias and resolutions Saving is limited (it currently saves only to appdir and the names are fixed to sky_diffuse/sky_specular CLI Allows batch and single operations on folders or single files Full set of parameters here: Usage: UltraPBRTextureGen.exe [OPTION...] -b, --batch Batch operations -c, --cubemap Convert cubemaps (dds, tex) -p, --panorama Convert panoramas (hdr) -d, --dir arg path to search the files (only used with batch option) -o, --out arg output folder -f, --file arg file to convert (only when not used with batch option) -s, --samples arg Samples to be used (default: 1024) --lb arg LodBias to be used (default: 0.0) --dr arg Resolution for the diffuse map (default: 128) --sr arg Resolution for the specular map (default: 1024) -h, --help Show help In the folder cli-samples is a subfolder for HDRI images, for the sample commands to work you first need to download one or more HDR images from a source like https://polyhaven.com/hdris Screenshot: the generated files can directly be used in the UltraEngine Editor under MAP/Environment/(Background/Specular/Diffuse) to provide proper PBR lighting. Planned Features: Fix save behaviour in the GUI-App Add more image formats Add Exposure control for generation like here: https://matheowis.github.io/HDRI-to-CubeMap/ provide a small cpp lib to enable on the fly (realtime) generation of these textures. Edited October 26, 2023 by klepto2 Updated download 2 2 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted October 26, 2023 Author Share Posted October 26, 2023 UltraPBRTextureGen_v0_8.zip New Version with exposure added to the import of hdr images. Changes: HDR files are now loaded as real HDR images and not converted to LDR before processing Exposure parameter added (default 4.0) Gui: Added Exposure controls and rebuild panorama button When you import a panorama or cubemap, the initial build is triggered. 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted October 26, 2023 Author Share Posted October 26, 2023 For reference: Panorama with exposure set to 4.0: With exposure set to 12.0: 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 26, 2023 Share Posted October 26, 2023 Wow, this is so so good. Can it convert a folder of panoramas to environment maps? This will convert a whole folder of HDRIs. This saves so much time: UltraPBRTextureGen.exe -b -p -d ./hdris FYI, with big textures and a 1024 sample count, some graphics cards can time out on that IBL shader and produce the VK_DEVICE_LOST error: https://github.com/KhronosGroup/glTF-IBL-Sampler/issues/8 I remember setting some OS setting or reg key to allow a longer timeout with the Vulkan driver, when I was using the Khronos app. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted October 27, 2023 Author Share Posted October 27, 2023 14 hours ago, Josh said: Wow, this is so so good. Can it convert a folder of panoramas to environment maps? This will convert a whole folder of HDRIs. This saves so much time: UltraPBRTextureGen.exe -b -p -d ./hdris FYI, with big textures and a 1024 sample count, some graphics cards can time out on that IBL shader and produce the VK_DEVICE_LOST error: https://github.com/KhronosGroup/glTF-IBL-Sampler/issues/8 I remember setting some OS setting or reg key to allow a longer timeout with the Vulkan driver, when I was using the Khronos app. yes i noticed this as well, in an early version it was as soon as I created a cubemap > 512px. Unlike the method of the IBL Sampler from Khronos I am using a compute pipeline for this, which means i could reduce the errors by maximizing the Workgroup sizes to the allowed maximum. I have multiple compute shaders with different Local sizes and choose the correct one based on the current MipMapsize. It still happens with textures > 1024 (not everytime but from time to time) as i currently have just added 2 shaders one with a localSize of 1 and one with a local size of 32. But i will try to optimize it. Some suggestions to speed it up are not included in the IBL sampler code (e.g: precalculations of some values). Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted October 27, 2023 Author Share Posted October 27, 2023 I am currently working through this nice gem: https://placeholderart.wordpress.com/2015/07/28/implementation-notes-runtime-environment-map-filtering-for-image-based-lighting/ and i just made one small adjustment to the ibl shader pipeline (i simply reduce the samples based on the roughness, roughness = 0 --> samples = 32, roughness = 1.0 --> samples = maxSamples(default 1024)) and with this i was able to generate even 4k cubemaps without the lost device error and nearly the same quality. of course this has be altered to be used only, when x mipmaps are available. But maybe i can integrate some other ideas from this blog as well. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
klepto2 Posted October 27, 2023 Author Share Posted October 27, 2023 4k generated specular map from a 8k hdri image with a max sample count of 1024. 2 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
reepblue Posted October 28, 2023 Share Posted October 28, 2023 Was playing with this. This truly makes it super easy to get skyboxes into Ultra Engine! If you place the extension within the Engine's Tool Directory, you can use this script to launch the application right from the editor which is much more convenient. --[[ This extention is intended to be used with Klepto2's PBR Texture Generator https://www.ultraengine.com/community/topic/62344-pbr-texture-generator/ ]]-- local extension = {} extension.toolpath = "/Tools/PBRTextureGen/UltraPBRTextureGen.exe" function extension.hook(event, extension) if event.id == EVENT_WIDGETACTION then RunFile(AppDir()..extension.toolpath) end end -------------------------------------------------------------------- -- Add menu item -------------------------------------------------------------------- local menu = program.menu:FindChild("Scripting", false) if menu == nil then Print("Error: Could not find \"Scripting\" menu.") return end if menu ~= nil then local submenu = menu:FindChild("Generate", false) if submenu == nil then submenu = CreateMenu("Generate", menu) end extension.menuitem = CreateMenu("PBR Texture Generator", submenu) end ListenEvent(EVENT_WIDGETACTION, extension.menuitem, extension.hook, extension) 3 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Slastraf Posted March 3 Share Posted March 3 Hello. I tried the tool using the GUI and through command prompt. In the GUI it will crash and using the command prompt it will be stuck at Importing Cubemap. The gui will load, but crash on importing either panorama or other import option, or canceling the import. I used this cubemap at 1k resolution (.hdr) https://polyhaven.com/a/symmetrical_garden_02 Windows 11 updated graphics drivers rtx 4090 Quote Link to comment Share on other sites More sharing options...
Josh Posted March 3 Share Posted March 3 We saw the same thing with the Unity Vulkan builds of our benchmarks. It seems like Vulkan code only works temporarily before some update breaks it. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Slastraf Posted March 3 Share Posted March 3 i can build and run exe if they are up to date. i would love to see a new build of this because it is impossible for me to create hdris for now Quote Link to comment Share on other sites More sharing options...
Thirsty Panther Posted March 4 Share Posted March 4 Here you go. Sky.zip 1 Quote Link to comment Share on other sites More sharing options...
klepto2 Posted March 4 Author Share Posted March 4 18 hours ago, Slastraf said: Hello. I tried the tool using the GUI and through command prompt. In the GUI it will crash and using the command prompt it will be stuck at Importing Cubemap. The gui will load, but crash on importing either panorama or other import option, or canceling the import. I used this cubemap at 1k resolution (.hdr) https://polyhaven.com/a/symmetrical_garden_02 Windows 11 updated graphics drivers rtx 4090 I will rebuild and refactor it as soon as the new Ultra Engine version is out, as I think there will be some kind of refactoring needed. I think most work will go into the actual Compute-Pipeline. For my current Environment (atmosphere and ocean) WIP I already have optimized a lot which might cause issues in this build, but I need time to polish it further and make it more future prove and stable. 2 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted May 26 Share Posted May 26 A basic implementation of HDRI to PBR is now available in the editor, without using Vulkan. See Scripts > Utilities > Hdri to PBR in the main menu. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.