Skip to content

Per quad material properties #1796

@leMaik

Description

@leMaik

Materials in Chunky are weird:

  • Blocks are materials, which is mostly only useful for customizing them (players think in blocks, not block surfaces)
  • Some blocks (eg. lava cauldron and open eyeblossom require hard-coded material changes)
  • The current and previous materials are stored in the ray and equal the block by default

With the open eyeblossom, Minecraft itself introduced per quad material properties (only the emissive quads emit light). We should update Chunky to allow that, too. For PBR, we need per quad specular/normal/emittance maps anyways).

Proposed solution:

  • Remove the "block = material" assumption and don't let every block implement Material (the block doesn't decide the material that one gets when intersecting it, that's the block model's job)
  • Most blocks only need a single material, though, so add some Material registry that can provide a Material for a block (and, at a later point, some combination of block properties, see Add a way to change material properties for different blockstates #1145), which the block model may or may not use (depending on the model, eg. lava cauldron might use the lava material instead).
  • For quad model blocks, add a method that returns all materials (one for each quad, similar for how textures work)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions