Scene Management-spatial partitioning

Source: Internet
Author: User

 Scene Management --- spatial partitioning

For personal use only, do not reprint, do not use for any commercial purposes. 

 

today, I have carefully considered space division, record down: This article is very simple, when quadtree , K-D tree when using spatial data interfaces to divide scenarios, all nodes can store objects ( method 1 ) , or store only on leaf nodes ( method 2 ) ? For the convenience of discussion, the spatial data structure here is only used for cropping and collision detection, rather than for hierarchical transformation of object spatial positions.

The biggest difference between two different designs is how we want to deal with objects that span multiple node boundaries. In the first method, when an object spans multiple nodes, it looks up for an advanced node that exactly contains the object and stores the node in the node; the second method adds an object to all leaf nodes that are at the intersection of the object. The advantage of the first method is that the design is simple. Each object has only one corresponding node. The insertion, movement, and deletion costs of the object are relatively small, and the Space storage requirements are also low. However, the disadvantage is obvious. All nodes may have objects, which increases the logic of collision detection. More importantly, a large number of small objects may appear in the upper nodes, the impact on the efficiency of collision detection also violates the initial goal of Space Division. The second method is the opposite. The one-to-multiple relationship between objects and nodes increases the moving valence of objects between nodes, but the detection efficiency is quite high.

There is no unique answer to the two advantages and disadvantages, or even the opposite, to solve the problem. This is the charm of engine development, it is always difficult to make a choice. Some of my own analyses and thoughts are as follows: Dynamic and Static objects are processed in different ways. All static objects are stored on leaf nodes, while dynamic objects are stored on the appropriate minimum node. In this way, dynamic objects can be efficiently moved between nodes, while reducing the number of collision detection times between static objects. Generally, because there are relatively few dynamic objects in the scenario, most non-leaf nodes do not store any objects. You can consider placing static and dynamic objects in two completely different data structures. ( Novogene ) . There is no need for collision detection between static objects. The detection logic can be more efficient, avoiding access to a large number of unnecessary static object nodes. Furthermore, we can pre-process the space division of static objects and stop using them. Quadtree , Octree And other structures with uniform space division, but uneven object distribution. K-D tree/BSP More reasonable space division. Similarly, dynamic objects do not have to use static data structures, Loose K-D tree Or similar dynamic structures may be more efficient. Another example: Wow In this way, dynamic objects are biological, mechanical, and other objects with little difference in size. The number of objects is not large, and collision detection between dynamic objects is not performed. A simple uniform mesh can be used completely, or a tree with a very low depth for management.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.