1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

[GUIDE] How To Make Voxel Materials With New Render (01.159+ DX11)

Discussion in 'Modding Guides and Tools' started by Gwindalmir, Nov 30, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Gwindalmir

    Gwindalmir Senior Engineer

    Messages:
    1,006
    With the new render optimizations, game textures have had restrictions added to them.
    If you are not familiar with them, please read the guide keen posted here: VRage Render Restriction Guide For Modders
    Most of the restrictions are good, as they make sure the game runs optimally. Some I'm not a fan of (more info later on that).

    However one thing that was negatively affected immediately was voxel textures.

    If anyone has modded voxels, I'm sure this sight is very familiar to you:
    [​IMG]

    Let me explain how to fix this. I'll assume for this tutorial you only have DDS textures, and no master files (shame on you if you don't :D). These steps use Photoshop, as that's what I use, and I know it works.
    See the end of the guide for non-Photoshop steps.

    Here's a sample of working voxel textures I fixed with these steps: https://www.dropbox.com/s/5ujkbkxq9vrnxyz/Sample_Voxels.zip?dl=1
    I've included both the .DDS files, and the master TGA files I converted to/from.

    Summary of steps:
    1. Install the Intel Texture Works PS plugin
    2. Convert existing textures to a master format to work in (I use TGA in this example)
    3. Open TGA files in Photoshop, and make sure the size is exactly 2048x2048. No other size will work. I don't like this restriction. IMO, Any power of 2 should be allowed.
    4. Save this master file. :)
    5. Go to "Save As" and select "Intel Texture Works (*.DDS)"
    6. Select "BC7 8bpp Fast (sRGB, DX11+)" Compression (Linear for _ng) and "Auto Generate" mip maps
    7. Save
    8. Done!
    Intel Texture Works
    The Intel Texture works plugin is vital for this, the nVidia texture tools I've found do not work.
    The downside is 64-bit Photoshop can no longer open DDS files for some reason. Use 32-bit if available, or convert to TGA.

    Convert DDS to TGA
    This step is needed 1) due to issues with Intel plugin, and 2) DDS compression is lossy, so every time you open it to edit it and resave, you lose detail. Just like a JPEG.
    Grab texconv.exe from the Space Engineers Space Texture Converter tools and place it with your textures.
    From a command-prompt, convert each of your textures with the following command:
    texconv -ft tga -sepalpha <filename_xx.dds>

    Repeat for each file. Convert all _add, _cm, and _ng files.

    Open and Fix in Photoshop
    Open the TGA files in photoshop, and make sure they are 2048x2048. Resize them if they are not. Also verify each of the channels are as they should be. This is particularly important in the _add file and _cm alpha layer.
    Save this file some place safe when you are done. Always work from this file in the future and recreate the DDS.

    Save Using Intel Texture Works
    When ready, go to File->Save As and from the drop down, select Intel Texture Works (*.DDS)
    [​IMG]

    Select yes to overwrite if asked.
    In the Intel tool window that pops up, select the following options...

    For _add and _cm files:
    Texture Type: Color + Alpha
    Compression: BC7 8bpp Fast (sRGB, DX11+)
    Mip Maps: Auto Generate
    [​IMG]

    For _ng files:
    Texture Type: Color + Alpha
    Compression: BC7 8bpp Fast (Linear, DX11+)
    Mip Maps: Auto Generate
    [​IMG]

    I save those as presets for quick access later.

    Click OK to save.

    The rest of the Voxel modding follows the same as the original. Add the appropriate files to the VoxelMaterials.sbc.

    For Non-Photoshop Users
    If you don't have photoshop, you can still do this.
    Open the TGA texture created above in your photo editor of choice (Gimp, Paint.NET), and make sure the size is 2048x2048.
    Save it when complete, as TGA (32-bit, Alpha, no compress)

    Following the original steps to convert to TGA, you will now convert to DDS.
    Run the following command, substituting your filenames as appropriate:
    For _cm and _add: texconv -ft dds -f BC7_UNORM_SRGB <filename_xx.tga>
    For _ng: texconv -ft dds -f BC7_UNORM <filename_xx.tga>

    That's it.

    Now it should look proper in game:
    [​IMG]

    Verification
    How do you know your saved DDS is in the correct format?
    You can use texconv to verify that.
    Simply perform the conversion like you are creating a TGA, but actually create a PNG instead.
    The output of the command will tell you what the format is.
    [​IMG]

    Delete the PNG files when you are done.

    EDIT:
    I've gotten feedback that Paint.NET can natively export the correct DDS format, without needing texconv. It's worth a shot, though I haven't tried it personally.
     
    Last edited: Nov 30, 2016
  2. Geneticus

    Geneticus Senior Engineer

    Messages:
    1,618
    I did a slightly different workflow that might be easier for those used to working with Gimp and the DX9 process and just want to make textures work.
    I opened my original DX9 DDS files in Gimp as they were 1024x1024.
    I went to Filters>Map>Tile and set the resolution to 2048. This only worked because I was using seamless textures, but preserves the original resolution without pixelating it.
    I then exported the files as DDS BC3 / DXT5 with no mipmaps.
    Next I converted the textures using the Space Texture Converter tool to make the add, cm, and ng files for DX11.
    My settings were Compression = None.
    I have Photoshop CC 2015 with the 64bit Intel TextureWorks Plugin installed. I did not install the 32bit version.
    I loaded the converted textures into PS then saved as the same file with Phoenix84's Textureworks presets.
    After loading up my mod, everything worked.
    The tradeoff is a little lossiness, that I couldn't even see, in exchange for not having to do the extra TGA conversion and command line textconv steps.

    Thanks to Phoenix84 for figuring out our common problem! (1024x1024 textures)
     
    • Like Like x 1
  3. entspeak

    entspeak Senior Engineer

    Messages:
    1,744
    Thanks for this!

    Question: Can we use the Fine setting instead of the Fast?

    Also, I know how PBR textures are setup, but SE is a little different. I understand Color , Metalness, Normal, Gloss, AO and Emissive. The one that I don't quite understand is Dirt. What impact does it have on the texture?

    We don't use Height or Roughness, correct?

    Edit: According to the guide, we don't use an alpha channel for _add files. I've used the Color setting instead of the Color + Alpha and I haven't had an issue. Is the alpha channel used for anything on _add files... am I missing something there?
     
  4. Gwindalmir

    Gwindalmir Senior Engineer

    Messages:
    1,006
    I don't know *that* much about textures. For voxels, I just create the textures the same way as for block models, as it works. Alpha may not be used by voxels, but it probably still needs to be there.

    See this guide: https://harag-on-steam.github.io/se-blender/#directx-11-textures
     
  5. entspeak

    entspeak Senior Engineer

    Messages:
    1,744
    I don't know *that* much about textures. For voxels, I just create the textures the same way as for block models, as it works. Alpha may not be used by voxels, but it probably still needs to be there.

    See this guide: https://harag-on-steam.github.io/se-blender/#directx-11-textures[/QUOTE]
    It also works without. I was just following Keen's custom voxel guide - which doesn't refer to an alpha for _add files, but as those can get outdated easily, I wondered if something had changed. I'll continue not using an alpha in the _add files for now. Saves a teeny bit on file size. I've got settings for _cm, _ng, and _add saved in the Intel DDS save window, so it's no biggie to continue as is. I wish they would get rid of the unneeded file mentions in the Voxel Materials.sbc configs. It still refers to _de and _ns files that no longer exist (remnants from Dx9?).

    EDIT: In looking at harag's guide, I notice another difference between the _add files for voxels vs models - the blue channel. It isn't used for models, but for voxels this is the "dirt" channel. I don't know if this is Keen's layman term for specularity or what it is.
     
    Last edited: Dec 15, 2016
Thread Status:
This last post in this thread was made more than 31 days old.