Welcome to Keen Software House Forums! Log in or Sign up to interact with the KSH community.
  1. You are currently browsing our forum as a guest. Create your own forum account to access all forum functionality.

Official Guide: VRage Render restriction guide for modders

Discussion in 'Modding' started by Drui, Oct 27, 2016.

Thread Status:
This last post in this thread was made more than 31 days old.
  1. Drui Keen Update Guy Staff

    Messages:
    1,390
    • Disagree Disagree x 5
  2. Phoera Senior Engineer

    Messages:
    1,711
    @Drui, Emissivites will be supported up to index 4 only?
    or that just pattern sample?
     
  3. Gwindalmir Senior Engineer

    Messages:
    1,000
    Emissives are already hardcoded in the gamelogic. Modded blocks can't use those, otherwise the existing block gamelogic affects them.
    I pushed for SetEmissiveParts in the ModAPI specifically for this.

    If the reason is because of some performance hit for allowing any material to be emissive, then please give us a way to tell the game which materials of ours can be emissive. That keeps the performance while still allowing customization. This is a major form of visual feedback for mods.

    If not, my visual revamp of the Stargate mod is officially dead. :mad:

    The DHD and gate lightup shown in this video will no longer be possible:
     
    Last edited: Oct 27, 2016
    • Agree Agree x 1
  4. Cendos Technical Lead Staff

    Messages:
    15
    Hi Phoenix,

    good point. It is possible to add items to this list as well using environment.sbc

    There is a MaterialsSettings / ChangeableMaterials list, which can be expanded by with items.

    Currently, the list is not mergable, so it has to be supplied as complete (and various mods can overwrite each other). We will improve it in the future.
     
    • Informative Informative x 2
    • Like Like x 1
  5. Phoera Senior Engineer

    Messages:
    1,711
    @Cendos, but what about old support of emmisive, like name material like Emissive400, and you can control it from mod.
    this is gone?

    cuz i will need that in my future mod, and if it removed i will not even start to play with that.
     
  6. darth_biomech Senior Engineer

    Messages:
    1,550
    No love for the 256x256, 128x128, 64x64 and 8x8? Why?
    Well, there goes that option of optimization of mod size, I guess... Hello 4096x4096 waste of space while it is just a flat color fill that very well could be 8x8 with no impact on the visuals...
     
    • Like Like x 1
  7. Eikester Apprentice Engineer

    Messages:
    422
    i guess thats the point now where i quit modding for SE completely
     
  8. Cendos Technical Lead Staff

    Messages:
    15
    You can create a texture atlas for those kinds of textures. We are doing it as well and it works just fine.

    The reason for all this is to be able to batch the draw calls (essentially all the materials with the same size can be rendered at once).

    Right now, those size limits are not hard stops. It is warning only. We still have the old render system in as the new system is still not finished. Once we will switch to new render system completely, mods using other texture sizes / formats will be rendered using old system - therefore without performance optimizations.
     
    • Informative Informative x 2
    • Like Like x 1
  9. Devon_v Senior Engineer

    Messages:
    1,602
    Wouldn't a solid color texture of any size just compress into "This pixel is red. So are the next 16 million."?
     
  10. Cendos Technical Lead Staff

    Messages:
    15
    Whatever Emissive* stuff should work the same way as long as it is entered in the environment.sbc file.
    --- Automerge ---
    Unfortunately, GPU accelerated compressions works a little differently - the payload per every bunch of pixels (4x4) is fixed, no matter whether they contain solid color or a noise:
    http://www.reedbeta.com/blog/understanding-bcn-texture-compression-formats/
     
  11. EctoSage Trainee Engineer

    Messages:
    82
    "the only supported resolutions for future will be 512x512, 1024x1024, 2048x2048, 4096x4096"
    Does this limitation only apply to models, or will our UI elements (Such as block icons) need to be 512 now? (Currently I use 128x128)

    "colorMetal textures (_cm) need to be in the following format: BC7_UNORM_SRGB"
    How do I set this format? Is this something done when using the Nvidia .dds Format exporter for photoshop, or something set elsewhere? Either way, how does one chose this 'format'?
     
  12. Cendos Technical Lead Staff

    Messages:
    15
    It refers only to models.

    We recommend using microsoft's texconv.exe tool for now or wait a while for our inhouse tool (TexturePacker) to get updated.
     
  13. Phoera Senior Engineer

    Messages:
    1,711
    @Cendos, i found that lines in Environment:


    i need just add materian into that list and i can use it via GetEmissive('MyMaterial'), as usual?
    right?

    then we only need to make that list mergable, may be move it to separate file?
     
  14. Cendos Technical Lead Staff

    Messages:
    15
    Exactly.

    The merging haven't occurred to me, sorry. But should be easy fix, hopefully to the next update.
     
  15. Gwindalmir Senior Engineer

    Messages:
    1,000
    I tried using the ChangeableMaterials item in the environment.sbc, and it didn't work.

    My materials in the model XML match what is under MaterialName.

    Code:
    <?xml version="1.0"?>
    <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Definition xsi:type="EnvironmentDefinition">
        <Id>
          <TypeId>EnvironmentDefinition</TypeId>
          <SubtypeId>Stargate</SubtypeId>
        </Id>
        <MaterialsSettings>
          <Data>
          </Data>
          <ChangeableMaterials>
            <ChangeableMaterial>
              <MaterialName>Chevron1</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron2</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron3</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron4</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron5</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron6</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron7</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron8</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron9</MaterialName>
            </ChangeableMaterial>
            <!-- DHD -->
            <ChangeableMaterial>
              <MaterialName>DialButton</MaterialName>
            </ChangeableMaterial>
          </ChangeableMaterials>
        </MaterialsSettings>
      </Definition>
    </Definitions>
    EDIT: I even tried changing the Subtype to 'Default' and added the stock ones, nothing. It's like it's not being read for mods.
     
    Last edited: Oct 27, 2016
  16. retep998 Trainee Engineer

    Messages:
    43
    I'd just like to say that I am really glad that you're actually handling sRGB correctly.
     
  17. Gwindalmir Senior Engineer

    Messages:
    1,000
    I see a lot of these warnings like these in VRageRender-DirectX11.log:

    Code:
    2016-10-27 11:09:19.870 - Thread:  22 ->        Asset C:\Users\<name>\AppData\Roaming\SpaceEngineers\Mods\HydrogenCollector\Models\Cubes\Large\SolarHydrogenCollector.mwm tries to overrwrite material Emissive0 with different textures
    2016-10-27 11:09:19.989 - Thread:  22 ->        Asset Models\Cubes\Small\HydrogenTank.mwm tries to overrwrite material Emissive4 with different textures
    2016-10-27 11:09:20.265 - Thread:  22 ->        Asset Models\Cubes\Large\Camera.mwm tries to overrwrite material Emissive with different textures
    Does this mean only one emissive name can be mapped to a unique texture?
    This is going to be nightmare for setting those programmatically, if I ever get it working again.
     
  18. Phoera Senior Engineer

    Messages:
    1,711
    gah man, looks like even default assets not adapted...
     
  19. Lé Grand Sárrazin Apprentice Engineer

    Messages:
    125
    Luckily, for me, I just use vanilla textures atm..

    Hey Sage, I feel your pain, it is a bitch to deal with .dds images. I got a lot of help starting out modding .dds here:
    http://forum.keenswh.com/threads/dx11-dds-files-invalid-image-file-header.7375544/
    https://github.com/Microsoft/DirectXTex/wiki/Texconv
    https://github.com/Microsoft/DirectXTex
    Also, hit-up Harag if you can, he is the master at this.

    texconv is all command line. I hope you're comfortable working with command line. Anyway.

    Here's an intro if not: http://www.digitalcitizen.life/command-prompt-how-use-basic-commands
    You at least just need to know >cd/ change directory command to navigate to your texconv folder.

    This is the command you will need to use to get what you want:
    "~texconvdirectory~\texconv -f BC7_UNORM_SRGB -if TRIANGLE_DITHER_DIFFUSION -sepalpha DDS.dds"
    note you can substitute any image file you want for DDS.dds, if you wanna use .tga or .tiff, what have you.
    For funsies, you can even convert .dds to .tga or .tiff, and play with your textures outside of PS, then convert back to .dds afterward. It can be a very useful tool.


    I think you're smart enough to figure out the rest. I just know how much "fun" it was getting used to changing file formats in command prompt. Hope I was of some help. Feel free to shout-out if you need anything else.
    --- Automerge ---
    Otherwise.. this doesn't look good for Phoenix.. and what's bad for Phoenix, should be bad for everyone!!
    --- Automerge ---
    Nooo your steel catwalk trapdoor is the best, so simple, so awesome. Why does Keen always have to drive away the best modders!? I know times are a changin', but damn!! :,(
     
    Last edited: Oct 27, 2016
  20. Harag Junior Engineer

    Messages:
    913
    Mexpex found this: Photshop users can use Intel's texture plugin (https://github.com/GameTechDev/Intel-Texture-Works-Plugin, binaries can be downloaded under "Releases")

    [​IMG]

    Save these settings as presets like I did here. _add uses the same settings as _cm so I didn't include a preset for that.

    Note that I have no idea how to make sure that what is saved as linear colorspace actually has color values in that colorspace. I don't use Photoshop.
    --- Automerge ---
    And in my opinion the guide's section on glass is inadequate:
    • How is transparency controlled? Is this still done via TransparentMaterials.sbc? If yes, how does that work considering material names are now fixed?
    • Does that mean each model can have only two alpha-blended materials? Texture-atlasing doesn't mix with texture-tiling.
    • Does this interact with the normal PBR textures somehow?
     
  21. Digi Senior Engineer

    Messages:
    2,337
    @Harag The guide doesn't address modded glass or emissives at all really, it only indicates that we can only use predefined things, which is rather sad.

    For emissive and glass materials to work they now need to be added to environment.sbc's material list but the material list is ignored in mods and the script class for those materials is prohibited so we can't add to it right now.

    Glass now needs to be set in the material name which needs to match to the transparent material name. GlassMaterialCW/CCW no longer used (and GlassSmooth never worked).
    Example from SDK:
    Code:
    	<Material Name="GlassInside">
    		<Parameter Name="SpecularIntensity">30</Parameter>
    		<Parameter Name="SpecularPower">42</Parameter>
    		<Parameter Name="DiffuseColorX">255</Parameter>
    		<Parameter Name="DiffuseColorY">255</Parameter>
    		<Parameter Name="DiffuseColorZ">255</Parameter>
    		<Parameter Name="Technique">GLASS</Parameter>
    	</Material>
    	<Material Name="GlassOutside">
    		<Parameter Name="SpecularIntensity">30</Parameter>
    		<Parameter Name="SpecularPower">42</Parameter>
    		<Parameter Name="DiffuseColorX">255</Parameter>
    		<Parameter Name="DiffuseColorY">255</Parameter>
    		<Parameter Name="DiffuseColorZ">255</Parameter>
    		<Parameter Name="Technique">GLASS</Parameter>
    	</Material>
    
    And since they're basically the same as before, it doesn't seem to support any special textures yet.

    What gave you the idea it can only have 2 transparent materials per model ?

    @Phoera nevermind that, I was replying to the above comment but misread the part with 2 materials so I edited it to a question :p
     
    Last edited: Oct 28, 2016
  22. Phoera Senior Engineer

    Messages:
    1,711
    that one in guide.
     
  23. Lé Grand Sárrazin Apprentice Engineer

    Messages:
    125
    You scared me there. Well, my speed mod still works anyway. Hopefully, it stays that way!!
     
  24. Harag Junior Engineer

    Messages:
    913
    GlassInside and GlassOutside are two materials. Other names are disallowed. Hence a maximum of two. But I might have misunderstood. That's why I'm saying the guide needs more information ;)
     
  25. Digi Senior Engineer

    Messages:
    2,337
    Yeah nvm that, I needed to do a full game restart between tests since some things seem to persist.
    It still ignores the materials part, I'm not the only one who tried adding to that list :D
     
    Last edited: Oct 28, 2016
  26. Cendos Technical Lead Staff

    Messages:
    15
    As I said earlier, you have to include full list of original materials in ChangeableMaterials as it is not merged, so your modded environment.sbc should look like this:
    Code:
    <?xml version="1.0"?>
    <Definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Definition xsi:type="EnvironmentDefinition">
        <Id>
          <TypeId>EnvironmentDefinition</TypeId>
          <SubtypeId>Stargate</SubtypeId>
        </Id>
        <MaterialsSettings>
          <Data>
          </Data>
          <ChangeableMaterials>
      <ChangeableMaterial>
      <MaterialName>ScreenArea</MaterialName> <!-- used on LCD panels-->
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Display</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive0</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive1</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive2</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive3</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Emissive4</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>Glass</MaterialName> <!-- REMOVE-ME After cockpit converted to static glass -->
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>GlassInside</MaterialName>
      </ChangeableMaterial>
      <ChangeableMaterial>
      <MaterialName>GlassOutside</MaterialName>
      </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron1</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron2</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron3</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron4</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron5</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron6</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron7</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron8</MaterialName>
            </ChangeableMaterial>
            <ChangeableMaterial>
              <MaterialName>Chevron9</MaterialName>
            </ChangeableMaterial>
            <!-- DHD -->
            <ChangeableMaterial>
              <MaterialName>DialButton</MaterialName>
            </ChangeableMaterial>
          </ChangeableMaterials>
        </MaterialsSettings>
      </Definition>
    </Definitions>
    We will address this limitation ASAP.
     
    • Like Like x 2
  27. Gwindalmir Senior Engineer

    Messages:
    1,000
    Thanks, but I actually tried that already, it didn't work either.
    There seems to be an issue where that information isn't loaded properly when they are in mods. They only work if you edit the vanilla sbc.
     
  28. Harag Junior Engineer

    Messages:
    913
    Hm, why put that information in Environment.sbc at all? Why not define a new flag for materials and set it via a new parameter in MwmBuilder's .xml? The file is ok as a migration-step but in my experience it's nearly always better to directly annotate the stuff that is to be affected. Those centralized files always become magnets for merge-conflicts (VCS or otherwise).
     
    Last edited: Oct 29, 2016
    • Agree Agree x 4
  29. Gwindalmir Senior Engineer

    Messages:
    1,000
    I second this.
    I've been using this tool for a few months now, way better than nvidia texture tool (much better compression).
    Only downside is you can no longer open DDS in PS. You can only save.
    Luckily it only breaks 64-bit PS. So if I need to open a DDS in PS, I use the 32-bit version, then save as a TGA to open in 64-bit.
    Rare, but once in a while you need it.
     
  30. Cendos Technical Lead Staff

    Messages:
    15
    Guys, we are working on the fix for ChangableMaterials. It will hopefully be out in the next week's update.

    I agree, the mwm xml file is better choice in the long run, but for now, we needed to transform the old objects without the need of reexporting all of them.

    We will also update the guide on glass this week and release latest version of our internal tool for conversion of textures.

    Sorry for the inconvenience.
     
Thread Status:
This last post in this thread was made more than 31 days old.