Modding Help [Resolved] Incorrect painting and variants for new tile PNG

Discussion in 'Starbound Modding' started by Shreddys, Jul 25, 2018.

  1. Shreddys

    Shreddys Phantasmal Quasar

    So, I made a PNG for a new blocktype I'm working on (using heavypipes as a base) and expanded the image size to fit more tiles. It worked perfectly, until I started setting it up to have variations and the option to paint it.

    The new image is 176x80 (at base, without the extra copies for the variations and painted versions), but it still thinks the image is 96x48. Meaning whenever a variation is placed or block is painted, it puts down the wrong tile image.

    I've been over the *.matitem, *.material, and the new *.config file I wrote up for it at least a half-dozen times each and I still can't find any entry that states how large the PNG file. What am I missing?
  2. bk3k

    bk3k Oxygen Tank

    You said you used the pipe to start with. In that case you need to realize how the material configurations are set up. A small part of the pipe config is this -
        "NW" : {
          "textureSize" : [16, 16],
          "texturePosition" : [0, 0],
          "colorStride" : [0, 48],
          "variantStride" : [96, 0]
        "N" : {
          "textureSize" : [16, 16],
          "texturePosition" : [16, 0],
          "colorStride" : [0, 48],
          "variantStride" : [96, 0]
    That covers just 2 pieces. The "NW" piece is defined as
    16x16 pixels,
    the position starts on [0, 0] (in this case the top left of the image), and would continue to [15, 15] since it is 16 x 16 in total.
    The next color would be located [0, 48] pixels from the original position, aka 48 pixels from the top left corner.
    The next variant would be located [96, 0] pixels from the original position, aka 96 pixels down from the top left.

    The "N" piece is defined with the same offsets, but a different starting position.
    Starting at [16, 0] so the next color would be found at [16, 48], then [16, 96], and so on.
    Variant 2, color 2 would be found at [112, 48].

    Now you can edit any of that (in your own configuration) including renaming pieces, making your own, etc. There is no special meaning to any piece name, but keep it something that makes sense so you can keep track of it. You just need to make sure your image matches what you've defined here, and keep your math straight.

    But you can't ignore the .material file. So here is the important part from the heavy pipe -
      "renderTemplate" : "/tiles/pipetemplate.config",
      "renderParameters" : {
        "texture" : "heavypipe.png",
        "variants" : 5,
        "lightTransparent" : false,
        "occludesBelow" : false,
        "multiColored" : true,
        "zLevel" : 3380
    If multicolored, you need to have a color variant for every color in the paint tool aka 9. You also need as many variants as you have defined in "/renderParameters/variants". According to this, that's 5 variants. 5 variants x 9 colors = 45 different possible image variations to cover the "NW" piece alone.

    And to cover the PNG image again... according to the material configuration you'd make the image longer the more variants you add. Everything to the right of the existing ones, with the same exact offset. No approximations. Be exact. That's easy using the selection tool since it can tell you the size of your selection in pixels.

    Now if you're looking at the vanilla images and wondering why there has to be so much gap in between... there actually doesn't need to be. The devs simply chose to waste a lot of space - making the images larger than they needed to be - probably to make it easier for them to eyeball and keep track. You don't have to waste a single pixel between pieces if you don't want. That the definitions match your image setup... that's all that really matters.

    I should have mentioned this... I couldn't possibly know what you're missing. You didn't post any images, config files, material files etc, and I can't see your computer screen either. That's why I tried to explain how this works instead. That's pretty well my only option without seeing your files, but that's fine as long as I've said enough that you can hopefully work it out yourself.
    Last edited: Jul 25, 2018
  3. Shreddys

    Shreddys Phantasmal Quasar

    Thank you. I was glossing over the colorStride and variantStride entries.

Share This Page