Monday, 13 April 2020

Baking models [1.14.4+]

The conversion from block model json files into BakedModels occurs in several steps.

The two major stages are:

  • UnbakedModels are created from the model files, storing information about the shapes in the model.  The vanilla examples of interest are: BlockModel (simple), VariantList (model chosen by blockstate), Multipart (model chosen by selectors)
  • BakedModels are created from the Unbaked models, converting the shape information into a collection of Quads to be rendered.  For block and item models, the individual texture files in the UnbakedModels are also stitched together into a single texture sheet, and the appropriate texture coordinates for each quad are automatically updated to match.


Example of stitched texture sheet appearance

Vanilla classes of interest

ModelManager
ModelBakery
IUnbakedModel (BlockModel, Multipart, VariantList)
IBakedModel (BakedModel, SimpleBakedModel, WeightedBakedModel, BakedItemModel)

BlockModelShapes
BlockModel

TextureAtlasSprite
ItemModelGenerator
AtlasTexture
Stitcher

Forge extensions of interest

ModelLoaderRegistry
OBJModel
OBJLoader


Further information

Blockstates and BlockModels


No comments:

Post a comment