Texture Cooker (in-game PNG to DDS converter)

Discussion in 'Content Creation' started by Nadeox1, Apr 17, 2021.

  1. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,641
    Hello,

    Sometime around 0.20 we added a extra-useful feature into the game called Texture Cooker, which is nowadays a fundamental tool we use in our assets creation workflow.

    What?

    This tool lets the game automatically convert PNG textures files into the most appropriate DDS format.

    Why?
    DDS is a texture format optimized for 3D applications, and is optimized for GPUs allowing them to use less memory.
    Not many image editing software support these format natively, and some require plugins/addons that are often not up to date.
    The texture cooker removes this issue by allowing you to keep working with PNG and leaving to the game the conversion.


    More?
    You can find this feature fully documented here:
    https://documentation.beamng.com/modding/materials/texture_cooker/


    Feel free to ask for any questions, doubts or etc. in regards :)
     
    • Like Like x 13
  2. Sithhy™

    Sithhy™
    Expand Collapse

    Joined:
    Apr 5, 2017
    Messages:
    2,796
    Is that the reason why there are textures in .png format in the official game vehicles? Pretty cool if I don't have to fiddle around with exporting them the correct way in .dds
     
  3. Nadeox1

    Nadeox1
    Expand Collapse
    Spinning Cube
    BeamNG Team

    Joined:
    Aug 5, 2012
    Messages:
    14,641
    If you mean why, in some of our materials files, we point to .png textures, yes! We have used the texture cooker in those cases, working with .png files on our end, but releasing the converted .dds files when done.

    Even though the texture paths are pointing to .png file, the game automatically uses the converted .dds files if they are detected.

    In general with this you can export textures as .png while we are working on content and let the game care about the .dds conversion.
     
    • Like Like x 3
  4. Artistterrymartin

    Artistterrymartin
    Expand Collapse

    Joined:
    May 5, 2019
    Messages:
    59
    After the last update the console shows more in detail what I did that did not jive with the texture cooker. Apparently all textures need to be to the power of 2. Assuming that is 1024x1024 or 4096x4096 for example and not some odd ball 1937x846. I made a new object with the correct dimensions and it worked as it should. Worked great ! upload_2021-4-29_13-8-10.png
     
    #4 Artistterrymartin, Apr 27, 2021
    Last edited: Apr 29, 2021
  5. Artistterrymartin

    Artistterrymartin
    Expand Collapse

    Joined:
    May 5, 2019
    Messages:
    59
    I read the documentation and I can find the DDS in the temp folder that are converted, however I can not select the static mesh and be allowed to modify the material any further on imported DAE's from Blender. Things like alpha blend, animation, lighting or adding other textures to the other locations like normal reflection, cutout ect. This only is for materials the Texture Cooker has converted PNGS for. I export from Blender with only a color map being I read T3d handles all other types of textures in engine.
    If I make new material it says one is already created in the console for material converted which is obvious but If I type the texture in the search box it does not yield a result. This is where I have all my models and pngs stored. C:\Users\Terry\Desktop\TM\0.22\levels\Crater
    Should they be in a subfolder to "Crater" in say the art folder or other ?
    Thanks.
    I am thinking I can delete that temp folder and clear up some issues. Will back my level folder up first.
    I am going to make a new test level to get a fresh take thinking I may have done something wrong to an item or material JSON file somewhere along the way editing them.
    Hate to be a pain in the end side but appreciate the time to read this or respond.
     
  6. ltntai

    ltntai
    Expand Collapse

    Joined:
    Mar 18, 2017
    Messages:
    301
    Sometimes the cooker does a lousy job compared to manual conversion. Transparency issue, perhaps?

    png_49_8KB_no_xcf.jpg cooked_dds_341KB.jpg manual_BC7_sRGB_256KB.jpg Terrys_enhanced_4k_21MB.jpg cooked_1024_133.jpg
    1. Original decal png 512x512, 49.8 KB, xcf file removed from folder
    2. Cooked, 341 KB
    3. Paint.net conversion to BC7 sRGB default, no mipmaps, 256 KB
    4. Terry's enhanced no4, 4k, 21.3 MB
    5. Terry's 1024x1024 cooked, 1.33 MB
     

    Attached Files:

    #6 ltntai, May 10, 2021 at 11:22 PM
    Last edited: May 11, 2021 at 10:52 PM
  7. Agent_Y

    Agent_Y
    Expand Collapse

    Joined:
    Jul 10, 2020
    Messages:
    2,543
    For me it honestly always works a lot better than manual conversion and it solves the transparency issues that can happen normally. The only weird thing I found out that it's very slow at cooking skins for the H-Series, it might just be me, but it takes like half a minute when it's supposed to be instant and works almost instantly for other vehicles.
     
  8. Artistterrymartin

    Artistterrymartin
    Expand Collapse

    Joined:
    May 5, 2019
    Messages:
    59
    That looks like compression artifacts, frustrating. Can you scale the image using bicubic smoother (best for enlargements) then let the texture cooker convert it. I am thinking the more pixels you are converting, the better the compression artifact will be. This is just the photoshop image scale, but any should work. Then resize to 512 x 512 if you have using Bicubic Sharper for the reduction. image sizes here do not reflect power of 2, its just the enlarge and reduction I mean to point out.
     

    Attached Files:

    • Untitled-1.jpg
    • Untitled-2.jpg
  9. Artistterrymartin

    Artistterrymartin
    Expand Collapse

    Joined:
    May 5, 2019
    Messages:
    59
    I made a few variations, from simply only scaled to 4k, to several other variations you might like to try. also converted one of them to a Normal map if you are familiar with what they do. Drop in the texture slot under the color map where it says normal map. Just rename the one that works for you to your file name.color. some are 1_ 2_ 3_ 4_ to let you know they are variations of the map. Just easier to say, whatever one you try, just rename to your file :) And leave the .normal on the normal map. Did some painting on those letters to try to clean them up some in a couple of them. One is an 8k, 8192x8192, but doubt it will make much more difference than the 4k ones.
    Hope it helps !
    -Terry

    Added the Photoshop format file if you get Photoshop Elements or Photoshop Regular. Elements is a cheaper version that usually ships as free included with cameras, or laptops. Not very much to buy it either.
    I use Gimp alot. Gimp does seamless tile maps and normal maps in the main filters. Gimp is Free.
    Remember to export to save as in gimp. Just saving saves as a gimp file. Exports DDS, but think its a different version or compression. upload_2021-5-11_12-43-12.png upload_2021-5-11_12-43-35.png
    --- Post updated ---
    Dam, hehe... It looks exactly the same before enlarging then shrinking. 512x512 would work if the font was larger for the bottom letters. They are so small that it is giving the artifacts. If you make any more signs or want to modify this one here is a link to a site with free Fonts. In photoshop or any editor you can type the font out as a vector instead of a rasterized. Think of a vector as meta data that no matter what size the font is, the raster will mathematically display it correctly. Only thing is it has to be rasterized to be flattened but I think it would give a better place to start from when shrinking. Sorry it took so long to get back. Also sent a 1024x1024 and a normal.png of the 512 x 512. Using a normal could give it a little more detail. You can make a normal for the side view of the hanger, and those 3d bars will apply to the sign too. You can have your metal hanger thing do same thing as the wood on the paint.
    upload_2021-5-11_16-22-57.png upload_2021-5-11_15-26-29.png Beer Fonts | FontSpace
     

    Attached Files:

    #9 Artistterrymartin, May 11, 2021 at 9:21 PM
    Last edited: May 11, 2021 at 10:23 PM
    • Like Like x 2
  10. ltntai

    ltntai
    Expand Collapse

    Joined:
    Mar 18, 2017
    Messages:
    301
    Thank you Artistterrymartin for your time and expertise. 1024 converted nicely. And just to make clear, that's not my map or textures. It's Ouerbacker's Las Colinilas de Vapor, which I thought was worth to future proof with new files.
     
  11. Artistterrymartin

    Artistterrymartin
    Expand Collapse

    Joined:
    May 5, 2019
    Messages:
    59
    Thanks, not an expert but learning as I go. Glad I could help... The more people share knowledge the more the community can benefit. I will keep eye out for any maps or mods you make. My next project will be next month, want to learn the Jbeams and Nodes. I want to make mods after my map is done. More destructible objects is where my interest is focused.
     
    • Like Like x 1
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice