Modding:Textures

From Vintage Story Wiki
Revision as of 21:57, 1 May 2020 by Lazy Warlock (talk | contribs) (Created page with "== Basics == Texturing your items and blocks in vintage story is quite simple, but there's some things to consider when using shapes. Lets start off with just using a flat te...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Basics

Texturing your items and blocks in vintage story is quite simple, but there's some things to consider when using shapes. Lets start off with just using a flat texture for an item:

texture: { base: "item/resource/texture" }

If your item has a variant you can also use it in the textures, even without the byType function:

texture: { base: "path to texture/texture-{variant}" }

If your item is rendered with a custom shape using shape: { base: "path to shape" } you can control it's textures using the plural version "textures". Doing so requires that you use the same "#texture" identifier used on each side of a shape cube.

Lets see an example. First we'll look at a few cubes in a shape JSON:

{
  "name": "Cube_1",
  "from": [ 0.5, 0.0, 2.0 ], 
  "to": [ 5.5, 1.0, 2.5 ], 
  "rotationOrigin": [ 1.0, 0.0, -1.0 ],
  "faces": {
    "north": { "texture": "#metal", "uv": [ 0.0, 0.0, 5.0, 1.0 ] },
    "east": { "texture": "#metal", "uv": [ 7.0, 3.0, 7.5, 4.0 ] },
    "south": { "texture": "#metal", "uv": [ 1.0, 2.0, 6.0, 3.0 ] },
    "west": { "texture": "#metal", "uv": [ 7.0, 0.0, 7.5, 1.0 ] },
    "up": { "texture": "#metal", "uv": [ 0.0, 3.0, 5.0, 3.5 ] },
    "down": { "texture": "#metal", "uv": [ 0.0, 0.0, 5.0, 0.5 ] }
  }
}
{
  "name": "Cube_2",
  "from": [ 0.5, 0.0, 2.0 ], 
  "to": [ 5.5, 1.0, 2.5 ], 
  "rotationOrigin": [ 1.0, 0.0, -1.0 ],
  "faces": {
    "north": { "texture": "#wood", "uv": [ 0.0, 0.0, 5.0, 1.0 ] },
    "east": { "texture": "#wood", "uv": [ 7.0, 3.0, 7.5, 4.0 ] },
    "south": { "texture": "#wood", "uv": [ 1.0, 2.0, 6.0, 3.0 ] },
    "west": { "texture": "#wood", "uv": [ 7.0, 0.0, 7.5, 1.0 ] },
    "up": { "texture": "#wood", "uv": [ 0.0, 3.0, 5.0, 3.5 ] },
    "down": { "texture": "#wood", "uv": [ 0.0, 0.0, 5.0, 0.5 ] }
  }
}

Now we can assign the #texture references from our item or block JSON using this format, which can also utilize variants in the regular {variant} format:

textures: {
  "metal": {base: "path to metal texture" }
  "wood": {base: "path to wood texture" }
},