Tresjs / tres

Declarative ThreeJS using Vue Components
https://tresjs.org
MIT License
2.27k stars 107 forks source link

The @pointer-move function experiences noticeable lag #436

Closed hawk86104 closed 6 months ago

hawk86104 commented 1 year ago

Describe the bug

The @pointer-move function experiences noticeable lag when the [widthSegments | heightSegments] of PlaneGeometry exceeds 100.

Reproduction

https://stackblitz.com/edit/tresjs-basic-bxhf8j?file=src%2Fcomponents%2FTheExperience.vue

Steps to reproduce

<TresMesh @pointer-move="onPointerMove">
  <TresPlaneGeometry :args="[50, 50, 200, 200]" />
  <MeshBasicMaterial />
</TresMesh>

System Info

No response

Used Package Manager

yarn

Code of Conduct

CptJJ commented 12 months ago

@alvarosabu this is probably related to what I was talking about on discord, i only see the lag come up when i bind any of the events (even onClick) to a mesh that has several hundred triangles:

image
alvarosabu commented 11 months ago

Thnx both for raising this @hawk86104 @CptJJ

Sea-DH1 commented 11 months ago

I have encountered this problem before. I checked the code and finally found that if three-mesh-bvh is used, this problem no longer exists.

alvarosabu commented 11 months ago

@Tinoooo @garrlker maybe this would be fixed by the changes you guys are doing on events?

hawk86104 commented 11 months ago

Thank you, it has indeed solved the problem

hawk

@.*** |

---- Replied Message ---- | From | Alvaro @.> | | Date | 12/13/2023 16:53 | | To | @.> | | Cc | @.> , @.> | | Subject | Re: [Tresjs/tres] The @pointer-move function experiences noticeable lag (Issue #436) |

@@.*** maybe this would be fixed by the changes you guys are doing on events?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

CptJJ commented 11 months ago

Amazing Fixed It!

Is there a downside to making this the default when rendering meshes in tres?

alvarosabu commented 11 months ago

Glad to hear it has been solved, @CptJJ what do you mean on making it default?

garrlker commented 6 months ago

@alvarosabu @hawk86104

It looks like the Tres V4 RC fixes the issues in the original stackblitz

Here's a fork that updates to the V4 RC and does not show the same performance issues

If you don't mind @hawk86104, could you temporarily disable the three-mesh-bvh code and try out the V4 RC in your project and let us know if the issue is fixed?

yarn i @tresjs/core@4.0.0-rc.0

hawk86104 commented 6 months ago

@alvarosabu @hawk86104

It looks like the Tres V4 RC fixes the issues in the original stackblitz

Here's a fork that updates to the V4 RC and does not show the same performance issues

If you don't mind @hawk86104, could you temporarily disable the three-mesh-bvh code and try out the V4 RC in your project and let us know if the issue is fixed?

yarn i @tresjs/core@4.0.0-rc.0

@garrlker You're very welcome! That's great to hear. I'm not sure when it will be merged into the main branch.

Rain20199 commented 6 months ago

@tresjs/core@4.0.0-rc.0 pointer events trigger multiple times

garrlker commented 6 months ago

@Rain20199 They do?

That's strange, we do check for duplicate events and ignore a handler if we've already called it

Any chance you could make a reproduction so I can look into it?

alvarosabu commented 6 months ago

@Rain20199 since it is a different issue can you open a new ticket with a minimal reproduction? Thanks