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
I recently developed a library that add frustum culling to InstancedMesh and now I would like to implement culling and sorting on InstancedMesh on the main repository.
My implementation removes InstanceMatrix, InstanceColor, then adds InstanceIndex, textureMatrices, textureColors.
The work is very similar to that done for the BatchedMesh.
Before I open the PR, I would like to ask one thing:
before each render, I update the index array of the instances that are to be drawn, but this cannot be done in onBeforeRender because the attributes are sent to the gpu before this is called. How could this be solved?
Currently to get the example to work I had to manually call the update function in the animate cycle.
Solution
Can we send the instanceIndex attribute to gpu before rendering if perObjectFrustumCulling is true?
Alternatives
The user can manually call myInstancedMesh.update();.
Additional context
No response
The text was updated successfully, but these errors were encountered:
I'm not sure I vote for this change. BatchedMesh is already a complex component I would prefer to keep InstancedMesh more straightforward so it is easier to maintain.
With #28462, BatchedMesh will support instanced rendering so if you want to cull and sort instances I suggest you use this component.
Description
Hello :)
I recently developed a library that add frustum culling to
InstancedMesh
and now I would like to implement culling and sorting onInstancedMesh
on the main repository.My implementation removes
InstanceMatrix
,InstanceColor
, then addsInstanceIndex
,textureMatrices
,textureColors
.The work is very similar to that done for the
BatchedMesh
.Here's the code: dev...agargaro:three.js:dev
Example (culling + sorting): https://agargaro.github.io/three.js/examples/webgl_instancing_performance.html
Before I open the PR, I would like to ask one thing:
before each render, I update the index array of the instances that are to be drawn, but this cannot be done in
onBeforeRender
because the attributes are sent to the gpu before this is called. How could this be solved?Currently to get the example to work I had to manually call the update function in the animate cycle.
Solution
Can we send the
instanceIndex
attribute to gpu before rendering ifperObjectFrustumCulling
is true?Alternatives
The user can manually call
myInstancedMesh.update();
.Additional context
No response
The text was updated successfully, but these errors were encountered: