Method and apparatus for generating three-dimensional virtual scene, electronic device
By generating entity node data, constructing a sparse octree, and using globally unique identifiers, the performance bottleneck and entity ID conflict issues in 3D virtual scene generation are resolved, achieving efficient 3D scene management and cross-platform compatibility, and improving system scalability and resource utilization efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-31
AI Technical Summary
Existing 3D virtual scene generation solutions suffer from performance bottlenecks, lack of semantic and topological representation, and difficulties in dynamic integration and real-time updates. In particular, they suffer from severe resource waste, data loss, and system lag when processing large-scale scenes, and the lack of a global ID generation mechanism leads to entity ID conflicts.
By generating entity node data, a sparse octree data structure is constructed. Using axis-aligned bounding box data and multi-level detail values, combined with a globally unique identifier generation method, efficient management and dynamic loading of 3D virtual scenes are achieved, entity node conflicts are resolved, and a hierarchical scene graph structure is adopted for comprehensive scene graph construction.
It improves the efficiency of 3D scene management, reduces resource consumption, enhances system scalability, and achieves efficient 3D model scene management and cross-platform compatibility.
Smart Images

Figure CN121392162B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D modeling technology, and more specifically, to a method and apparatus for generating 3D virtual scenes, electronic devices, and non-transitory computer-readable storage media. Background Technology
[0002] With the development of the digital twin industry, 3D virtual scenes have been widely used in fields such as smart cities. However, current 3D scene generation solutions face several core problems:
[0003] First, performance bottlenecks exist in large-scale scenes. Existing engines mainly rely on LOD (Level of Detail) optimization or scene switching techniques when handling complex scenes, but performance issues still arise in practical applications. For example, scene switching in Unity causes all game objects in the previous scene to be destroyed and need to be reloaded, which not only wastes resources but may also lead to data loss and system lag.
[0004] Secondly, semantic and topological representations are lacking. Existing 3D scene management technologies focus primarily on geometric structures, lacking precise descriptions of semantic relationships and topological structures between entities. For example, while standards such as CityGML support semantic information, their scalability is insufficient, they do not support multi-resolution representation, and while widely used at local scales such as individual buildings, their support for geographic coordinates is limited, making them unsuitable for large-scale urban applications.
[0005] Secondly, dynamic integration and real-time updates are difficult. For example, when merging multiple scenes, existing solutions may encounter inconsistencies between the old and new states of entities with the same ID, leading to rendering errors. Furthermore, ID conflicts between newly created entities in different scenes are difficult to resolve, as there is a lack of a unified global ID generation mechanism. Summary of the Invention
[0006] This application proposes a method, apparatus, electronic device, and non-transitory computer-readable storage medium for generating three-dimensional virtual scenes, in order to solve the problem of poor compatibility of three-dimensional virtual scene data in the prior art.
[0007] According to one aspect of this application, a method for generating a three-dimensional virtual scene is proposed, comprising:
[0008] Based on a 3D model of a real scene, entity node data of the 3D scene is generated, wherein the entity node data includes axis-aligned bounding box data of the entity nodes in the local coordinate system.
[0009] Multiple single-scene graphs are constructed using the entity node data;
[0010] A comprehensive scene graph is constructed using the multiple single-scene graphs;
[0011] Calculate the multi-detail level value of the entity node in the overall scene graph;
[0012] The 3D virtual scene is generated using the axis-aligned bounding box data, the multi-level detail values, and the integrated scene graph.
[0013] According to some embodiments, the entity node data also includes a globally unique identifier for the entity node, wherein...
[0014] Based on a 3D model of the real-world scene, generate entity node data for the 3D scene, including:
[0015] Calculate the geographic quadtree tile identifier corresponding to the entity node;
[0016] The globally unique identifier is generated using the network adapter's hardware unique identifier, current calendar information, current performance counter value, current increment counter value, and the geographic quadtree tile identifier, through the MD hash algorithm.
[0017] According to some embodiments, before calculating the multi-level-of-detail value of the entity node in the comprehensive scene graph, the method further includes:
[0018] A sparse octree data structure is constructed using the entity nodes, wherein each octree node of the sparse octree data structure includes the axis-aligned bounding box data of the entity node, the center point position, the current node depth, and the maximum depth value.
[0019] According to some embodiments, a sparse octree data structure is constructed using the entity nodes, including:
[0020] The three-dimensional space of the entity node is divided by a recursive octet method so that the entity node can include a maximum of 8 child nodes.
[0021] Traverse all child nodes of the entity node to construct the sparse octree data structure.
[0022] According to some embodiments, calculating the multi-level detail value of the entity node in the overall scene graph includes:
[0023] The list of entity nodes displayed in the integrated scene map is determined based on the camera's view frustum;
[0024] Calculate the multi-detail level value for each entity node in the entity node list sequentially.
[0025] According to some embodiments, the method further includes:
[0026] Determine the list of preloaded entity nodes based on the camera's current position;
[0027] Based on the preloaded entity node list, preload the corresponding entity nodes.
[0028] According to some embodiments, the method further includes:
[0029] The entity node list in the integrated scene graph is updated based on the current position of the camera to obtain the updated entity node list;
[0030] The multi-level detail value of each entity node in the updated entity node list is calculated sequentially;
[0031] The composite scene graph is rendered using the multi-level detail values of each entity node in the updated entity node list and the axis-aligned bounding box data to generate the updated 3D virtual scene.
[0032] According to some embodiments, the 3D virtual scene is generated using the axis-aligned bounding box data, the multi-level-of-detail values, and the composite scene graph, including:
[0033] Using the axis-aligned bounding box data and the multi-level of detail value, the entity node's position in the overall scene graph is determined;
[0034] The integrated scene map is loaded based on the entity's location to generate the three-dimensional virtual scene.
[0035] According to some embodiments, the three-dimensional virtual scene is generated by loading the integrated scene map based on the entity location, including:
[0036] The globally unique identifier is used to detect whether there are entity node conflicts in different single-scene graphs;
[0037] In the event of entity node conflicts in different single-scene graphs, the display priority of the entity node in each single-scene graph is used to determine whether the entity node is displayed in each single-scene graph.
[0038] According to one aspect of this application, an apparatus for generating a three-dimensional virtual scene is provided, comprising:
[0039] The entity node data generation unit is used to generate entity node data of a three-dimensional scene based on a three-dimensional model of a real scene. The entity node data includes the axis-aligned bounding box data of the entity nodes in the local coordinate system.
[0040] A single-scene graph construction unit is used to construct multiple single-scene graphs using the entity node data;
[0041] A comprehensive scene graph construction unit is used to construct a comprehensive scene graph using the multiple single scene graphs;
[0042] A multi-detail level value calculation unit is used to calculate the multi-detail level value of the entity node in the comprehensive scene graph;
[0043] A 3D virtual scene generation unit is used to generate the 3D virtual scene using the axis-aligned bounding box data, the multi-level detail values, and the comprehensive scene graph.
[0044] According to one aspect of this application, an electronic device is provided, characterized in that it includes: a processor; a memory for storing a computer program; and when the computer program is executed by the processor, causing the processor to perform the method as described in any of the preceding embodiments.
[0045] According to one aspect of this application, a non-transitory computer-readable storage medium is provided, having stored thereon computer-readable instructions that, when executed by a processor, cause the processor to perform the method as described in any of the preceding embodiments.
[0046] According to the example embodiments of this application, a hierarchical three-dimensional scene graph structure is constructed according to the relationship between entities, single scene graphs and comprehensive scene graphs, which realizes efficient three-dimensional scene management, dynamic loading and cross-platform compatibility, significantly improves the scene management efficiency of three-dimensional models, reduces resource consumption and enhances system scalability. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below.
[0048] Figure 1 A schematic diagram of a system architecture for generating a three-dimensional virtual scene according to an example embodiment of this application is shown.
[0049] Figure 2 A schematic diagram of a three-dimensional solid hierarchy structure according to an example embodiment of this application is shown.
[0050] Figure 3 A schematic diagram of three-dimensional model data corresponding to an entity according to an example embodiment of this application is shown.
[0051] Figure 4 A schematic diagram of a method for constructing an octree according to an example embodiment of this application is shown.
[0052] Figure 5 A flowchart illustrating a method for generating a three-dimensional virtual scene according to an example embodiment of this application is shown.
[0053] Figure 6A schematic diagram of a method for determining a list of entity nodes to be displayed in a composite scene map based on the camera view frustum boundary, according to an example embodiment of this application, is shown.
[0054] Figure 7 A schematic diagram of a method for resolving entity conflicts according to an example embodiment of this application is shown.
[0055] Figure 8 A schematic diagram of a data flow for generating a three-dimensional virtual scene is shown according to an example implementation of this application.
[0056] Figure 9 A block diagram of an apparatus for generating a three-dimensional virtual scene according to an example embodiment of this application is shown.
[0057] Figure 10 An electronic device is shown according to an exemplary embodiment of this application. Detailed Implementation
[0058] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this application will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0059] The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of these specific details, or other methods, components, materials, apparatus, or operations may be employed. In these cases, well-known structures, methods, apparatuses, implementations, materials, or operations will not be shown or described in detail.
[0060] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0061] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0062] The specific embodiments according to this application will now be described in detail with reference to the accompanying drawings.
[0063] Figure 1 A schematic diagram of a system architecture for generating a 3D virtual scene according to an example embodiment of this application is shown, such as... Figure 1 The system architecture shown includes a data layer, an index layer, a logic layer, and an interface layer.
[0064] The following is based on Figure 1 Taking an example, a system architecture for generating a three-dimensional virtual scene according to an example embodiment of this application will be described in detail.
[0065] According to embodiments of this application, the entity.json file is used to describe the composition and representation of entities (3D models) in a static 3D virtual scene, supporting various entity types such as 3D model nodes and light nodes, and including complete attributes such as geographic coordinates, local coordinates, local coordinate system AABB bounding boxes, and collision detection. The .vscene file is used as a single-scene graph description file, employing a modular design to support multiple modules such as terrain, entities, airports, automated cities, roads, and vegetation, each of which can be independently enabled and configured. The .vproj file is used as a comprehensive scene graph description file, supporting scene list management and including performance optimization configurations such as preloading and resident memory, enabling unified management and switching of multiple scenes. The data format syntax rules and validation requirements of entity.json, .vscene, and .vproj are all standardized using JSON Schema.
[0066] In this embodiment, a tree structure is used to construct a hierarchical organization of 3D scene entities, such as... Figure 2 As shown, each node represents a three-dimensional entity. These entities include various types such as buildings, lights, vehicles, and roads, corresponding to specific objects in the real world and forming the constituent elements of a specific scene. Unlike existing technologies, the nodes in this embodiment not only contain the basic attributes of the three-dimensional entity but also support dynamic parent-child relationship maintenance. By establishing dynamic parent-child relationships, scene management becomes more flexible and efficient.
[0067] Figure 3This illustration shows a schematic diagram of a 3D model data corresponding to an entity according to an example embodiment of this application. In a specific embodiment, a unique identifier ID is assigned to each entity to ensure entity uniqueness across scenes. Simultaneously, both geographic coordinates and local coordinates are supported to facilitate scene alignment with real geographic space or fine-tuning of local areas. To describe the entity's rotational state in 3D space, the entity's 3D model also includes attitude parameters, including roll angle, pitch angle, and yaw angle. To record the current level of detail of the model and support dynamic switching of the entity in the scene, the entity's 3D model also includes multiple level of detail (LOD) values, the size of which is related to the model size and the current view frustum. In some embodiments, the entity's 3D model parameters also include an axis-aligned bounding box (also called an AABB bounding box) in the local coordinate system for fast spatial queries and collision detection, containing minimum and maximum coordinates. This bounding box is defined relative to the entity's local coordinate system, and its value remains unchanged during the entity's movement and rotation. It should be noted that during spatial calculations such as collision detection, the axis-aligned bounding box in the local coordinate system needs to be converted to an AABB bounding box in the global coordinate system (i.e., the world coordinate system) before it can be used. In other embodiments, the 3D model data representation of entities also supports extended metadata to allow the addition of custom fields, such as animation scripts and physical attributes, based on specific entity implementations, thereby enhancing system flexibility. Additionally, the 3D model data representation of entities includes a visibility status field to record whether the entity is visible, facilitating dynamic management.
[0068] In some embodiments, a light node includes basic attributes, light attributes, and effect attributes. The basic attributes include the node name, unique identifier, and tag array; the light attributes include light type (e.g., spotlight, point light, directional light), light color, outer angle, and maximum illumination range; the effect attributes include whether it is movable, whether it is a low beam light, luminous intensity, luminous effect, visible luminous range, shadow casting, and shadow casting intensity.
[0069] According to embodiments of this application, a sparse octree data structure is used to manage various entities at the index layer, with each node of the sparse octree corresponding to one entity. In a specific embodiment, to support the display of a global scene, an octree for the global scene is established, with the Earth's diameter approximately 6400 kilometers, and the maximum depth of the octree is set to 16. The bounding box size of the leaf nodes is approximately 200×200×200 meters. The octree nodes store information such as the axis-aligned bounding box of the current node in the global coordinate system, the center point position, the current node depth, and the maximum depth, and record the child entity objects contained within the node. When an entity spans multiple leaf nodes of the octree, the entity needs to be recorded multiple times.
[0070] In specific embodiments, such as Figure 4As shown, the three-dimensional space of an entity is divided into eight sub-cubes by recursively partitioning the three-dimensional space, so that each node in the octree contains at most 8 child nodes, thereby improving the efficiency of three-dimensional space query.
[0071] According to embodiments of this application, the global ID generator uses geographic quadtree tile IDs to generate a unique VUID for each entity, providing efficient spatial query and collision detection functions, and providing a technical foundation for large-scale geographic scene management.
[0072] In a specific embodiment, the globally unique identifier is generated using the network adapter's hardware unique identifier, current calendar information, current performance counter value, current incrementing counter value, and the geographic quadtree tile identifier, through the MD hash algorithm. This embodiment ensures the uniqueness and traceability of the ID by fusing hardware characteristics (MAC address), geographic region, time information (calendar time + performance counter), and sequence information (counter); by using the performance counter to provide microsecond-level time precision, it offers higher uniqueness guarantees compared to traditional timestamps; MAC address binding ensures consistency of IDs generated by the same hardware device, while ensuring uniqueness of IDs generated by different hardware devices; and by using the MD5 hash algorithm to process the seed structure, it ensures that the generated 64-bit ID has good random distribution characteristics, avoiding ID conflicts. Furthermore, this application also supports batch generation of multiple global VUIDs, and uses an incrementing counter to ensure the uniqueness of the batch-generated VUIDs.
[0073] According to an embodiment of this application, in order to control whether a single scene is displayed in the current comprehensive scene, a display switch is set for each single scene file to control whether the single scene is displayed in the comprehensive scene.
[0074] In other embodiments, the integrated scenario includes multiple individual scenarios, and a preload flag and a resident memory flag are set for each individual scenario to control whether the individual scenario is loaded at startup and whether its memory occupation is released when switching scenarios.
[0075] exist Figure 1 The scene management unit shown is used to manage the scene list, scene switching, preloading, and memory management. In this embodiment, modular management is adopted, decomposing the complex 3D scene into multiple independent single-scene functional modules (e.g., terrain, entities, airport, automated city, roads, vegetation, etc.). Each single-scene functional module can be independently enabled, configured, and managed, thereby greatly improving the flexibility and scalability of the integrated scene.
[0076] According to an embodiment of this application, the LOD management unit is used to calculate the LOD level value based on the distance from the camera to the center of the entity, and to control the loading and unloading of the 3D model corresponding to the entity; the generated 3D virtual scene includes multiple single scenes, and the dynamic loading queue is used to dynamically load and unload different single scenes.
[0077] In some embodiments, the coordinate transformation unit is used to perform multi-coordinate system transformations on entities, including transformations between geographic coordinate systems (LON, LAT, ALT), world coordinate systems (ECEF), model coordinate systems, and attitude coordinate systems (Roll, Pitch, Yaw). This embodiment not only achieves accurate transformations between different coordinate systems but also supports various application scenarios such as geolocation, spatial transformation, and attitude control. This system supports not only static coordinate transformations but also dynamic coordinate system updates and real-time transformation calculations, providing a technical foundation for spatial positioning and attitude control in complex 3D scenes.
[0078] In other embodiments, the interface layer is used to receive instructions from external applications to facilitate developers in controlling and managing the 3D scene.
[0079] Figure 5 A flowchart illustrating a method for generating a three-dimensional virtual scene according to an example embodiment of this application is shown, such as... Figure 5 The method shown includes steps S501, S503, S505, S507, and S509. The following will use... Figure 5 Taking an example, a method for generating a three-dimensional virtual scene according to an example embodiment of this application will be described in detail.
[0080] like Figure 5 As shown, in step S501, entity node data of the three-dimensional scene is generated based on the three-dimensional model of the real scene. The entity node data includes the axis-aligned bounding box data of the entity nodes in the local coordinate system.
[0081] According to embodiments of this application, entities include various types such as models, lights, and vehicles. In this embodiment, each entity node data corresponds to an entity in a real scene. Furthermore, unlike existing technologies, each entity node data not only contains the entity's basic three-dimensional attribute data but also includes the dynamic parent-child relationship maintenance between the entity and other entities, forming a hierarchical organizational structure that makes scene management more flexible and efficient.
[0082] In a specific embodiment, the entity node data is stored in JSON format, and custom extended fields can be added according to the characteristics of the entity.
[0083] In some embodiments, to ensure the uniqueness of entities, the entity node data further includes a globally unique identifier for the entity node. In step S501, generating entity node data for a 3D scene based on a 3D model of the real scene includes: calculating the geographic quadtree tile identifier corresponding to the entity node; and generating the globally unique identifier VUID using the hardware unique identifier of the network adapter, current calendar information, current performance counter value, current increment counter value, and the geographic quadtree tile identifier through the MD hash algorithm.
[0084] In a specific embodiment, when batch generation of VUIDs is required, firstly, the hardware unique identifier of the network adapter, the current calendar information, the current performance counter value, the current increment counter value, and the geographic quadtree tile identifier are used as seeds, and the counter is set to zero; then, MD5 hash calculation is performed cyclically to generate a 128-bit 16-byte MD5 digest; then, bytes 4-11 are extracted from the MD5 digest (skipping the first 4 bytes), and these 8 bytes are used to form a 64-bit unsigned integer, with the counter incremented each time; finally, all generated VUIDs are returned.
[0085] In some embodiments, the MAC address is obtained from the MAC address of the first network adapter used as a unique hardware identifier; the timestamp uses time(nullptr) to obtain the current calendar time; the performance counter obtains a high-precision performance counter value through an interface provided by the operating system (e.g., QueryPerformanceCounter); and the uniqueness of multiple VUIDs generated at the same point in time is ensured by an incrementing counter.
[0086] In this embodiment, the uniqueness of entities arranged in different geographical regions is ensured by using geographical regions, the uniqueness of IDs generated by different hardware devices is ensured by using MAC addresses, the uniqueness of the time dimension is ensured by combining calendar time and performance counters, the performance counters provide microsecond-level precision to avoid time conflicts, and it does not rely on centralized services, making it suitable for distributed environments. The MD5 hash algorithm ensures that the generated 64-bit IDs have good distribution characteristics.
[0087] To provide spatial dimension information, in a specific embodiment, the geographic quadtree tile ID includes the tile level, the tile index in the horizontal direction, the tile index in the vertical direction, and the combined tile ID. The tile level indicates the level of detail of the tile, with a value ranging from 0 to 20. The combined tile ID combines the level, the tile index in the horizontal direction, and the tile index in the vertical direction into a 32-bit tile ID through bitwise operations.
[0088] In step S503, multiple single-scene graphs are constructed using the entity node data.
[0089] In this embodiment, a single scene map includes multiple entity nodes, which are used to integrate various geographic information modules, including terrain, buildings, airports, water bodies, etc.
[0090] In step S505, a comprehensive scene graph is constructed using the multiple single scene graphs.
[0091] According to embodiments of this application, by merging multiple single-scene graphs into a single comprehensive scene graph, coverage of the entire three-dimensional virtual scene can be achieved.
[0092] In step S507, the multi-detail level value of the entity node in the comprehensive scene graph is calculated.
[0093] According to an embodiment of this application, before calculating the multi-detail level value of the entity node in the comprehensive scene graph, the method further includes: constructing a sparse octree data structure using the entity node, wherein each octree node of the sparse octree data structure includes the axis-aligned bounding box data, center point position, current node depth, and maximum depth value of the entity node.
[0094] In specific embodiments, such as Figure 4 As shown, when constructing a sparse octree data structure using the entity nodes, firstly, the three-dimensional space of the entity nodes is divided by a recursive octet method so that the entity nodes include a maximum of 8 child nodes; then, all child nodes of the entity nodes are traversed to construct the sparse octree data structure.
[0095] According to embodiments of this application, the entity's attitude parameters include roll angle, pitch angle, and yaw angle, used to describe the entity's rotational state in three-dimensional space. When the entity's position or attitude changes, in some embodiments, firstly, its AABB bounding box in the global coordinate system is updated, and then, index consistency is ensured through octree path reconstruction. Compared with traditional methods, in this embodiment, by allowing each node to contain a maximum of 8 child nodes, the time complexity of querying in three-dimensional space is reduced from O(n) to O(log n), thereby significantly improving query efficiency.
[0096] According to an embodiment of this application, when calculating the multi-detail level value of the entity node in the comprehensive scene graph, firstly, as... Figure 6As shown, the list of entity nodes displayed in the comprehensive scene graph is determined based on the camera's view frustum boundary; then, the multi-level of detail value for each entity node in the list is calculated sequentially. This embodiment reduces rendering computation by utilizing camera view frustum clipping and traversing the octree to quickly exclude nodes outside the view frustum. Simultaneously, by leveraging the hierarchical structure of the octree for proximity queries, all entities within a specified range can be quickly located, achieving efficient collision detection.
[0097] In a specific embodiment, the multi-detail level value is calculated using formula (1).
[0098] (1)
[0099] Wherein, camera_distance represents the distance from the camera to the center of the entity, base_threshold is the preset base distance (e.g., 100 meters), and max_lod is the preset maximum LOD level (e.g., the maximum LOD level is set to 3).
[0100] In step S509, the three-dimensional virtual scene is generated using the axis-aligned bounding box data, the multi-level detail values, and the integrated scene graph.
[0101] According to an embodiment of this application, in step S509, when generating the three-dimensional virtual scene using the axis-aligned bounding box data, the multi-level of detail value, and the composite scene graph, firstly, the entity position of the entity node in the composite scene graph is determined using the axis-aligned bounding box data and the multi-level of detail value; then, the composite scene graph is loaded according to the entity position to generate the three-dimensional virtual scene.
[0102] When generating the comprehensive scene graph using multiple single scenes, there may be a problem where a unified entity exists in different single scenes, resulting in entity VUID conflicts. To solve this problem, in some embodiments, firstly, the globally unique identifier is used to detect whether there are entity node conflicts in different single scene graphs; then, if there are entity node conflicts in different single scene graphs, the display priority of the entity node in each single scene graph is used to determine whether the entity node is displayed in each single scene graph.
[0103] like Figure 7As shown, when entity nodes conflict, the process first determines whether the node has a global ID (i.e., whether it is the root node). If it does, the entity is retained in all conflicting single-scene graphs. Since the same entity may have the same globally unique identifier in different single-scene graphs, it may have different names. If the names are the same in different single-scene graphs, the entity is retained in all conflicting single-scene graphs. Otherwise, the priority of the entity in different single-scene graphs is compared. If the priorities are the same, the entity in the first loaded single-scene (defined as the parent scene) overwrites the entity in the second loaded single-scene (defined as the child scene). If the priorities are different, the higher-priority entity is retained. Finally, the mapping relationship is updated, and the current conflict resolution result is recorded.
[0104] In order to improve the loading efficiency of the 3D virtual scene and reduce the loading delay, according to the embodiment of this application, after step S509, the preloaded nodes are located by octree indexing, and the nodes within 10% distance range of the camera view frustum are recorded in advance.
[0105] Specifically, first, a list of preloaded entity nodes is determined based on the current position of the camera; then, the corresponding entity nodes are preloaded based on the list of preloaded entity nodes.
[0106] When the camera position changes, according to an embodiment of this application, after step S509, Figure 5 The method further includes updating the list of entity nodes in the composite scene graph according to the current position of the camera to obtain an updated list of entity nodes; sequentially calculating the multi-level of detail value of each entity node in the updated list of entity nodes; and rendering the composite scene graph using the multi-level of detail value of each entity node in the updated list of entity nodes and the axis-aligned bounding box data to generate the updated 3D virtual scene.
[0107] When the camera position changes, the corresponding composite scene graph, including the single scene graph, will also change, and new single scene graphs may be added. Therefore, before calculating the multi-detail level value of each entity node in the updated entity node list, the octree index also needs to be updated.
[0108] according to Figure 5 The illustrated embodiment constructs a hierarchical 3D scene graph structure according to the relationship between entities, single scene graphs, and comprehensive scene graphs. This achieves efficient 3D scene management, dynamic loading, and cross-platform compatibility, significantly improving the scene management efficiency of 3D models, reducing resource consumption, and enhancing system scalability.
[0109] Figure 8 A schematic diagram of a data flow for generating a three-dimensional virtual scene according to an example implementation of this application is shown, such as... Figure 8 As shown, firstly, the JSON scene file is parsed to construct an octree and establish parent-child relationships between entities. Simultaneously, using the model resource file, the LOD (Level of Detail) value of each entity is calculated through a LOD manager combined with the camera position. The model resource file mainly includes geometric feature descriptions, material texture feature descriptions, and LOD descriptions at different levels. Typically, several different levels of display detail are defined based on the distance between the camera and the entities to display varying degrees of detail; closer entities have richer detail levels. Finally, based on the camera's view frustum, the octree is used to determine the list of displayable entities for scene rendering. Afterwards, a dynamic loading queue is used to update the overall scene. In this embodiment, by dynamically loading or unloading different single-scene modules (e.g., terrain, buildings, airports, etc.), the functionality requirements of various application scenarios can be adapted.
[0110] In specific embodiments, such as in the construction of smart cities, it is necessary to perform accurate 3D modeling and real-time monitoring of buildings, roads, public facilities, etc. in the city. Due to the massive amount and diverse types of data involved, the 3D virtual scene generation method provided in this application can efficiently organize, manage, and display this data.
[0111] For example, firstly, the proposed 3D entity organization and representation method is used to construct a 3D scene map of a smart city. Then, topographical information of the city is acquired through drone photography and satellite imagery. For important buildings, 3D models are obtained using laser scanning technology, and dynamic data such as traffic flow and air quality are collected and organized. Next, entity files are created using JSON format, defining the basic attributes of each entity and their interrelationships. Various geographic information modules, including terrain, buildings, airports, and water bodies, are integrated into a single scene map description file (.vscene) to construct the scene map. Finally, multiple single scene maps are merged into a comprehensive large scene to achieve full coverage of the entire city. In this implementation, by using a globally unique VUID for each entity, the uniqueness of entities across scenes is ensured, improving spatial query efficiency and cache hit rate. Simultaneously, with the help of the 3D engine, users can freely browse in a virtual environment, view the city's status at different points in time, and perform interactive queries.
[0112] This embodiment utilizes a hierarchical scene graph structure, enabling city managers to quickly locate and adjust entities in specific areas during scene editing, such as adjusting the visibility of a building or updating its pose, thus improving management efficiency. Employing an octree-optimized global coordinate system AABB bounding box and a LOD dynamic preloading strategy, the system renders only the visible area, reducing resource consumption by approximately 40%. Furthermore, different 3D engines used by the same department can share and reuse scene data, avoiding redundant modeling and saving costs. To improve spatial positioning accuracy, a multi-coordinate system-transformation framework is adopted, achieving precise positioning of entities such as buildings and roads with centimeter-level accuracy, meeting the high-precision requirements of smart city applications.
[0113] In another specific embodiment, for example in digital twin factory applications, precise 3D modeling and simulation of equipment in the factory are required to optimize production processes and reduce costs. This necessitates that the system not only accurately reflects the state changes of the physical factory but also supports the operational simulation of complex equipment. The 3D virtual scene generation method provided in this application can be used to construct digital twin factory scenarios.
[0114] For example, first, CAD design drawings are converted into 3D models, and equipment from the factory is extracted as entities. Logical connections between these devices are defined to form a complete production line model. Then, custom fields are added to the entity files to describe the equipment's behavioral logic, such as robot trajectories and valve opening / closing states. Trigger conditions and response actions are set to simulate various situations in a real-world operating environment. Finally, equipment behavior is controlled via API interfaces, such as calling the `updateNode()` interface to update equipment posture; the LOD management unit dynamically adjusts the equipment model's detail to optimize rendering performance; and spatial indexing units quickly locate equipment, improving simulation response speed.
[0115] This embodiment achieves more realistic and accurate device simulation through precise geographic coordinates and attitude parameter descriptions. Employing an octree-optimized global coordinate system AABB bounding box and a LOD dynamic preloading strategy improves rendering efficiency by approximately 35%. Metadata fields support the addition of device behavior logic and physical attributes, allowing the system to be easily expanded to support new devices and functions. Furthermore, configuring a unique VUID for each device entity enables precise tracking and management of device status, improving the reliability and maintainability of the simulation system. Simultaneously, the spatial awareness of the VUID generation algorithm ensures that devices in the same area have similar VUID prefixes, optimizing device query and management efficiency. Precise control of the attitude coordinate system (Roll, Pitch, Yaw) enables accurate simulation of complex attitudes such as device rotation and tilt, achieving an attitude control accuracy of 0.1 degrees, meeting the requirements of high-precision industrial simulation.
[0116] The above description primarily focuses on the methodological aspects of the embodiments of this application. Those skilled in the art should readily recognize that, based on the operations or steps described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Those skilled in the art can implement the described functionality in different ways for each specific operation or method, and such implementations should not be considered beyond the scope of this application.
[0117] The apparatus embodiments of this application are described below. For details not described in the apparatus embodiments of this application, please refer to the method embodiments of this application.
[0118] Figure 9 A block diagram of an apparatus for generating a three-dimensional virtual scene according to an example embodiment of this application is shown, such as... Figure 9 The illustrated device includes an entity node data generation unit 901, a single-scene graph construction unit 903, a comprehensive scene graph construction unit 905, a multi-level detail value calculation unit 907, and a 3D virtual scene generation unit 909. The entity node data generation unit 901 generates entity node data for a 3D scene based on a 3D model of a real scene. This entity node data includes axis-aligned bounding box data of the entity nodes in a local coordinate system. The single-scene graph construction unit 903 constructs multiple single-scene graphs using the entity node data. The comprehensive scene graph construction unit 905 constructs a comprehensive scene graph using the multiple single-scene graphs. The multi-level detail value calculation unit 907 calculates the multi-level detail values of the entity nodes in the comprehensive scene graph. The 3D virtual scene generation unit 909 generates the 3D virtual scene using the axis-aligned bounding box data, the multi-level detail values, and the comprehensive scene graph.
[0119] Figure 10 An electronic device according to an exemplary embodiment of this application is shown. Reference is made below. Figure 10 To describe an electronic device 200 according to this embodiment of the present application. Figure 10 The electronic device 200 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0120] like Figure 10 As shown, the electronic device 200 is presented in the form of a general-purpose computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including storage unit 220 and processing unit 210), a display unit 240, etc.
[0121] The storage unit stores program code that can be executed by the processing unit 210, causing the processing unit 210 to perform the methods described in this specification according to various exemplary embodiments of this application. For example, the processing unit 210 can perform the methods described above.
[0122] Storage unit 220 may include readable media in the form of volatile storage units, such as random access memory (RAM) 2201 and / or cache memory 2202, and may further include read-only memory (ROM) 2203.
[0123] Storage unit 220 may also include a program / utility 2204 having a set (at least one) program module 2205, such program module 2205 including but not limited to: operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0124] Bus 230 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0125] Electronic device 200 can also communicate with one or more external devices 300 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 200, and / or with any device that enables electronic device 200 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 250. Furthermore, electronic device 200 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 260. Network adapter 260 can communicate with other modules of electronic device 200 via bus 230. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0126] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. The technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the methods described above according to the embodiments of this application.
[0127] Software products may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: electrical connections with one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0128] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable storage medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0129] Program code for performing the operations of this application can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0130] The aforementioned computer-readable medium carries one or more programs, which, when executed by a device, cause the computer-readable medium to perform the aforementioned functions.
[0131] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified accordingly and placed in one or more devices that are unique to this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0132] According to an embodiment of this application, a computer program is proposed, including a computer program or instructions, which, when executed by a processor, can perform the methods described above.
[0133] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. Furthermore, any changes or modifications made by those skilled in the art based on the ideas of this application, and on the specific implementation methods and application scope of this application, are all within the scope of protection of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
[0134] Those skilled in the art will understand that the above modules can be distributed in the device as described in the embodiments, or they can be modified accordingly and placed in one or more devices that are unique to this embodiment. The modules in the above embodiments can be combined into one module, or they can be further divided into multiple sub-modules.
[0135] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this application. Furthermore, any changes or modifications made by those skilled in the art based on the ideas of this application, and on the specific implementation methods and application scope of this application, are all within the scope of protection of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method of generating a three-dimensional virtual scene, characterized by, The method comprises: generating entity node data of a three-dimensional scene according to a three-dimensional model of a real scene, wherein the entity node data comprises axis-aligned bounding box data of an entity node in a local coordinate system; constructing a plurality of single scene graphs using the entity node data; constructing a comprehensive scene graph using the plurality of single scene graphs; calculating a multi-detail level value of the entity node in the comprehensive scene graph; generating the three-dimensional virtual scene using the axis-aligned bounding box data, the multi-detail level value, and the comprehensive scene graph; wherein the entity node data further comprises a globally unique identifier of the entity node, and the method of generating entity node data of a three-dimensional scene according to a three-dimensional model of a real scene comprises: calculating a geographical quadtree tile identifier corresponding to the entity node; generating the globally unique identifier by an MD hash algorithm using a hardware unique identifier of a network adapter, current calendar information, a current performance counter value, a current incremental counter value, and the geographical quadtree tile identifier; generating the three-dimensional virtual scene using the axis-aligned bounding box data, the multi-detail level value, and the comprehensive scene graph comprises: determining an entity position of the entity node in the comprehensive scene graph using the axis-aligned bounding box data and the multi-detail level value; loading the comprehensive scene graph according to the entity position to generate the three-dimensional virtual scene.
2. The method of claim 1, wherein, Before calculating the multi-detail level value of the entity node in the comprehensive scene graph, the method further comprises: constructing a sparse octree data structure using the entity node, wherein each octree node of the sparse octree data structure comprises axis-aligned bounding box data, a center point position, a current node depth, and a maximum depth value of the entity node.
3. The method of claim 2, wherein, Constructing a sparse octree data structure using the entity node comprises: dividing a three-dimensional space of the entity node by a recursive octant division method so that the entity node comprises at most 8 child nodes; traversing all child nodes of the entity node to construct the sparse octree data structure.
4. The method of claim 3, wherein, Calculating the multi-detail level value of the entity node in the comprehensive scene graph comprises: determining a list of entity nodes displayed in the comprehensive scene graph according to a camera frustum; calculating the multi-detail level value of each entity node in the list of entity nodes in turn.
5. The method of claim 4, wherein, Further comprising: determining a preloaded entity node list according to a current position of a camera; preloading corresponding entity nodes according to the preloaded entity node list.
6. The method of claim 1, wherein, Further comprising: updating a list of entity nodes in the comprehensive scene graph according to a current position of a camera to obtain an updated entity node list; calculating the multi-detail level value of each entity node in the updated entity node list in turn; rendering the comprehensive scene graph using the multi-detail level value of each entity node in the updated entity node list and the axis-aligned bounding box data to generate an updated three-dimensional virtual scene.
7. The method of claim 1, wherein, The method of generating the three-dimensional virtual scene by loading the comprehensive scene graph according to the entity position comprises: detecting whether there is an entity node conflict of the entity node in different single scene graphs using the globally unique identifier; In a case where the entity node exists in different single-scene graphs and there is a conflict of the entity node, whether the entity node is displayed in each single-scene graph is determined according to a display priority of the entity node in different single-scene graphs.
8. An apparatus for generating a three-dimensional virtual scene, the apparatus comprising: The apparatus is configured to perform the method of any one of claims 1-7, and the apparatus comprises: An entity node data generation unit configured to generate entity node data of a three-dimensional scene according to a three-dimensional model of a real scene, wherein the entity node data comprises axis-aligned bounding box data of an entity node in a local coordinate system; A single-scene graph construction unit configured to construct a plurality of single-scene graphs using the entity node data; An integrated scene graph construction unit configured to construct an integrated scene graph using the plurality of single-scene graphs; A multi-detail level value calculation unit configured to calculate a multi-detail level value of the entity node in the integrated scene graph; A three-dimensional virtual scene generation unit configured to generate the three-dimensional virtual scene using the axis-aligned bounding box data, the multi-detail level value, and the integrated scene graph.
9. An electronic device, comprising: comprise: a processor; a memory configured to store a computer program; when the computer program is executed by the processor, the computer program causes the processor to implement the method of any one of claims 1-7.
10. A non-transitory computer-readable storage medium having computer-readable instructions stored thereon, when the instructions are executed by a processor, the instructions cause the processor to perform the method of any one of claims 1-7.
Citation Information
Patent Citations
Three-dimensional scene generation method and device, electronic equipment and storage medium
CN117333618A
Lightweight model simplification method for railway four-electricity BIM three-dimensional model
CN117934682A