Closed recoshet closed 9 years ago
Hello, The Trimesh is not very optimized yet. It does a naive lookups for triangles+edges+verts, which is extremely slow (if you mesure performance, you'll see that the bottleneck is Narrowphase.prototype.sphereTrimesh). I'm planning to make an octree lookup for it, and that will make it much faster.
Btw, is that de_dust2 from CounterStrike? Cool :)
@recoshet Hey, check out the latest commits. I added an Octree and it should be fast enough for Sphere/Trimesh collisions now. One sphere against a 25.000 vertex trimesh works without problem on my macbook pro :)
That'S Perfect! Very good performance. Thanks!
@recoshet it's even more optimized now :)
@schteppe, Hi there. I have a problem when constructing terrain with trimesh (i have only vertices and faces, thats why.) When number of segments is more than 125x125 all other vertices points to 0, 0, 0 point. And normals have 0 value.
In normals array after normal №194325 all them have zero value
Thats when i have 250x250 segments.
@schteppe i found the solution. Int32Array for indeces in trimesh object. But it use more perfomance.
Hi. The Trimesh currently use an Int16Array for the index data. If I got it right, you have 125 * 125 * 2 * 3 = 93750 indices which is more than a signed 16 bit integer can hold. You should probably split your Shape into pieces to get around this... Or switch to another index storage, as you already suggested.
Perhaps the Trimesh should throw an error when the index limit is reached..
@schteppe Thank you for your answer. But how can i split a shape? I can give you a link with my project. Can you help me, please?
@schteppe Here is a demo: http://sitepro.ga/proj/whsedit/
If I were you I'd use Int32Array or just a normal Array instead as a quick fix. Performance difference is probably not noticeable. Or is it?
Trimesh splitting would be cool to have in the lib, maybe I'll have a look at that sometime in the future.
Hello again) I use a complex geometry in your engine. But I have found a strong drop in performance when adding new simple objects (spheres). example: http://naviris.ru/3D2/cannon_phi.html I cut geometry for a few details. But productivity has increased only at the edges of the model.
Tell me how to handle a model to increase productivity?
I want to do this one: http://media.tojicode.com/q3bsp/physics-test.html