#“Understanding Texture Manipulation - Blocks”

1 messages · Page 1 of 1 (latest)

modest shale
#

Did you know that a single block with a single bone can have hundreds of textures assigned to it? Did you know that you can assign vanilla textures like obsidian to one part of your block and redstone_block to the other parts? Pretty sweet right!?
For this tutorial, it is recommended that you have a basic understanding of permutations as well as an understanding of blockbench.

“Properties Make A Difference”

           “luna:specific_bone1”: [0,1,2,3]
           }
       }```
Let’s suppose that you have a specific bone that you would like to have a texture that is different from the rest of the model. Different textures are assigned and called based on the property conditions that you assign them. For the purpose of this tutorial we are wanting to give our specific bone four different textures. They will each show up based on whether the block property luna:specific_bone1 is == 0,1,2, or 3.
*Please note that there is a limit to 10 unique properties and a total 30 values across every property. A single Property may only have 16 values.
 If you wanted to assign multiple bones unique textures, then you would add additional properties like luna:specific_bone1 and luna:specific_bone2.

“Material Instances And Blockbench”

 So how does Minecraft recognize the way in which a specific bone is to be textured? It has to do with the “material_instances” component.
*Please note that you must use minecraft:unit_cube if you are manipulating a basic block with no special bones.
 In terms of code you must always use a “*” element or a mix up of “up”, “down”, “side”, “north”, etc. Otherwise a content log error will occur. Here is an example:
#
                “*”: {
                    “texture”: “obsidian”,
                    “render_method”: “opaque”,
                    “face_dimming”: true
                },
                “specific_bone1”: {
                    “texture”: “redstone_block”,
                    “render_method”: “opaque”,
                    “face_dimming”: true
                }
            }```


  In this case “*” represents the model as a whole. Every bone not specified here will be it’s default custom texture or in this case “obsidian”. So how do we get the “specific_bone1"? Here are two ways. The first involves using Blockbench, the second is by manipulating your block’s geometry file.  In Blockbench, put all of your bones/cubes under folders. After that name your folder something recognizable like “specfic_bone1”. Do you see where we are going here? Next you want to right click or on mobile ( hold down on a specific bone/cube ). You should see an option to edit material instances like this:
#

If you click on edit material instances you will be greeted by this image. For the sake of our tutorial we will name each ‘face’ “specific_bone_1”. In this way, the texture that we assign to “specifc_bone_1” will cover the whole part. These names are what we are referencing in our material instances. The second method involves editing your geometry.

                    “name”: “specific_bone1”,
                    “parent”: “my_model_name”,
                    “pivot”: [0, 0, 0],
                    “cubes”: [
                        {
                            “origin”: [0, 0, -8],
                            “size”: [8, 1, 8],
                            “uv”: {
                                “north”: {“uv”: [0, 0], “uv_size”: [8, 1], “material_instance”: “specific_bone1”},
                                “east”: {“uv”: [0, 0], “uv_size”: [8, 1], “material_instance”: “specific_bone1”},
                                “south”: {“uv”: [0, 0], “uv_size”: [8, 1], “material_instance”: “specific_bone1”},
                                “west”: {“uv”: [0, 0], “uv_size”: [8, 1], “material_instance”: “specific_bone1”},
                                “up”: {“uv”: [8, 8], “uv_size”: [-16, -16], “material_instance”: “specific_bone1”},
                                “down”: {“uv”: [8, 8], “uv_size”: [-16, -16], “material_instance”: “specific_bone1”}
                            }
                        }
                    ]
                }```
Notice that we add material_instance in each direction or face.
#

“Putting It All Together With Permutations”

Phew… With that out of the way let’s head back to our code. Permutations are kind of like the lifeblood of creativity here. How you decide to set block properties will be up to you. You could use any triggering component like minecraft:on_interact, Minecraft:on_step_on, etc. The choice is yours of course! How the events and properties are triggered and set is a topic for another tutorial as well. For the sake of this tutorial we will look at what the Permutations look like when a specific property is set. All permutations have a condition dependent on a specific block property or more being active at the same time. You will need to set a specific material instances under a specific condition like this.

            {
                “condition”: “q.block_property(‘luna:specific_bone1’) == 0”,
                “components”: {
                “minecraft:material_instances”: {
                “*”: {
                    “texture”: “obsidian”,
                    “render_method”: “opaque”
                },
                “specific_bone1”: {
                    “texture”: “redstone_block”,
                    “render_method”: “opaque”
                        }
                    }
                }
            }
        ]```
*Please note that you must always include at least "*" or the other directions here in combination with your bone name.
#

“Concluding Thoughts And A Challenge”

That is pretty much all there is too it on a basic level! From here you would add the other 3 permutation conditions and components changing the texture to something different. The possibilities are almost endless here. You can set textures for multiple bones, can cycle through them, or even make them disappear and reappear with different textures using part visibility. This is just the launching point. Here is the challenge for you: Create a block that uses 3 or more bones. Using a combination of properties, can you get each one to change independently of each other perhaps by using an interaction? Here is a link to my tile system that demonstrates the concept. If you have a suggestion for a tutorial feel free to post that or any questions that you may have. Happy Coding ☺️

#

Please note that my asterisk seemed to disappear, especially when showing the code of material instances. It might like like this * or "*" for whatever reason 😅 If it looks like a wierd symbol this is what it is supposed to be

fathom beacon
#

Ohh wow

fallen geyser
#

respect for yr work

modest shale
#

Thank you both ❤️😁 very much!

restive light
#

Thanks for posting this tutorial, I had explained it to someone who had a question about it a few days ago, but your post is much more complete and easier to understand

modest shale
raw warren
modest shale
#

Or what were you missing?

raw warren
raw warren
modest shale
#

Ah gotcha, that makes sense ☺️ So glad you got it figured out

raw warren
#

before

{
                "condition": "(1.0)",
                "components": {
                    "minecraft:material_instances": {
                        "*": {
                            "texture": "rustic.cherry.sofa",
                            "render_method": "alpha_test",
                            "ambient_occlusion": false
                        }
                    }
                }
            },
            {
                "condition": "q.block_property('furnideco:color') == 0",
                "components": {
                    "minecraft:material_instances": {
                        "cushion": {
                            "texture": "rustic.sofa.color_0",
                            "render_method": "alpha_test",
                            "ambient_occlusion": false
                        }
                    }
                }
            },

After

            {
                "condition": "q.block_property('furnideco:color') == 0",
                "components": {
                    "minecraft:material_instances": {
    "*": {
                            "texture": "rustic.cherry.sofa",
                            "render_method": "alpha_test",
                            "ambient_occlusion": false
                        },
                        "cushion": {
                            "texture": "rustic.sofa.color_0",
                            "render_method": "alpha_test",
                            "ambient_occlusion": false
                        }
                    }
                }
            },
modest shale
#

Ah yep that will do it

raw warren
#

Yes, now it's working, thanks again