Modding:Texturas

From Vintage Story Wiki
Revision as of 20:52, 14 June 2023 by Eleli (talk | contribs) (Created page with "Podemos ver aquí que sólo la variante "vintage" se renderizará como una textura de objeto voxelizada normal, mientras que el resto utilizará la forma redmeat y le aplicará su textura.")
Other languages:

This page was last verified for Vintage Story version 1.15.


Antes de personalizar las texturas, te sugerimos que leas primero las páginas Item Básico, Bloque Básico y Entidad Básica para entender este tutorial.


Texturizar un Item

Texturización plana

Texturizar tus objetos y bloques en Vintage Story es bastante sencillo, pero hay que tener en cuenta algunas cosas a la hora de usar formas. Empecemos usando una textura plana para un objeto:

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

Si su ítem tiene una variante, también puede utilizarla en las texturas, incluso sin la función byType:

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

Texturización de formas

Si tu ítem se renderiza con una forma personalizada usando shape: { base: "path hacia la forma" } puedes controlar sus texturas usando la versión plural "textures". Para ello es necesario que utilices el mismo identificador "#texture" utilizado en cada lado de un cubo de forma.

Veamos un ejemplo. En primer lugar vamos a ver algunos cubos en una forma JSON:

{
  "name": "Cubo_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": "Cubo_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": "#madera", "uv": [ 0.0, 0.0, 5.0, 1.0 ] },
    "east": { "texture": "#madera", "uv": [ 7.0, 3.0, 7.5, 4.0 ] },
    "south": { "texture": "#madera", "uv": [ 1.0, 2.0, 6.0, 3.0 ] },
    "west": { "texture": "#madera", "uv": [ 7.0, 0.0, 7.5, 1.0 ] },
    "up": { "texture": "#madera", "uv": [ 0.0, 3.0, 5.0, 3.5 ] },
    "down": { "texture": "#madera", "uv": [ 0.0, 0.0, 5.0, 0.5 ] }
  }
}

Ahora podemos asignar las referencias #texture desde nuestro item o bloque JSON usando este formato, que también puede utilizar variantes en el formato regular {variant}:

textures: {
  "metal": {base: "path hacia la textura de metal" },
  "madera": {base: "path hacia la textura de madera" }
},

Se trata de un método útil, ya que tanto "metal" como "madera" pueden asignarse a varios cubos dentro del JSON de la forma.

Textura de Forma Voxelizada

Si decides que quieres que una variante de un ítem no se renderice usando una forma JSON puedes usar la propiedad "voxelizeTexture" al definir una forma. Echemos un vistazo a lo que hace el JSON de redmeat:

shapebytype: { 
  "redmeat-vintage": { base: "item/empty", voxelizeTexture: true },
  "*": { base: "item/food/meat/red" },
},
texturesbytype: {
  "redmeat-raw": { 
    "meat": {base: "item/food/meat/raw" }
  },
  "redmeat-cooked":  { 
    "meat": {base: "item/food/meat/cooked" }
  },
  "redmeat-cured":  { 
    "meat": {base: "item/food/meat/cured" }
  },
  "redmeat-vintage": {
    "item/empty":  { base: "item/food/meat/vintage" }
  }
},

Podemos ver aquí que sólo la variante "vintage" se renderizará como una textura de objeto voxelizada normal, mientras que el resto utilizará la forma redmeat y le aplicará su textura.

Texturing a Block

Simple Block

Blocks are textured a little differently since they default to generic "cube" shape. This means they don't use the singular "texture" method, and instead always use a version of the plural "textures":

textures: {
  all: {base: "path to texture*"}
},

Texturing Other Block Faces

When assigning textures "all" will give every side the same texture, but we can easily customize each side, especially if we want to use some block behaviors like "Pillar" or "HorizontalOrientable":

textures: {
  up: { base: "path to top texture" },
  down: { base: "path to bottom texture" },
  south: { base: "path to back texture" },
  north: { base: "path to front texture" },
  west: { base: "path to left texture" },
  east: { base: "path to right texture" },
},

Keep in mind that if you're using the "Pillar" or "HorizontalOrientable" behaviors you'll need directional variants for each (such as updown, northsouth, eastwest etc.) and you'll likely have to organize it using the ByType functionality. A great example of this is the log (Pillar) and altar (HorizontalOrientable) JSONS.

Texturing an Entity

Basic Entity Texture

All entities utilize a shape, but generally they are applied using a single entity map texture, which is essentially a texture file with each cube side mapped onto it. Doing this manually would be incredibly tedious, and is best done with the Vintage Story Model Builder found here.

Once you have your properly mapped out texture you can assign it to your entity:

texture: { base: "path to texture map" }

Alternative Entity Textures

after defining the first texture, you can also add alternatives to the same entity. Lets look at the Wolf for an example:


texture: { base: "entity/wolf/wolf1", alternates: [ { base: "entity/wolf/wolf2" }, { base: "entity/wolf/wolf2" }, {...} ] }

Each successive alternative should be numbered (starting with 1).

 

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 Pack Temático
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