Efficiency of three js

Hy! I work with huge vertex objects, I can show a lot of mods because I split them into smaller parts (up to 65K vertices). Also I am using three js cameras. I want to improve performance with a priority queue, and when the user moving the camera only shows the top 10, then when the moving stop shows the rest. This part is not that hard, but I don't want to simulate rendering when they are behind another object, maybe send some rays from the camera's point of view (checking if they hit the frame) and according to the hit list I can plot the previous one queue.

What do you think?

Also how can I determine if I can load the next module or not (on the fly)

+3


source to share


1 answer


Option A : Disable occlusion, you will need to find a library to do this.

Option Bed and . Use the AABB plane test with the camera. Crystal planes and object bounding field, this will tell you if the object is in the camera's field of view. (not necessarily visible behind the object, since such an operation is not possible, this is most likely already done to some extent with webgl)

Implementation: Google, three js probably support this

Option C : Use the maximum rendering of the Limit object, priority is based on distance from the camera and object size. For example, count which objects are visible (option B), then prioritize the closest and largest and disable the rest.

pseudocode:



    if(object is in frustum ){
       var priority = (bounding.max - bounding.min) / distanceToCamera 
    }

      

Make sure your shaders only execute one pass . As this will double the computation time (roughly depending on the situation)

Option D : raycast for eight corners of the bounding box if they all fail the object. That's pretty accurate, but far from perfect.

Option A will be best, using Option C is great if you don't care that small objects don't show far. Option D works well with objects with a lot of vertices, you may want to increase the number of points of the object depending on the situation. Option B probably won't be useful for your scenario, but part c and other optimization techniques. In everything, there has never been an extremely reliable and optimal way of saying that something is behind something else.

+5


source







All Articles