From the linked pages below, I've been able to change the color to a solid green. However, I just want to darken the existing material of multiple 3d models each of which have different color schemes.
Their color schemes are based off of a png I've given each model as a physically based material, not sure if this really affects anything big picture. I really do not want have to go into reality composer and make a custom darker color palette for every model...
I would also like the material change respond to input data, not a hard-coded change. I've made a model entity and have been able to change the color manually.
content.add(michelleSceneEntity)
guard let michelleJumpModel = michelleSceneEntity.findEntity(named: "michelle_jump") else { return }
let modelEntity = michelleJumpModel.children[0].children[0] as! ModelEntity
print(modelEntity)
guard let michelleJumpAnimationResource = michelleJumpModel.availableAnimations.first else { return }
let michelleJumpAnimation = try AnimationResource.sequence(with: [michelleJumpAnimationResource.repeat()])
let material = SimpleMaterial(color: .green, isMetallic: false)
modelEntity.model?.materials = [material]
// michelleSceneEntity.model?.materials = [material]
michelleJumpModel.playAnimation(michelleJumpAnimation.repeat())
Yes, you definitely can programmatically tint a material in RealityKit visionOS app. For that you need a texture file (if you have a USDA file it's not a problem I suppose, however, if you have a USDZ file, read this post to find out how to extract textures from a zero archive).
Here's the code: