-
Notifications
You must be signed in to change notification settings - Fork 7
How To: Choosing the Right Layer(s)
Normally, the texture blending mode (solid, cutout, cutout-mipped or translucent) is determined for the entire model by the type of block. JMX, thanks to the Fabric Rendering API, allows every quad to be assigned a different "layer" that overrides the block-level mode.
Developer Notes: In the Fabric view of the Minecraft source code, what JMX calls "layer" is known as
BlockRenderLayer. In the Rendering API it is set viaMaterialFinder.blendMode().
Minecraft offers four layers to choose from, described in the table below.
| Layer | Alpha Channel Effect | Use For |
|---|---|---|
solid |
Ignored | Faces that are fully opaque, with no holes or translucency. |
cutout |
Sprite pixels with alpha < 0.5 are not rendered. ("cut out") | Faces with visible holes. The visible and clear areas should ideally be at least 2 pixels wide and have clean lines. |
cutout_mipped |
Sprite pixels with alpha < 0.5 are not rendered. ("cut out") | Faces with visible holes. Use when the visible or clear areas are small (1 pixel) and/or irregular. This will prevent "moire" effects. |
translucent |
Sprite pixels are blended with background to appear translucent. Alpha = 0 is invisible, and alpha = 1 appears fully opaque solid, with values in between appearing more or less opaque. | Stained or cloudy glass, faces that look like fluids, ice, etc. Has a minor performance penalty - avoid on terrain and primary building blocks. |
-
Alpha What?: For a brief explanation of alpha channel, consult this article. (quora.com)
-
Moire? Mipmap?: Wikipedia has the answers.
-
Cutout or translucent sprites look bad?. Maybe this will help. (adriancourreges.com)
JMX also enables faces with two sprites and each sprite can have a different layer. This is often useful for overlay and partial emissive effects. More information on this feature is available here.
The table below shows which layer combinations work and what they are useful for.