Modding:CompositeTexture: Difference between revisions

From Vintage Story Wiki
(Created page with "[https://apidocs.vintagestory.at/api/Vintagestory.API.Client.CompositeTexture.html CompositeTexture] is the type of the json object stored in the <code>textures</code> property of blocks and items. Here is an example from a block with the surrounding textures dictionary. Note that the composite texture is only the part that contains the "base" field. <syntaxhighlight lang='json'> textures: { all: { base: "block/glass/{type}" }, } </syntaxhighlight> == Properties ==...")
 
Line 130: Line 130:
     <td>integer</td>
     <td>integer</td>
     <td>255</td>
     <td>255</td>
     <td>255 is ignored. Other values are a percentage to adjust the texture alpha channel.</td>
     <td>255 keeps the input alpha channel without altering it. Other values are a percentage to adjust the texture alpha channel. For example, 200 doubles the alpha channel in the input image.</td>
     <td>-</td>
     <td>-</td>
   </tr>
   </tr>

Revision as of 06:55, 4 November 2023

CompositeTexture is the type of the json object stored in the textures property of blocks and items. Here is an example from a block with the surrounding textures dictionary. Note that the composite texture is only the part that contains the "base" field.

textures: {
    all: { base: "block/glass/{type}" },
}

Properties

Property Type Default Usage Reference
CompositeTexture
base
string required The asset location of the main texture. Any block
overlays
deprecated: array of strings empty Asset locations for overlays. Use blendedoverlays instead. -
blendedoverlays
array of overlays empty Combines the overlay textures with the base texture. door

Each entry of the array is a simplified texture, with the fields base and blendmode. The asset location of the overlay is given through the base field. The optional blendmode field describes how to combine the overlay. Example:

    { base: "block/wood/debarked/{wood}", blendedOverlays: [{ base: "block/wood/door/overlay-wide", blendMode: "Overlay" }] }

The available blend modes are:

Normal (default)
The overlay is like a translucent piece of glass placed in front of the base. If the overlay is completely opaque, then it replaces the base texture. If it's completely transparent, then the base texture shows through. Alpha values in the middle cause the overlay to partially replace the base texture.
Darken
Lighten
Multiply
Screen
ColorDodge
ColorBurn
Overlay
alternates
array of composite textures empty If alternates are present, every time a block is placed in the world, either the base texture or one of the alternates is randomly chosen. Alternates can also be chosen through a base wildcard. rock

The top level rotation and overlay properties do not apply to alternates, but those property can be set directly on each alternate.

Example that directly specifies the alternatives:

{
  base: "block/clay/hardened/{type}1",
  alternates: [{ base: "block/clay/hardened/{type}2"}, { base: "block/clay/hardened/{type}3" }],
}

Example that uses the base wildcard to specify alternates. Every file matching the wildcard is registered as an alternative.

{ base: "block/stone/rock/{rock}*" }
tiles
array of composite textures empty Similar to alternates, this is a list of different textures to use. The difference is that these alternate textures are used in a repeating grid pattern. tilingcobblestonetest
     tiles is the array of textures from traverzing the grid in a left to right, top to bottom order. The width of the grid must be specified with tilesWidth. Instead of directly specifying every tile texture, they can also be specified with a single entry that uses a wildcard. Example:
{
    base: "block/stone/cobblestone/tiling/1",
    tiles: [
        { base: "block/stone/cobblestone/tiling/*" }
    ],
    tilesWidth: 4
}
tilesWidth
integer 0 The width of the tile grid. Every this many textures from tiles forms a new tile row. This property only has an effect if tiles non-empty. tilingcobblestonetest
rotation
integer 0 Amount to rotate the texture counter-clockwise. The number must be a multiple of 90. planks
alpha
integer 255 255 keeps the input alpha channel without altering it. Other values are a percentage to adjust the texture alpha channel. For example, 200 doubles the alpha channel in the input image. -
For example, 50 would half the alpha values in the texture (make it more transparent), and 200 would double the alpha values in the texture (make it more opaque).
Icon Sign.png

Wondering where some links have gone?
The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.

Modding
Modding Introduction Getting Started Theme Pack
Content Modding Content Mods Developing a Content Mod Basic Tutorials Intermediate Tutorials Advanced Tutorials Content Mod Concepts
Code Modding Code Mods Setting up your Development Environment
Property Overview ItemEntityBlockBlock BehaviorsBlock ClassesBlock EntitiesBlock Entity BehaviorsWorld properties
Workflows & Infrastructure Modding Efficiency TipsMod-engine compatibilityMod ExtensibilityVS Engine
Additional Resources Community Resources Modding API Updates Programming Languages List of server commandsList of client commandsClient startup parametersServer startup parameters
Example ModsAPI DocsGitHub Repository