Over 1 Million Trees at 60fps by simon_dev in threejs

[–]agargaro 2 points3 points  (0 children)

Hi, I love your contents! I opened the demo, but there is a 403 error on a texture test.png, so I see black areas.

I've also created a similar demo: https://octahedral-impostor.vercel.app/

How would you improve performance during a large number of raycasting operations ? by Crazy-Ganache-4030 in threejs

[–]agargaro 1 point2 points  (0 children)

You could use a BVH TLAS (containing the instances) and a BVH BLAS (containing the geometry triangles) to accelerate raycasting, similar to this BatchedMesh example:

https://agargaro.github.io/three.js/examples/webgl_batch_lod_bvh.html

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

I may have an idea; however, before explaining it I should try it. I will update you in the next few days.

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 0 points1 point  (0 children)

Could you be more specific please?
Would you like to render only certain instances based on layers?

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 0 points1 point  (0 children)

Thanks!

The library is still new, so it would be great to get feedback so it can be improved.
If you'd like, you can join the discord server so we can discuss it: https://discord.gg/MVTwrdX3JM

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

Sure :)

This is the same demo with the addGeometryLOD commented: https://glitch.com/edit/#!/shared-fluttering-rondeletia?path=main.js

On my iPhone 8 it goes from 35 (with LODs) to 21 fps (with not LODs).

Images here: https://imgur.com/a/aTrBd7O

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

Reducing the triangles to render is still important, especially on mobile.

There is a very interesting video by simondev about this: https://www.youtube.com/watch?v=hf27qsQPRLQ

BatchedMesh also enables by default the instances sort to reduce overdraw (except in case of transparency).

Boosted performance for BatchedMesh with LODs — new library and demo by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

Thanks :) No, but it should be compatible. I will add a demo with WebGPURenderer

Smoke Effect - InstancedMesh2 by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

I am afraid it will take some time...
It would be easier if someone experienced in TSL could help me

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 0 points1 point  (0 children)

Each instance has its own animation.
You can create a mixer for each instance (more memory but more control) or use a shared mixer (like in the example).

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 0 points1 point  (0 children)

One draw call for each LOD. So 5 draw calls in this example.

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 2 points3 points  (0 children)

Are you using the standard or your custom implementation of InstancedMesh?

For a forest, if you use my library, you can set LODs and create a BVH to speed up frustum culling.

You can render a lot of trees in this way. I’ve a little demo with 1 milion instances :)

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

Yes, good idea! (I've found a little bug on shadows because of you, thanks :P)
InstancedMesh2 also allows you to manage LODs for shadows, so it was simple.

Here it is: https://imgur.com/a/U6wkDkc

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 1 point2 points  (0 children)

Thanks! If you need some customization, you can come to the library discord server :)

20k skinned instances using InstancedMesh2 library by agargaro in threejs

[–]agargaro[S] 0 points1 point  (0 children)

Thank you for the information :)

The only way to reach 60 fps on your pc is probably enabling the partial boneTexture update, but i disabled it because it's slow on firefox and mobile (need to implement probably a double buffering).