Hello people,
still porting the globe to r3f but I am experience some issues.
You can find the repo here GitHub - lezan/next-globe, I extract a minimum reproduction repo with only nextjs 14 and r3f latest version.
If you run it and navigate from the home page to contact and then move back to home, you will see triangles and shaders increase as showed by r3f-perf.
The initial scene have 22178 triangles and 4 shaders (not sure where the 4th shader come from). Upon navigation we achieve 29656 and 10 shaders.
I tried to render each component (sphere.tsx, points.tsx and glow.tsx) by one one to see what is going on:
- with sphere.tsx only, I have 9800 triangles and 2 shaders, then 9800 triangles and 4 shaders.
- with glow.tsx only, I have 4900 triangles and 1 shaders, then 4900 triangles and 2 shaders
- with points.tsx only, I have 7468 triangles and 1 shaders, then 14956 triangles and 4 shaders.
So the difference between 29k and 22k come from points.tsx. Shaders difference come from all components and they are always doubled.
If you see in globe.tsx I am using <Preload all />
component from drei. If I remove it things change a bit:
- with sphere.tsx only, I have 9800 triangles and 2 shaders, then 9800 triangles and 2 shaders.
- with glow.tsx only, I have 4900 triangles and 1 shaders, then 4900 triangles and 1 shaders
- with points.tsx only, I have 7468 triangles and 1 shaders, then 14956 triangles and 2 shaders.
So in this case increase come only from points.tsx, both shaders and triangled doubled.
If I switch from <Link>
component to <a>
I do not see issues because of canvas unmounting (right?).
I am doing something wrong (missing disposal?), but I do not know what and how I can fix it. I also asked about it in discord (r3f one) and someone reply to me with stable reference to uniforms
, creates a new object every render, but I tried to follow example and it appear good to me.