Render Layers - souppCodez/Palladium-Wiki-Enhancements GitHub Wiki
Before you start, you need to know how model layers and model types work.
The "model type" defines what bones the model has. By default, a render layer will use the basic minecraft:humanoid
type. This one requires all the bones a basic player (or any humanoid creature) has: head
, hat
, body
, right_arm
, left_arm
, right_leg
, left_leg
.
This is very important when creating your own model layer! Model layers define the properties of each bone, like the cubes
inside them, rotation, texture UV, etc.
Inside BlockBench you need to make sure that ALL of those bones exist as folders, even if you plan to keep them empty!
Model layer files are generally located as <Name of the layer>/<entity type>.json
, so when you are done modelling save
your model layer file inside your pack in a path similar to this:
assets/namespace/palladium/model_layers/layer_name/humanoid.json
This will make your model layer available as namespace:humanoid#layer_name
.
If you want to make model layers for other types of minecraft entities, you can simply import their model layer jsons
inside BlockBench and check their bones/modify it directly. All models used in the game are exported
to mods/documentation/palladium/models
.
You can also use this system to override the model layers of entities and change their appearance with resource packs!
After all that, you can finally create a proper render layer, a basic setup can look like this:
{
"model_type": "minecraft:humanoid",
"model_layer": "namespace:humanoid#layer_name",
"texture": "namespace:textures/models/example_texture.png"
}
If you want to make your layer glow, you can also change the render type:
{
"model_type": "minecraft:humanoid",
"model_layer": "namespace:humanoid#layer_name",
"texture": "namespace:textures/models/example_texture.png",
"render_type": "glow"
}
Easy as that! Your render layer files goes into assets/<namespace>/palladium/render_layers/<your render layer>.json
If you want to define multiple render layers in one file, you can use the compound render layer type like this:
{
"type": "palladium:compound",
"layers": [
{
"model_type": "minecraft:humanoid",
"model_layer": "namespace:humanoid#layer_1_name",
"texture": "namespace:textures/models/example_texture_1.png"
},
{
"model_type": "minecraft:humanoid",
"model_layer": "namespace:humanoid#layer_2_name",
"texture": "namespace:textures/models/example_texture_2.png",
"render_type": "glow"
}
]
}
If you have made models for the player before, you might have noticed that one model or texture might not always fit both skin types. For that you can make models and texture depend on the skin type like this:
{
"model_type": {
"normal": "minecraft:humanoid",
"slim": "minecraft:player"
},
"model_layer": {
"normal": "namespace:humanoid#layer_name",
"slim": "namespace:humanoid#layer_name_slim"
},
"texture": {
"normal": "namespace:textures/models/example_texture.png",
"slim": "namespace:textures/models/example_texture_slim.png"
}
}
Of course you don't need to use that all the 3 settings if you just have the texture dependent on the skin type.
Textures can be heavily modified and become animated using this system.
So let's cover texture transformers and texture variables. The texture
field you have seen earlier here, is a primitive json element. It's just that one path. So let's turn it into a json object! I will leave out the other settings shown in the previous example.
"texture": {
"base": "namespace:textures/models/example_texture.png"
}
This would basically result in the same texture as before. The base
setting is the texture we'll always start with when the game starts to produce this texture. There are those things called "texture variables". They allow you to get input from the entity and use it in your texture path. Let's use Palladium's variable for crouching:
"texture": {
"base": "namespace:textures/models/example_texture_#CROUCHING.png",
"variables": {
"CROUCHING": {
"type": "palladium:crouching"
}
}
}
Now we get the data from the entity (which has this layer rendered on it) whether it's crouching or not. The CROUCHING
key I used there is the one you can use in the texture path starting with a #
. Depending on the entity, the game will now look for namespace:textures/models/example_texture_true.png
or namespace:textures/models/example_texture_false.png
. If you don't want to add that true/false-suffix, the palladium:crouching
variable has extra settings which allow you to specify what the suffixes both cases would be. So this:
"texture": {
"base": "namespace:textures/models/example_texture#CROUCHING.png",
"variables": {
"CROUCHING": {
"type": "palladium:crouching",
"true_value": "_crouching",
"false_value": ""
}
}
}
...will look for namespace:textures/models/example_texture.png
(since I gave false_value
an empty string) and namespace:textures/models/example_texture_crouching.png
.
All texture variables can be found here: coming soon
There are also ways to let the game modify your texture. Those are called "texture transformers". So let's add an overlay on top of our current texture:
"texture": {
"base": "namespace:textures/models/example_texture#CROUCHING.png",
"variables": {
"CROUCHING": {
"type": "palladium:crouching",
"true_value": "_crouching",
"false_value": ""
}
},
"transformers": [
{
"type": "palladium:overlay",
"overlay": "namespace:textures/models/example_overlay.png"
}
],
"output": "namespace:textures/models/example_texture#CROUCHING_overlayed.png"
}
Now this will put the texture specified in overlay
on top of our base
texture. BUT once you apply transformers to your texture, you will need to add a output
path. This will be the path the game will save the modified texture under. You actually won't find any modified texture file anywhere, this will just be the key it will be saved under in the memory while the game is active. You can see how I used the texture variable #CROUCHING
in there. This is necessary, otherwise it will save all modified textures under the same key, which basically means that there will only be one texture in the end. And just as you can use texture variables in output
, you can also use them in the transformers:
"texture": {
"base": "namespace:textures/models/example_texture#CROUCHING.png",
"variables": {
"CROUCHING": {
"type": "palladium:crouching",
"true_value": "_crouching",
"false_value": ""
}
},
"transformers": [
{
"type": "palladium:overlay",
"overlay": "namespace:textures/models/example_overlay#CROUCHING.png"
}
],
"output": "namespace:textures/models/example_texture#CROUCHING_overlayed.png"
}
This change would make the game look for different overlays to put on your base texture, depending on if your entity is crouching or not.
All texture transformers can be found here: coming soon
You can add as many variables and transformers as you want. In the case of transformers, the order is important for the result. It will go through each from the start to the end and modify the texture in that order.
All that might seem complicated at first, but once you understand how it works you should be able to get pretty complex with this. Feel free to suggest any texture transformers and texture variables on issue tracker here if you need any for your dynamic render layer texture.