-
Notifications
You must be signed in to change notification settings - Fork 7
Reference: JMX Specification
NOTE: You should already be familiar with the un-modded Minecraft JSON model format before trying to create JMX model files. You can find more information on the Gamepedia Minecraft Wiki.
The jmx root-level tag defines textures and materials that should be used when JMX is loaded. It will not be used if a frex tag is present and a FREX renderer (i.e. Canvas) is active.
"jmx": {
"textures": { },
"materials": { }
}The frex root-level tag defines textures and materials that should be used when a FREX renderer (i.e. Canvas) is active. When present and active, it overrides the jmx tag.
A frex block allows models to use different textures and material properties when shaders are available. Such models should still define a still-enhanced-but-without-shaders appearance in the jmx block to be used when shaders aren't available.
This "override" behavior only applies within the same JSON file. Texture and material names within the frex block can reference texture and material names provided via imx blocks in other JSON model files (or even vanilla models for texture names.)
"frex": {
"textures": { },
"materials": { }
}Textures are included in the jmx or frex elements via the textures tag. Usage of this tag is identical to textures for vanilla model JSON files. However, the textures are only available and applied only when JMX is loaded.
If jmx and frex elements are both present, only one of them will be loaded. If a FREX-compliant renderer is active, the frex textures will be used. Otherwise the textures in the jmx element will apply.
Note that a vanilla textures element at the root level is not overriden by the jmx and frex blocks. This avoids compatibility problems with parent/child vanilla models that may still depend on the vanilla textures. For this reason, texture reference names within a block (names that are meant to be used with a # prefix) should be different from their vanilla counterparts.
Materials operate much like textures, but instead define a RenderMaterial to be associated with one or more faces.
Like textures, a materials element can occur inside both the jmx and frex elements. When a FREX renderer is active, the materials in the frex element will be used instead of the materials inside the jmx element.
A material value can be defined three ways:
As with textures, materials can reference materials to be defined in a child model, using the # prefix.
"materials": {
"jmx_mat_down": "#jmx_mat_all",
"jmx_mat_up": "#jmx_mat_all",
"jmx_mat_north": "#jmx_mat_all",
"jmx_mat_east": "#jmx_mat_all",
"jmx_mat_south": "#jmx_mat_all",
"jmx_mat_west": "#jmx_mat_all"
}Material attributes can be directly specified within a sub-element. The name of the sub-element will be used to resolve symbolic material names.
"materials": {
"jmx_mat_all": {
"layer0": "cutout_mipped",
"layer1": "cutout_mipped",
"emissive1": true,
"ambient_occlusion1": false,
"diffuse1": false
}
}The material attributes that can be specified are listed below. The -N suffix must be 0 or 1 and indicates which sprite layer is affected. If an attribute is omitted, the default value will be used.
| Attribute Name | Default Value | Description |
|---|---|---|
layerN |
solid |
Render layer for this sprite. See Choosing the Right Layer(s) for more info. |
emissiveN |
false | When true, sprite texture and color will be rendered at full brightness. |
ambient_occlusionN |
determined by model | When true, sprite color will be modified for ambient occlusion shading. |
diffuseN |
determined by shade attribute |
When true, sprite color will be modified for diffuse shading. |
colorIndexN |
true | When true, sprite color will be affected by the quad's color index. (If the color index is some value other than -1.) |
colorN |
true | Values other than 0xFFFFFFFF modify the sprite color. The effect is in addition to any tinting done via quad color index. Colors must be in ARGB order and can be signed integers or hex values that begin with 0x. |
depth |
2 if any other attribute references the second layer. 1 otherwise. | Only necessary when a double-layer material is needed but no attributes for the second layer are present. A value of 1 is ignored if any other attribute references the second layer. |
preset |
(none) | See the following section on "Named Materials." |
Technical Note: In the Fabric Renderer API
coloris not an attribute of a render material but is instead part of the quad itself. JMX represents colors as part of a material so that colors can be included in material inheritance.
"materials": {
"jmx_mat_all": { "preset": "jmx:redstone" }
}
}The preset tag causes JMX to look for a named render material that is pre-registered by the active Renderer or by another mod.
If a named material is found, it will override all other material settings except color.
Presets are useful for shader-based materials in the Canvas Render. FREX provides a material loader that can create named, custom shader materials without Java code. For more information, see: How To: Create Named Shader Materials with JSON Files
TO BE CONTINUED...