Method and system for visualizing points of interest in three-dimensional scene
By generating hierarchical instantiation of static mesh in a three-dimensional scene and rendering it uniformly, the rendering delay problem caused by too many static mesh instances is solved, the rendering efficiency is improved, and a smoother three-dimensional scene display is achieved.
Patent Information
- Application Number
- CN202310505368.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-06
- Publication Date
- 2024-11-08
AI Technical Summary
In a three-dimensional scene, the generation of a large number of static mesh instances with the same LOD leads to a sharp increase in the number of DrawCalls, resulting in rendering delays and program logic delays, causing scene stuttering.
By generating hierarchical instantiation static mesh, uniformly rendering a large number of instantiated mesh, reducing the number of DrawCalls, and creating transformations and positions based on POI point information in a three-dimensional scene to improve rendering efficiency.
Reduces POI rendering delay, improves drawing efficiency and picture performance, and avoids scene lag.
Smart Images

Figure CN118918240A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of computer graphics, and more specifically, to a method and system for visualizing points of interest (POI) in a three-dimensional scene. Background Art
[0002] Adding POI (point of interest) visualization to the digital twin city can show the city information more intuitively. However, when a large number of models with the same LOD (multiple levels of detail) and the same model resources are placed in the program, a large number of instances of the StaticMeshActor class are actually generated in the engine. Each SMActor (static mesh) calculates the model, material, coordinates and Transform separately, and each SMActor calls DrawCall separately to render itself. Therefore, when a large number of SMActors are generated in the scene, the number of DrawCalls increases sharply, resulting in an increase in rendering delay. If each SMActor also has to tick (refresh once per frame, usually 60 times per second) to update the Transform and coordinates separately, the program logic delay will also increase. The above two major delays will cause the three-dimensional scene to become extremely stuck. Summary of the invention
[0003] The present disclosure provides a method and system for data parsing, as well as an electronic device and a computer-readable storage medium, to at least solve the problems in the above-mentioned related technologies, or may not solve any of the above-mentioned problems.
[0004] According to a first aspect of an embodiment of the present disclosure, a method for visualizing a POI in a three-dimensional scene is provided, and the method may include: acquiring POI point information; generating a hierarchical instantiated static mesh corresponding to the POI point information in the three-dimensional scene; based on the hierarchical instantiated static mesh, and under the condition that a first preset condition is satisfied, causing POI-related information corresponding to the POI point information to be displayed in the three-dimensional scene at a position indicated by the POI point information.
[0005] Optionally, after generating a hierarchical instantiated static mesh corresponding to the POI location information, the method may further include: creating a transformation for the hierarchical instantiated static mesh.
[0006] Optionally, creating a transformation for the hierarchical instantiated static mesh may include: adding a position and a scale for the hierarchical instantiated static mesh.
[0007] Optionally, the acquiring of POI point information may include: acquiring a path of a file storing the POI point information; reading the POI point information according to the path, and converting the POI point information into three-dimensional scene coordinates.
[0008] Optionally, converting the POI point information into three-dimensional scene coordinates may include: converting the latitude and longitude coordinates of the POI point information into coordinates in the three-dimensional scene; taking the coordinates in the three-dimensional scene as the starting point, creating a ray along the Z coordinate axis direction of the three-dimensional scene; detecting whether a preset collision occurs between the ray and an object in the three-dimensional scene; if the preset collision occurs, setting the coordinates of a position at a preset distance from the collision point along the Z coordinate axis direction as the three-dimensional scene coordinates.
[0009] Optionally, generating a hierarchical instantiated static mesh corresponding to the POI point information in a three-dimensional scene may include: adding a model and a material to the hierarchical instantiated static mesh so that the hierarchical instantiated static mesh is generated at a position corresponding to the POI point information in the three-dimensional scene.
[0010] Optionally, the method may further include: hiding the displayed POI related information corresponding to the POI point information when a second preset condition is met.
[0011] According to a second aspect of an embodiment of the present disclosure, a system for visualizing points of interest (POI) in a three-dimensional scene is provided, and the system may include: a POI acquisition module, configured to acquire POI point information; a mesh module, configured to generate a hierarchical instantiated static mesh corresponding to the POI point information in the three-dimensional scene; and an information display module, configured to display POI-related information corresponding to the POI point information at a position indicated by the POI point information in the three-dimensional scene based on the hierarchical instantiated static mesh and when a first preset condition is met.
[0012] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, which may include: at least one processor; at least one memory storing computer-executable instructions, wherein the computer-executable instructions, when executed by at least one of the processors, prompt at least one of the processors to execute a method for visualizing points of interest (POI) in the three-dimensional scene.
[0013] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium storing instructions is provided, characterized in that when the instructions are executed by at least one processor, at least one of the processors is prompted to execute a method for visualizing points of interest (POI) in the three-dimensional scene.
[0014] According to an embodiment of the present disclosure, by generating a hierarchical instantiated static mesh corresponding to POI point information in a three-dimensional scene, POI-related information corresponding to the POI point information is displayed in the three-dimensional scene at the position indicated by the POI point information based on the hierarchical instantiated static mesh, thereby reducing POI rendering delay and improving drawing efficiency and picture performance.
[0015] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 is a flowchart illustrating a method for visualizing POIs in a three-dimensional scene according to an example embodiment of the present disclosure;
[0017] Figure 2 is a diagram showing an example method of obtaining a path of a file storing POI point information according to an example embodiment of the present disclosure;
[0018] Figure 3 is a diagram showing an example data format of a file storing POI point information according to an example embodiment of the present disclosure;
[0019] Figure 4 is an example flow chart illustrating generating a hierarchical instantiated static mesh according to an example embodiment of the present disclosure;
[0020] Figure 5 is an exemplary diagram showing that POI related information is displayed in a three-dimensional scene according to an exemplary embodiment of the present disclosure;
[0021] Figure 6 is a schematic block diagram showing a system for visualizing points of interest (POI) in a three-dimensional scene according to an example embodiment of the present disclosure; and
[0022] Figure 7 is a schematic block diagram illustrating an electronic device according to an example embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The implementation methods described in the following examples do not represent all implementation methods consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the attached claims.
[0025] It should be noted that “at least one of the several items” appearing in the present disclosure refers to three types of parallel situations: “any one of the several items”, “a combination of any multiple of the several items”, and “all of the several items”. For example, “including at least one of A and B” includes the following three parallel situations: (1) including A; (2) including B; (3) including A and B. Another example is “executing at least one of step one and step two”, which means the following three parallel situations: (1) executing step one; (2) executing step two; (3) executing step one and step two. “A and / or B” and “A and / or B” appearing in the present disclosure refer to the following three parallel situations: only A; only B; both A and B.
[0026] In previous data visualization projects based on UE4 (Unreal Engine 4), the method of generating 3DUI (user interface) objects in the scene is often used to display data. However, when the amount of data is huge, the drawing efficiency and picture performance will inevitably decrease, and the scene will become very stuck.
[0027] According to the embodiments of the present disclosure, the HierarchicalInstancedStaticMesh Component method can be used to draw POI points. The HierarchicalInstancedStaticMesh Component will load a large number of generated InstanceMesh (instantiated meshes) into a model array, and then use a unified material to perform a one-time overall rendering, and the DrawCall (draw call) is only executed once. Compared with the frequently used method of traversing coordinates to generate 3DUI (user interface) objects, this greatly improves the drawing efficiency and achieves the purpose of reducing rendering delay and improving screen performance.
[0028] Figure 1 is a flowchart illustrating a method for visualizing a POI in a three-dimensional scene according to an example embodiment of the present disclosure.
[0029] In step 110, the POI location information may be obtained. Specifically, the path of the file storing the POI location information may be obtained first. As an example, the path of the JSON file storing the POI location information may be obtained.
[0030] Figure 2 is a diagram illustrating an example method of obtaining a path of a file storing POI point information according to an example embodiment of the present disclosure.
[0031] You can use the GetGameConfigDir function to get the path of the project configuration folder, and use the ConvertRelativePathToFull function to get the absolute path of the project configuration folder D: / UE4_Project / Lib_4_27 / Config / . Open the properties of the JSON file, such as Figure 2 As shown, select the path after "Config / " to copy, and then use the Append function to add the name string of the JSON file to the absolute path of the project configuration folder. This will get the path of the JSON file that stores the POI point information.
[0032] However, those skilled in the art should understand that the format of the file storing the POI location information is not limited thereto, and may be, for example, a file in an XML file, a CSV file, a YAML file, an Excel file, or the like.
[0033] After obtaining the path of the file storing the POI point information, the POI point information can be read according to the path and converted into three-dimensional scene coordinates. The most critical data of the POI point information mainly includes coordinates.
[0034] Figure 3 is a diagram showing an example data format of a file storing POI point information according to an example embodiment of the present disclosure.
[0035] As an example, when the file storing POI location information is a JSON file, the format of the POI location information is as follows: Figure 3As shown, you can use the LoadJsonStringFrom File function of the JSONForUE4 plugin to parse the JSON file. Use the TryGetJsonObjectArray Field function to get an array named Features. Each array element contains the data of a POI point, and traverse each element in the array. Use the TryGet NumberField function to parse out the data of the field named "id" and set it as a variable; since the "coordinates" field is contained in the "geometry" field and the "name" field is contained in the "properties" field, you must first use the TryGetObjectField function to parse out the data of the field names "geometry" and "properties" respectively, and then use the TryGetStringField function and the TryGetNumberArrayField function to parse out the data of the field names "name" and "coordinates" respectively and set the content of the "name" field as a variable.
[0036] However, since the parsed "coordinates" data are the longitude and latitude coordinates of the POI point information, it is also necessary to convert the longitude and latitude coordinates of the POI point information into coordinates in the three-dimensional scene. For example, it can be converted into three-dimensional scene coordinates through the Inaccurate TransformLongitudeLatitudeHeightToUnreal function (inaccurate longitude and latitude height conversion to Unreal Engine function) of the CesiumForUnreal plug-in (Cesium plug-in in the Unreal Engine).
[0037] In order to ensure that the drawn POI points are not lower than the ground or too high above the ground, each POI point needs to be higher than the corresponding ground by a certain height. The main method is: taking the coordinates in the three-dimensional scene as the starting point, creating a ray along the Z coordinate axis direction of the three-dimensional scene; detecting whether a preset collision occurs between the ray and an object in the three-dimensional scene; if the preset collision occurs, setting the coordinates of the position at a preset distance from the collision point along the Z coordinate axis direction as the three-dimensional scene coordinates. For example, you can use the LineTraceForObjects function to create two vectors, vector1 and vector2, and assign the X and Y values of the converted coordinates in the three-dimensional scene to the X and Y of the two vectors respectively. In order to make the ray long enough, the Z value of vector1 can be set to 10000000, the Z value of vector2 can be set to -10000000, and the type of collision object detected is set to the collision type of the ground. If a collision occurs with an object in the three-dimensional scene during the ray process and the type of collision is consistent with the type of collision object detected, the structure data of the relevant hit result will be output. The location data in the hit result indicates the position of the collision point between the ray and the ground. Add 10 unit values to the Z direction vector of the location, and do not change the X and Y direction vectors. Get the new vector and set it to the "coordinates" variable. This ensures that each POI point will be generated at a position 10 unit values above the ground. Subsequently, you can create a new structure array containing "id", "coordinates" and "name", and add the "id", "coordinates" and "name" variables to the structure array for subsequent use.
[0038] In step 120 , a hierarchical instantiated static mesh corresponding to the POI location information may be generated in the three-dimensional scene.
[0039] Figure 4 is an example flow chart illustrating the generation of a hierarchical instantiated static mesh according to an example embodiment of the present disclosure.
[0040] like Figure 4As shown, a new blueprint inherited from Actor can be created, a HierarchicalInstancedStaticMesh can be added, the collision object type of the component can be set to WorldDynamic, and the static mesh model and material can be set for the component. After generating a hierarchical instantiated static mesh corresponding to the POI point information, a transformation can also be created for the hierarchical instantiated static mesh. Specifically, the coordinates in the structure array can be traversed to add a position and scale to the hierarchical instantiated static mesh, so that the hierarchical instantiated static mesh is generated at the corresponding position in the three-dimensional scene space.
[0041] According to an example embodiment of the present disclosure, the size of a hierarchical instantiated static mesh can be changed in real time. For example, a CurrentCameraLocation vector parameter can be set with the camera position, and the Tick event can be enabled to obtain the camera position in real time. If the real-time camera position is not equal to the CurrentCameraLocation set at runtime, the value of the real-time camera position is assigned to the CurrentCameraLocation, and the scale value is calculated based on the changed CurrentCameraLocation, the camera range 2D vector constant, and the volume range 2D vector constant; use the Update InstanceTransform function, enter the new scale value, do not change the Location and Rotation, and create a new transformation for each hierarchical instantiated static mesh.
[0042] In step 130, a static mesh may be instantiated based on the hierarchy, and POI-related information corresponding to the POI point information may be displayed in a three-dimensional scene at a location indicated by the POI point information when a first preset condition is satisfied. The first preset condition may be a query for, for example, a collision of a mouse pointer or a touch input at the location indicated by the POI point information.
[0043] Figure 5 is an exemplary diagram showing that POI-related information is displayed in a three-dimensional scene according to an exemplary embodiment of the present disclosure.
[0044] For example, you can perform a collision query under the mouse pointer, and the search object type can be set to dynamic scene (because the collision object type of the hierarchical instantiated static mesh component is WorldDynamic). If a collision occurs, a 3DUI (user interface) with POI related information is generated. The scene is like Figure 5 shown.
[0045] In addition, if the second preset condition is met, the displayed POI related information corresponding to the POI point information can be hidden. For example, an event dispatcher can be created in the user control interface, and an event can be bound in the object using the control component. Figure 5 The event is called when the button is clicked (the background of the sign overlaps, but the background of the button is transparent) to destroy the corresponding object. The second preset condition can be that when the user clicks the sign in the three-dimensional scene, the corresponding POI related information will be hidden.
[0046] Figure 6 is a schematic block diagram showing a system 600 for visualizing points of interest (POI) in a three-dimensional scene according to an example embodiment of the present disclosure.
[0047] The system 600 may include a POI acquisition module 610, a grid module 620, and an information display module 630. The system 600 may be installed in various electronic devices to realize POI visualization, or various modules in the system 600 may realize corresponding functions in a separate manner, or the system 600 may be distributed online or in the cloud for users to use.
[0048] According to an example embodiment of the present disclosure, the POI acquisition module 610 may be configured to acquire POI point information. The mesh module 620 may be configured to generate a hierarchical instantiation static mesh corresponding to the POI point information in a three-dimensional scene. The information display module 630 may be configured to, based on the hierarchical instantiation static mesh, enable the POI related information corresponding to the POI point information to be displayed at the position indicated by the POI point information in the three-dimensional scene when a first preset condition is met.
[0049] According to an example embodiment of the present disclosure, mesh module 620 may also be configured to create a transform for the hierarchical instantiated static mesh.
[0050] According to an example embodiment of the present disclosure, mesh module 620 may be configured to add position and scale for the hierarchical instantiated static mesh.
[0051] According to an example embodiment of the present disclosure, the POI acquisition module 610 may be configured to acquire the path of a file storing the POI point information; read the POI point information according to the path, and convert the POI point information into three-dimensional scene coordinates.
[0052] According to an example embodiment of the present disclosure, the POI acquisition module 610 may be configured to: convert the latitude and longitude coordinates of the POI point information into coordinates in a three-dimensional scene; create a ray along the Z coordinate axis direction of the three-dimensional scene with the coordinates in the three-dimensional scene as the starting point; detect whether a preset collision occurs between the ray and an object in the three-dimensional scene; if the preset collision occurs, set the coordinates of a position at a preset distance from the collision point along the Z coordinate axis direction as the three-dimensional scene coordinates.
[0053] According to an example embodiment of the present disclosure, the mesh module 620 may be configured to add a model and a material to the hierarchical instantiated static mesh so that the hierarchical instantiated static mesh is generated at a position corresponding to the POI point information in the three-dimensional scene.
[0054] According to an exemplary embodiment of the present disclosure, the information display module 630 may be further configured to hide the displayed POI related information corresponding to the POI location information when a second preset condition is met.
[0055] Various modules according to example embodiments of the present disclosure may be integrated into a single module that performs its functions, or at least one of the various modules may be divided into a plurality of smaller modules.
[0056] Figure 7 is a schematic block diagram illustrating an electronic device 700 according to an example embodiment of the present disclosure.
[0057] According to an exemplary embodiment of the present disclosure, an electronic device 700 may also be provided, and the electronic device 700 may include a processor 710 and a memory 720 storing computer executable instructions. When the computer executable instructions are executed by the processor 710, the processor 710 is prompted to perform the above-mentioned method for visualizing points of interest (POI) in a three-dimensional scene according to an exemplary embodiment of the present disclosure.
[0058] According to an embodiment of the present disclosure, a computer-readable storage medium storing instructions may also be provided, wherein when the instructions are executed by at least one processor, the at least one processor is prompted to perform a method according to an exemplary embodiment of the present disclosure. Examples of computer-readable storage media include: read-only memory (ROM), random access programmable read-only memory (PROM), electrically erasable programmable read-only memory (EEPROM), random access memory (RAM), dynamic random access memory (DRAM), static random access memory (SRAM), flash memory, non-volatile memory, CD-ROM, CD-R, CD+R, CD-RW, CD+RW, DVD-ROM, DVD-R, DVD+R, DVD-RW, DVD+RW, DVD-RAM, BD-ROM, BD-R, BD-R, BD-RW, etc. , BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as, multimedia card, secure digital (SD) card or extreme digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device, any other device is configured to store computer programs and any associated data, data files and data structures in a non-transitory manner and provide the computer programs and any associated data, data files and data structures to a processor or computer so that the processor or computer can execute the computer program. The computer program in the above-mentioned computer-readable storage medium can be run in an environment deployed in a computer device such as a client, a host, an agent device, a server, etc. In addition, in one example, the computer program and any associated data, data files and data structures are distributed on a networked computer system, so that the computer program and any associated data, data files and data structures are stored, accessed and executed in a distributed manner by one or more processors or computers.
[0059] According to an embodiment of the present disclosure, a computer program product may also be provided. Instructions in the computer program product may be executed by at least one processor in an electronic device to perform the method according to the exemplary embodiment of the present disclosure.
[0060] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses or adaptations of the present disclosure, which follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0061] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the claims.
Claims
1. A method for visualizing points of interest (POI) in a three-dimensional scene, including: Get POI point information; Generating a hierarchical instantiation static mesh corresponding to the POI point information in a three-dimensional scene; Based on the hierarchical instantiation of the static mesh, when a first preset condition is met, the POI-related information corresponding to the POI point information is displayed at the position indicated by the POI point information in the three-dimensional scene.
2. The method according to claim 1, after generating a hierarchical instantiation static mesh corresponding to the POI location information, the method further comprises: Creates a transform for the instanced Static Mesh at that level.
3. The method of claim 2, wherein: The creating a transform for the instanced Static Mesh of the hierarchy includes: Add position and scale for the instanced Static Meshes in this hierarchy.
4. The method of claim 1, wherein: The obtaining of POI location information includes: Get the path of the file storing the POI point information; The POI point information is read according to the path, and the POI point information is converted into three-dimensional scene coordinates.
5. The method of claim 4, wherein: The step of converting the POI point information into three-dimensional scene coordinates includes: Convert the longitude and latitude coordinates of the POI point information into coordinates in a three-dimensional scene; Taking the coordinates in the three-dimensional scene as a starting point, creating a ray along the Z coordinate axis direction of the three-dimensional scene; Detecting whether a preset collision occurs between the ray and an object in the three-dimensional scene; If the preset collision occurs, the coordinates of a position at a preset distance from the collision point along the Z coordinate axis direction are set as the three-dimensional scene coordinates.
6. The method of claim 1, wherein: The step of generating a hierarchical instantiated static mesh corresponding to the POI point information in a three-dimensional scene includes: A model and a material are added to the hierarchical instantiated static mesh so that the hierarchical instantiated static mesh is generated at a position corresponding to the POI point information in the three-dimensional scene.
7. The method of claim 1, further comprising: When the second preset condition is met, the displayed POI related information corresponding to the POI point information is hidden.
8. Point of interest (POI) visualization system in three-dimensional scene, including: A POI acquisition module is configured to acquire POI location information; A mesh module is configured to generate a hierarchical instantiation static mesh corresponding to the POI point information in a three-dimensional scene; The information display module is configured to instantiate a static mesh based on the hierarchy, and when a first preset condition is met, display POI-related information corresponding to the POI point information at a position indicated by the POI point information in a three-dimensional scene.
9. Electronic equipment, including: at least one processor; at least one memory storing computer executable instructions, Wherein, when the computer executable instructions are executed by at least one of the processors, the at least one processor is prompted to perform the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium storing instructions, characterized in that: When the instructions are executed by at least one processor, the at least one processor is prompted to perform the method according to any one of claims 1 to 7.
