Skip to content

Bundle multimaterial not updated correctly #30701

@Makio64

Description

@Makio64

Description

Not sure its a bug or if it's limited by the api but in a bundle static if i update materials of the meshs inside only the first material is updated.

it does work if i call bundle.needsUpdate or if bundle.static = false

Reproduction steps

  1. create a bundle and add multiple mesh with differents material
  2. update opacity / color of the materials
  3. only first one is updated

Code

    let group = new THREE.BundleGroup()
    // mesh
    for(let i=0; i<10; i++){
      
      // material
      const material = new THREE.MeshBasicMaterial( {
        color: new THREE.Color(THREE.MathUtils.randInt(0,0xffffff)), 
        transparent: true,
        opacity:Math.random(),
        depthWrite:false
      } );
      
      
      const mesh = new THREE.Mesh( geometry, material );
      
      mesh.position.set(
        -5 + i,
        0,
        0
      )
      group.add( mesh )
      setInterval(()=>{
        material.opacity = Math.random()
      	//group.needsUpdate = true
      }, 100 + Math.random()*500)
    }
    //group.needsUpdate = true
    group.static = true
    scene.add( group );

Live example

https://jsfiddle.net/8z5qb9xs/15/

Screenshots

No response

Version

r174 dev

Device

No response

Browser

No response

OS

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions