You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add an Instance after the BatchedMesh creation + perObjectFrustumCulled = false, result in BatchedMesh not showing at all.
Expected result : the new added instance show up in both case perObjectFrustumCulled = false or perObjectFrustumCulled = true
Reproduction steps
Create a BatchedMesh, set perObjectFrustumCulled = false
addInstance after some time
Nothing show up
Code
import*asTHREEfrom'three'import{OrbitControls}from'three/addons/controls/OrbitControls.js'letmesh,renderer,scene,camera,controlsinit()functioninit(){// rendererrenderer=newTHREE.WebGPURenderer({alpha: false})renderer.setSize(window.innerWidth,window.innerHeight)renderer.setPixelRatio(window.devicePixelRatio)renderer.setAnimationLoop(animate)document.body.appendChild(renderer.domElement)// scenescene=newTHREE.Scene()// cameracamera=newTHREE.PerspectiveCamera(40,window.innerWidth/window.innerHeight,1,100)camera.position.set(15,0,0)// controlscontrols=newOrbitControls(camera,renderer.domElement)constbox=newTHREE.BoxGeometry(1,1,1)constsphere=newTHREE.SphereGeometry(1)constmaterial=newTHREE.MeshStandardNodeMaterial()constbatchedMesh=newTHREE.BatchedMesh(10,5000,10000,material)batchedMesh.perObjectFrustumCulled=false// WORK IF TRUEbatchedMesh.sortObjects=falseconstboxGeometryId=batchedMesh.addGeometry(box)constsphereGeometryId=batchedMesh.addGeometry(sphere)scene.add(batchedMesh)scene.add(newTHREE.DirectionalLight(0xDDDDDff,2))animate()setTimeout(()=>{constdummy=newTHREE.Object3D()letrand=()=>THREE.MathUtils.randFloat(-5,5)for(leti=0;i<5;i++){letinstance=batchedMesh.addInstance(Math.random()>.5?boxGeometryId:sphereGeometryId)dummy.position.set(rand(),rand(),rand())dummy.rotation.set(rand(),rand(),rand())dummy.updateMatrix()batchedMesh.setMatrixAt(instance,dummy.matrix)}},1000)}functionanimate(now=0){renderer.renderAsync(scene,camera)}
This is likely because the _visibilityChanged isn't set to true in the addInstance function, which tells the class that the render ranges need to be updated even if the the sort and frustum flags are disabled.
It should probably be set in the "optimize" function, as well.
Description
Add an Instance after the BatchedMesh creation + perObjectFrustumCulled = false, result in BatchedMesh not showing at all.
Expected result : the new added instance show up in both case
perObjectFrustumCulled = false
orperObjectFrustumCulled = true
Reproduction steps
Code
Live example
https://jsfiddle.net/Makio64/8ewqcsf1/10/
Screenshots
No response
Version
r169 dev
Device
Desktop, Mobile
Browser
Chrome
OS
MacOS
The text was updated successfully, but these errors were encountered: