Skip to content

Mutable Materials - #992

Merged
bjornbytes merged 8 commits into
devfrom
mutable-materials
Aug 29, 2026
Merged

bjornbytes merged 8 commits into
devfrom
mutable-materials

Conversation

@bjornbytes

@bjornbytes bjornbytes commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Adds the following:

  • Add getters and setters to Material, so properties can be changed after they're created:
    • Material:get/setColor
    • Material:get/setGlow
    • Material:get/setQuad
    • Material:get/setMetalness
    • Material:get/setRoughness
    • Material:get/setClearcoat
    • Material:get/setClearcoatRoughness
    • Material:get/setOcclusionStrength
    • Material:get/setNormalScale
    • Material:get/setAlphaCutoff
    • Material:is/setDoubleSided
    • Material:get/setTexture
    • (Note that Material can still only have 1 value for each property, so you can't do a draw with the material, change something, do a second draw, and expect the draws to use different values. Both draws will use the final value, whatever it was at submit time).
  • Add doubleSided material property.
    • Double sided materials will always be drawn with culling disabled.
    • So you can keep culling enabled but draw a few double-sided objects like trees/leaves.
    • It gets imported from glTF models.
  • Add Model:setMaterial to replace the material in one of the Model's material slots.
    • Note that you can set materials to nil, and they'll use whatever is set with Pass:setMaterial.
    • newModel(..., { materials = false }) now sets all of the material slots to nil instead of removing material slots completely (shouldn't really have any behavior change, just a cleaner design).
    • Note that you can't add/remove/reassign material slots.
  • lovr.graphics.newMaterial can take a Texture or an Image to use for the color texture.

@bjornbytes bjornbytes linked an issue Jul 31, 2026 that may be closed by this pull request
@bjornbytes
bjornbytes force-pushed the mutable-materials branch 5 times, most recently from 478f72e to 792bc87 Compare August 16, 2026 00:52
@bjornbytes
bjornbytes merged commit e09f29f into dev Aug 29, 2026
14 checks passed
@bjornbytes
bjornbytes deleted the mutable-materials branch August 29, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mutable Materials

1 participant