Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

please explain this use of addElement

model:addElement
        {
            lower = vec3(0,0,190),
            upper = vec3(255,255,255), 
            textures = "Blocks:Wood",           
            ao = false
        }

found in block library.
i've fiddled with the vectors but haven't been able to figure out what's going on.
the values look like colors sometimes, or transparency ... or angles?

might be nice if this were in the Craft doc, too.

thanks!

Comments

  • JohnJohn Admin Mod
    Posts: 603

    @RonJeffries true, this is an oversight.

    That code is adding an element to a block model. In craft each voxel can have a type and each type can use a model.
    Models are made up of elements, each element is a box mesh. lower and upper represent the coordinates of the bounding box of an element. These vectors contain integer values ranging from 0 to 255 in the x, y and z axes. Changing these will allow you to make various shapes. This is how you get stuff like fences, signs, pressure plates, half-height bricks, etc.
    You can also have multiple elements in a single model. You can also have a tint colour, textures and ambient occlusion. AO doesn't really work properly for anything other than full and empty blocks.
    Textures generally need to be square and all the same size to work properly since Craft's voxel system uses atlases internally for rendering.

  • SimeonSimeon Admin Mod
    edited February 18 Posts: 5,202

    Sorry about the missing docs here, looks like that's a BlockModel and relates to the voxel functionality.

    I can tell you is that ao is for "ambient occlusion" which is contact shadow effect applied to the crevices of 3D models to make them look more realistic.

    Looks like lower and upper are related to the positioning of the block or its vertices, I'll need @John to explain this in detail.

    Edit: looks like John was quicker

  • thanks! doubtless this is all packing down to bytes in the near flyweight thing that's a voxel, i suppose. i just couldn't quite leap to 255 = 100%.

    thanks again!

Sign In or Register to comment.