• Any way to decompile HDR sky textures?
    3 replies, posted
L4D2 has several amazing skyboxes, but since LDR support has been dropped for the newer engine branches, it doesn't have these textures - so instead of the pretty skybox, people on GMod with HDR disabled only see a post apocalyptic purple checkerboard sky. I've tried exporting the textures with VTFedit and VTex, but both have only spewed out a strange .tga with 4 channels (RGBA). Here's how they looked like: [B]Ingame (yay pretty)[/B] [T]http://i.gyazo.com/1494d2448555942374939f5fa01dbb09.png[/T] [B]RGB[/B] This one looks like a texture that determines the exposure ingame. [T]http://i.gyazo.com/04c7e777efae83c1ebd2f132375c7557.png[/T] [B]Alpha[/B] And this appears to be a much darker respresentation of the ingame sky. [T]http://i.gyazo.com/3003bf6c5a52bdec80df74683fba01ed.png[/T] I've also using cubemaps to take screenshots of the skybox, but they're randomly lightened / darkened. I'd need a much bigger monitor to take 512x512 cubemaps, too. Does anyone know how to export them / convert to LDR properly? [B]File downloads[/B] [url]https://dl.dropboxusercontent.com/u/33369101/Permanent%20Files/skybox/sky_l4d_predawn02_hdrrt.tga[/url] [url]https://dl.dropboxusercontent.com/u/33369101/Permanent%20Files/skybox/sky_l4d_predawn02_hdrrt.vtf[/url]
It's because they're "compressed" HDR, check out the wiki page on it: [url]https://developer.valvesoftware.com/wiki/HDR_Skybox_Creation[/url] I don't remember, nor is it on that page; but there's a formula that uses the Alpha to "de-compress" it. [editline]14th December 2014[/editline] Found it [quote]HDR textures can be stored in compressed form using the BGRA8888 format. The formula to convert these colors back to integer HDR is: RGB = RGB * (A * 16) and for floating point HDR: RGB = (RGB * (A * 16)) / 262144[/quote]
Stiffy360 found a great way to rebuild them in Photoshop. The result is almost identical to ingame skybox. [B]1.[/B] Open the .tga and go to Channels [B]2.[/B] Click on the Alpha 1 and go to Image - Adjustments - Levels [B]3.[/B] Change the Midtones to a value around 3.00 [B]4.[/B] Paste the modified Alpha 1 into a separate layer and place the color layer above it with "Overlay" blending [T]http://i.gyazo.com/e5f732d5633bb4ca7dc8f86e1ee464e5.png[/T] [T]http://i.gyazo.com/c17c18a191eab5205bf3b5ffd70d3a99.png[/T] [T]http://i.gyazo.com/7a704d41a5658128e89e8ad99f1c111d.png[/T] [T]http://i.gyazo.com/3d1c61b4a1c3ebfe1b51514ae28684f5.png[/T] [T]http://i.gyazo.com/2b9549ac676a5d4ea833fe7b20b71e99.png[/T]
I don't know the accuracy of that, when I tried it in PS I got a lot of grain; doing it mathematically in Fusion looked great to me. [t]http://s.gvid.me/s/2014/12/14/1418590881-3pc.png[/t] [t]http://s.gvid.me/s/2014/12/14/1418590885-4uc.png[/t] For a little explanation, it just imports the TGA, I then change the bitdepth to 32float (just my preferable working space), then the custom tool on the top takes the alpha and multiplies its values by 16 (a1*16), while the one on the bottom strips the alpha out; then they get multiplied together. Using photoshop: [t]http://s.gvid.me/s/2014/12/14/l4d2_skybox_s360.png[/t] Fusion: [t]http://s.gvid.me/s/2014/12/14/l4d2_skybox_fuse.png[/t] Because it's easy to batch, I went ahead and did that whole set in case you wanted them: [url]http://s.gvid.me/s/2014/12/14/Fixed_TGA.7z[/url] [editline]2017-2-03[/editline] Hey future readers, here's how to do it in [B]Photoshop[/B]: [vid]https://s.gvid.me/s/2017/02/03/syB425.webm[/vid] It's important you copy the alpha into a GREY document, or else photoshop messes it all up.
Sorry, you need to Log In to post a reply to this thread.