CN117274530A - Three-dimensional model rendering method, device and equipment of target object and storage medium - Google Patents

Three-dimensional model rendering method, device and equipment of target object and storage medium Download PDF

Info

Publication number
CN117274530A
CN117274530A CN202311217067.6A CN202311217067A CN117274530A CN 117274530 A CN117274530 A CN 117274530A CN 202311217067 A CN202311217067 A CN 202311217067A CN 117274530 A CN117274530 A CN 117274530A
Authority
CN
China
Prior art keywords
model
current
data
rendering
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311217067.6A
Other languages
Chinese (zh)
Inventor
李炬宏
陈奇毅
刘弘胤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PCI Technology Group Co Ltd
Original Assignee
PCI Technology Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PCI Technology Group Co Ltd filed Critical PCI Technology Group Co Ltd
Priority to CN202311217067.6A priority Critical patent/CN117274530A/en
Publication of CN117274530A publication Critical patent/CN117274530A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/20Finite element generation, e.g. wire-frame surface description, tesselation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/04Texture mapping

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Image Generation (AREA)

Abstract

The invention discloses a three-dimensional model rendering method, a device, equipment and a storage medium of a target object, wherein the method comprises the following steps: obtaining a model data file path of a current root node of a current level of the three-dimensional model from the loaded scene description file; invoking the sub-thread to load a model data file according to the model data file path and analyze the model data file to obtain current model grid data and target mapping textures of a current root node of the three-dimensional model; and rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object and displaying the three-dimensional model. The invention can realize multithread collaborative loading and analysis of data (model rendering data) required by rendering the three-dimensional model of the target object, complete the three-dimensional model rendering of the target object according to the model rendering data, effectively improve the three-dimensional model rendering efficiency and speed of the target object, and greatly save equipment resources and time cost required by loading and analyzing all root nodes.

Description

Three-dimensional model rendering method, device and equipment of target object and storage medium
Technical Field
Embodiments of the present invention relate to computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for rendering a three-dimensional model of a target object.
Background
At present, when the three-dimensional model is rendered, the loading model data file is a 3D files or I3S files which are pushed out by using Cesium. 3D Tiles are data formats developed for streaming and rendering three-dimensional geospatial data, such as photogrammetry, three-dimensional architecture, BIM/CAD, instantiation elements, point clouds, etc.; I3S is a data format that organizes a large volume of three-dimensional data with a tree structure.
The 3D Tiles are designed by separating node trees from model data files, all the node tree files are loaded to a memory during loading, then the node trees are traversed according to the view of the current camera, nodes needing to be displayed are found, and then node model resource files are loaded for display. The I3S adopts a design that packages and compresses all nodes and resources into one file.
For 3D Tiles, when the rendering area of a three-dimensional model of a target object is large, a model node tree is huge, time and cost for loading and traversing the model node tree are large, so that the three-dimensional model rendering is in a clamping condition, and the loading efficiency of a model data file is greatly influenced; for I3S, when the rendering area of the three-dimensional model is large, the model data file is too large, the probability of success of loading the model data file is extremely small, and the rendering failure probability of the three-dimensional model of the target object is high.
Disclosure of Invention
The embodiment of the invention provides a three-dimensional model rendering method, device, equipment and storage medium for a target object, which realize multithreading collaborative loading and analysis of data (model rendering data) required by rendering a three-dimensional model of the target object, complete the three-dimensional model rendering of the target object according to the model rendering data, effectively improve the three-dimensional model rendering efficiency and speed of the target object, and greatly save equipment resources and time cost required by loading and analyzing all root nodes.
In a first aspect, an embodiment of the present invention provides a three-dimensional model rendering method of a target object, where the method includes:
when the three-dimensional model rendering instruction is received, loading a scene description file of the three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file;
invoking a sub-thread to load the model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target mapping textures of the current model grid data;
And acquiring the current model grid data and the target map texture from the sub-thread, rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
In a second aspect, an embodiment of the present invention provides a three-dimensional model rendering apparatus for a target object, the apparatus including:
the path acquisition module is used for loading a scene description file of the three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file when receiving the three-dimensional model rendering instruction;
the sub-thread calling module is used for calling a sub-thread to load the model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target mapping textures of the current model grid data;
and the model rendering module is used for acquiring the current model grid data and the target map texture from the sub-thread, rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements the three-dimensional model rendering method of the target object according to any one of the embodiments of the present invention when the processor executes the program.
In a fourth aspect, embodiments of the present invention further provide a computer-readable storage medium having stored thereon a computer program that, when executed by a processor, implements a three-dimensional model rendering method of a target object according to any of the embodiments of the present invention.
In the embodiment of the invention, when a three-dimensional model rendering instruction is received, a scene description file of a three-dimensional model is loaded, a model data file path of a current root node of a current level of the three-dimensional model is obtained from the scene description file, which is equivalent to that of a main thread, the model data file path of the current root node of the current level of the three-dimensional model is obtained from the loaded scene description file, then the main thread calls a sub-thread to load the model data file according to the model data file path and analyze the model data file, current model grid data of the current root node of the three-dimensional model and target map texture of the current model grid data are obtained, finally the main thread obtains the current model grid data and the target map texture from the sub-thread, the three-dimensional model of a target object is obtained by utilizing rendering software to render the target map texture for the current model grid data, and the three-dimensional model is displayed, the three-dimensional data (model rendering data) required by multi-thread collaborative loading and the three-dimensional model of the target object is realized, the main thread finishes the three-dimensional model rendering of the target object according to the current model grid data and the target map texture, the purpose of fully calling the processing capacity of a multi-core central processor is achieved, the three-dimensional model efficiency and the three-dimensional model rendering efficiency of the target object is effectively improved, the consumption of the target object is avoided, the three-dimensional model is greatly, the problem of the rendering model is greatly caused when the three-dimensional model is greatly loaded by the model is greatly; in addition, as only the model data file of the current root node of the current level is needed to be loaded and analyzed by each invoking sub-thread, the current model grid data of the current root node of the three-dimensional model and the target mapping texture of the current model grid data are obtained, the model data files of all root nodes of all levels do not need to be loaded and analyzed at one time, equipment resources and time cost needed by loading and analyzing all root nodes are greatly saved, the problem that when the rendering area of the three-dimensional model of the target object is large for I3S, the probability of success of loading the model data file of the three-dimensional model is extremely small, the problem that the rendering failure probability of the three-dimensional model of the target object is large is solved, and the probability of success of rendering the three-dimensional model of the target object is increased.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart of a three-dimensional model rendering method of a target object according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a node tree provided by an embodiment of the present invention;
FIG. 3 is another flow chart of a method for rendering a three-dimensional model of a target object according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a three-dimensional model rendering device for a target object according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Fig. 1 is a schematic flow chart of a three-dimensional model rendering method of a target object according to an embodiment of the present invention, where the method may be performed by a three-dimensional model rendering device of a target object according to an embodiment of the present invention, and the device may be implemented in software and/or hardware. In a specific embodiment, the apparatus may be integrated in an electronic device, which may be a computer or a server, for example. The following embodiments will be described taking the example of the integration of the apparatus in an electronic device, and referring to fig. 1, the method may specifically include the following steps:
step 101, when a three-dimensional model rendering instruction is received, loading a scene description file of the three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file.
The three-dimensional model of the target object can be understood as an oblique photography model of the target object, and oblique photography is a high-new technology in the field of international photogrammetry, and the technology acquires rich high-resolution textures of the top surface and side view of a building by synchronously acquiring influences from one vertical, four oblique and five different visual angles, and can generate a real three-dimensional city model through positioning, fusion, modeling and other technologies; the scene description file may be understood as basic scene information describing a three-dimensional model of the target object, the scene description file may include a model data file name of the target object, a storage path of the model data file of the target object, and a version of the model data file, and a format of the scene description file may be a JS object numbered musical notation format (JavaScript Object Notation, JSON), which is a lightweight data exchange format. Wherein the model data file of the target object may include model rendering data of the target object, which may be understood as data required when rendering a model of the target object using rendering software, which may include model mesh data of the target object and a target map texture corresponding to the model mesh data, which may be understood as a tilted photography model of the target object without rendering the target map texture, which may be understood as a texture map of the target object, since the model data file includes a plurality of model mesh data of different resolutions, in order to facilitate storing the model data file of the target object, when storing the model data file of the target object, the model grid data with different resolutions may be stored according to a multi-level node tree structure storage mode, that is, as shown in fig. 2, the model grid data corresponding to different resolutions are stored to different nodes in the node tree, the resolution of the model grid data on each node is different, for example, the resolution of the model grid data corresponding to the node a of level 1 is 40pixels, and the resolution of the model grid data corresponding to the node B of level 2 is 80pixels.
Since the model data files are stored in a multi-level node tree structure storage manner, each level includes a root node of the level, and the model data file path may include a storage path of a model mesh data file of a respective root node of each level, in an alternative embodiment, a model data file path of a three-dimensional model may be obtained from the scene description file, and then a model data file path of a current root node of the current level may be determined according to the model data file path.
Specifically, the data file path of the root node which is the same as the current root node can be searched in the model data file path, so that the model data file path of the current root node of the current level is obtained.
For example, the current root node is a, the model data file path of the current root node a is S1, the model data file path of the three-dimensional model is S obtained from the scene description file W, and then the data file path of the same root node as the current root node a is searched in the model data file path S, so as to obtain the model data file path of the current root node of the current level as S1.
Step 102, calling a sub-thread to load a model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target map textures of the current model grid data.
When the three-dimensional model of the target object is rendered, only a single thread is adopted to complete the three-dimensional model rendering process of the target object, if the scene area of the three-dimensional model of the target object to be rendered is larger, node trees are huge, single thread loading and node tree traversing consume longer time, the loading and node tree traversing processes are only executed in one thread, the single thread is blocked, a program can be blocked, the model data file loading efficiency of the three-dimensional model of the target object is affected, and in order to solve the problem, the three-dimensional model rendering of the target object is completed by adopting multiple threads in the embodiment of the invention, namely, the three-dimensional model rendering of the target object is completed through the cooperation of a main thread and a sub thread, and the main thread can be used for loading a scene description file of the target object and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file; then in an alternative implementation mode, the main thread can send a thread calling instruction to the sub-thread, the thread calling instruction can comprise a model data file path, when the sub-thread receives the thread calling instruction, the sub-thread can load a model data file according to the model data file path, and after the sub-thread loads the model data file, the sub-thread can analyze the model data file to obtain an initial mapping texture and current model grid data of a current root node of the three-dimensional model; the initial mapping texture can be understood as an undecoded mapping texture, and the initial mapping texture can be in the formats of jpg, png and the like; when rendering software renders the map texture for the model grid data, the required map texture format is bitmap (bitmap) format, and jpg, png and other formats are compressed by the bitmap format, so that the sub-threads need to decompress the initial map texture to obtain the target map texture of the current model grid data, the target map texture can be obtained by directly decompressing the initial map texture through the sub-threads, when the main thread utilizes the rendering software to render the target map texture for the current model grid data to obtain the three-dimensional model of the target object, the main thread does not need to understand and press the initial map texture to obtain the target map texture again, the time for the main thread to decompress the initial map texture is reduced, namely the time for processing the model rendering data by the main thread is reduced, and the rendering efficiency and the rendering speed of the three-dimensional model of the target object by the main thread according to the model rendering data (the current model grid data and the target map texture of the current model grid data) are improved.
Illustratively, the format of the initial map texture is jpg, and the main thread can send a thread call instruction to the sub-thread; when receiving a thread calling instruction, the sub-thread loads a model data file according to a model data file path; and the sub-thread analyzes the model data file to obtain the initial mapping texture and the current model grid data of the current root node of the three-dimensional model, and then the sub-thread decompresses the initial mapping texture in jpg format to obtain the target mapping texture in bitmap format of the current model grid data.
Optionally, the sub-thread may include a plurality of candidate threads, the main thread may send a thread call instruction to the sub-thread, the thread call instruction may include a model data file path, when the sub-thread receives the thread call instruction, the sub-thread may preferentially determine an idle candidate thread, load the model data file according to the model data file path by using the candidate thread, after the candidate thread is loaded to the model data file, the candidate thread may parse the model data file to obtain an initial texture and current model mesh data of a current root node of the three-dimensional model, the candidate thread decompresses the initial texture to obtain a target texture of the current model mesh data, and finally, the sub-thread obtains the current model mesh data and the target texture of the current model mesh data from the candidate thread, so that the target texture can be obtained by directly decompressing the initial texture by the idle candidate thread in the sub-thread, and the processing capability of the multi-core central processing unit is fully invoked, the main thread does not need to understand and decompress the initial texture to obtain the target texture, i.e. the time of processing the initial texture of the main thread is reduced, and the time of processing the model data by the main thread is reduced, and the rendering speed of the current model mesh data and the target rendering speed of the current model data and the target rendering speed of the target object rendering data is improved.
And step 103, acquiring current model grid data and target map textures from the sub-threads, rendering the target map textures for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
The rendering software may be Unity3D, the Unity3D is a cross-platform 3D model rendering engine, the Unity3D may render the map texture for the model mesh data to obtain a three-dimensional model, and then the three-dimensional model is displayed through a camera in the Unity 3D.
In an alternative embodiment, the current model mesh data and the target map texture are obtained from the sub-thread, the target map texture is rendered for the current model mesh data by using rendering software to obtain a three-dimensional model of the target object, and finally the three-dimensional model is displayed by using a camera in the rendering software.
For example, current model mesh data and target map textures are obtained from the sub-threads, the target map textures are rendered for the current model mesh data by using the Unity3D to obtain a three-dimensional model of the target object, and finally the three-dimensional model is displayed by using a camera in the Unity 3D.
In the embodiment of the invention, when a three-dimensional model rendering instruction is received, a scene description file of a three-dimensional model is loaded, a model data file path of a current root node of a current level of the three-dimensional model is obtained from the scene description file, which is equivalent to that of a main thread, the model data file path of the current root node of the current level of the three-dimensional model is obtained from the loaded scene description file, then the main thread calls a sub-thread to load the model data file according to the model data file path and analyze the model data file, current model grid data of the current root node of the three-dimensional model and target map texture of the current model grid data are obtained, finally the main thread obtains the current model grid data and the target map texture from the sub-thread, the three-dimensional model of a target object is obtained by utilizing rendering software to render the target map texture for the current model grid data, and the three-dimensional model is displayed, the three-dimensional data (model rendering data) required by multi-thread collaborative loading and the three-dimensional model of the target object is realized, the main thread finishes the three-dimensional model rendering of the target object according to the current model grid data and the target map texture, the purpose of fully calling the processing capacity of a multi-core central processor is achieved, the three-dimensional model efficiency and the three-dimensional model rendering efficiency of the target object is effectively improved, the consumption of the target object is avoided, the three-dimensional model is greatly, the problem of the rendering model is greatly caused when the three-dimensional model is greatly loaded by the model is greatly; in addition, as only the model data file of the current root node of the current level is needed to be loaded and analyzed by each invoking sub-thread, the current model grid data of the current root node of the three-dimensional model and the target mapping texture of the current model grid data are obtained, the model data files of all root nodes of all levels do not need to be loaded and analyzed at one time, equipment resources and time cost needed by loading and analyzing all root nodes are greatly saved, the problem that when the rendering area of the three-dimensional model of the target object is large for I3S, the probability of success of loading the model data file of the three-dimensional model is extremely small, the problem that the rendering failure probability of the three-dimensional model of the target object is large is solved, and the probability of success of rendering the three-dimensional model of the target object is increased.
The following further describes a three-dimensional model rendering method of a target object according to an embodiment of the present invention, as shown in fig. 3, fig. 3 is another flow chart of the three-dimensional model rendering method of a target object according to an embodiment of the present invention, which may specifically include the following steps:
step 201, when receiving a three-dimensional model rendering instruction, loading a scene description file of a three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file.
Step 202, calling the sub-thread to load the model data file according to the model data file path.
And 203, calling a sub-thread to analyze the model data file to obtain initial mapping textures, obtaining current model grid data of a current root node of the three-dimensional model, and decoding the initial mapping textures to obtain target mapping textures of the current model grid data.
Step 204, current model mesh data and target map textures are obtained from the sub-threads.
Step 205, determining whether the current resolution is greater than the maximum resolution of the camera of the rendering software, if so, executing step 206; if not, step 208 is performed.
The current resolution may be understood, among other things, as the camera resolution required to display the three-dimensional model of the target object.
In an alternative implementation mode, when the current resolution is larger than the maximum resolution of a camera of rendering software, the camera is not capable of displaying the three-dimensional model of the target object, the renderable attribute of the current model grid data can be determined to be nonrecurrable, when the renderable attribute of the current model grid data is nonrecurrable, a sub-thread can be called in time to delete the current model grid data of the current root node, occupation of memory resources is reduced, the memory is cleared in time, when the next sub-thread loads the model data file according to a model data file path and analyzes the model data file, the sub-thread is prevented from loading the nonrecurrable model grid data, the condition that additional data loading time cost is increased is caused, loading time of the sub-thread for loading the model data file is shortened, and the three-dimensional model rendering speed of the target object is further improved; when the current resolution is not greater than the maximum resolution of the camera of the rendering software, the camera can normally display the three-dimensional model of the target object, and then the renderable attribute of the grid data of the current model can be determined as renderable.
Step 206, determining the renderable attribute of the current model mesh data as being non-renderable.
Step 207, invoking the sub-thread to delete the current model mesh data of the current root node.
Step 208, determining the renderable attribute of the current model mesh data as renderable.
Step 209, determining whether the sub-level model data file is successfully loaded according to the sub-level model data file path, and if not, executing step 210; if yes, go to step 211.
In an alternative embodiment, if the sub-level model data file is successfully loaded, determining whether the maximum resolution of the camera meets the camera resolution requirement required by the camera to display the three-dimensional model range of the target object of the sub-level according to the sub-level model data file, that is, whether the resolution of the displayable range of the model mesh data of the root node of the sub-level is greater than the camera resolution required by the three-dimensional model of the target object of the sub-level, if the resolution of the displayable range of the model mesh data of the root node of the sub-level is greater than the camera resolution required by the three-dimensional model of the target object of the sub-level, for more clearly displaying the three-dimensional model with greater resolution of the target object, invoking the sub-thread to parse the model data file to obtain the sub-level model rendering data of the three-dimensional model, determining the sub-level model rendering data as the model rendering data of the current root node, and then rendering the target texture for the current model mesh data to obtain the three-dimensional model of the target object and display the three-dimensional model; if the resolution of the displayable range of the model mesh data of the root node of the sub-level is not greater than the camera resolution required for displaying the three-dimensional model of the target object of the sub-level, which means that the camera cannot display the three-dimensional model of the target object of the sub-level, the clearest three-dimensional model which can be displayed by the camera is the three-dimensional model of the target object of the current root node of the current level, the rendering software can be directly utilized to render the target map texture for the current model mesh data to obtain the three-dimensional model of the target object and display the three-dimensional model, so that the purpose of preferentially displaying the three-dimensional model of the target object of the root node of the topmost level with the highest resolution can be achieved without traversing the whole node tree of the three-dimensional model of the target object, and the three-dimensional model of the target object of a large range is suitable for rendering.
If the model data file of the sub-level is not successfully loaded, the model data file of the root node of the sub-level can be determined to be the model data file path of the current root node, then the sub-thread is called to load the model data file according to the new model data file path of the current root node until the model data file of the sub-level is successfully loaded, and then whether the three-dimensional model of the target object displayed by the camera is the three-dimensional model with the largest resolution is determined according to the model data file of the sub-level, so that the purpose of preferentially displaying the three-dimensional model of the target object of the root node of the topmost level with the largest resolution is realized, and the method is suitable for rendering the three-dimensional model of a large-scale target object.
At step 210, the model data file of the root node of the sub-hierarchy is determined as the model data file path of the current root node.
After executing step 210, execution returns to step 202.
Step 211, determining whether the resolution of the displayable range of the model mesh data of the root node of the sub-level is greater than the maximum resolution of the camera, if so, executing step 212; if not, step 213 is performed.
And 212, calling the sub-thread analysis model data file to obtain sub-level model rendering data of the three-dimensional model, and determining the sub-level model rendering data as the model rendering data of the current root node.
And step 213, rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object and displaying the three-dimensional model.
In the embodiment of the invention, when a three-dimensional model rendering instruction is received, a scene description file of a three-dimensional model is loaded, a model data file path of a current root node of a current level of the three-dimensional model is obtained from the scene description file, which is equivalent to that of a main thread, the model data file path of the current root node of the current level of the three-dimensional model is obtained from the loaded scene description file, then the main thread calls a sub-thread to load the model data file according to the model data file path and analyze the model data file, current model grid data of the current root node of the three-dimensional model and target map texture of the current model grid data are obtained, finally the main thread obtains the current model grid data and the target map texture from the sub-thread, the three-dimensional model of a target object is obtained by utilizing rendering software to render the target map texture for the current model grid data, and the three-dimensional model is displayed, the three-dimensional data (model rendering data) required by multi-thread collaborative loading and the three-dimensional model of the target object is realized, the main thread finishes the three-dimensional model rendering of the target object according to the current model grid data and the target map texture, the purpose of fully calling the processing capacity of a multi-core central processor is achieved, the three-dimensional model efficiency and the three-dimensional model rendering efficiency of the target object is effectively improved, the consumption of the target object is avoided, the three-dimensional model is greatly, the problem of the rendering model is greatly caused when the three-dimensional model is greatly loaded by the model is greatly; in addition, as only the model data file of the current root node of the current level is needed to be loaded and analyzed by each invoking sub-thread, the current model grid data of the current root node of the three-dimensional model and the target mapping texture of the current model grid data are obtained, the model data files of all root nodes of all levels do not need to be loaded and analyzed at one time, equipment resources and time cost needed by loading and analyzing all root nodes are greatly saved, the problem that when the rendering area of the three-dimensional model of the target object is large for I3S, the probability of success of loading the model data file of the three-dimensional model is extremely small, the problem that the rendering failure probability of the three-dimensional model of the target object is large is solved, and the probability of success of rendering the three-dimensional model of the target object is increased.
Fig. 4 is a schematic structural diagram of a three-dimensional model rendering device for a target object according to an embodiment of the present invention, where the device is adapted to execute the three-dimensional model rendering method for a target object according to an embodiment of the present invention. As shown in fig. 4, the apparatus may specifically include:
the path obtaining module 301 is configured to load a scene description file of the three-dimensional model and obtain a model data file path of a current root node of a current level of the three-dimensional model from the scene description file when receiving the three-dimensional model rendering instruction;
the sub-thread calling module 302 is configured to call a sub-thread to load the model data file according to the model data file path and parse the model data file to obtain model rendering data of a current root node of the three-dimensional model, where the model rendering data includes current model mesh data and a target map texture of the current model mesh data;
the model rendering module 303 is configured to obtain the current model mesh data and the target map texture from the sub-thread, render the target map texture for the current model mesh data by using rendering software to obtain a three-dimensional model of the target object, and display the three-dimensional model.
Optionally, the sub-thread calling module 302 calls a sub-thread to parse the model data file to obtain model rendering data of a current root node of the three-dimensional model, including:
and calling the sub-thread to analyze the model data file to obtain an initial mapping texture and current model grid data of a current root node of the three-dimensional model, and decoding the initial mapping texture to obtain a target mapping texture of the current model grid data.
Further, the model data file further includes a current resolution of a displayable range of the current model mesh data, and the apparatus further includes:
a rendering attribute determining module, configured to determine a renderable attribute of the current model mesh data according to the current resolution and a camera maximum resolution of the rendering software;
the trigger execution module is used for triggering and executing the operation of rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object and displaying the three-dimensional model when the renderable attribute is renderable;
and the data deleting module is used for calling the child thread to delete the current model grid data of the current root node when the renderable attribute is non-renderable.
Optionally, the rendering attribute determining module is specifically configured to:
determining that the renderable attribute of the current model mesh data is not renderable when the current resolution is greater than a camera maximum resolution of the rendering software;
and when the current resolution is not greater than the maximum resolution of the camera of the rendering software, determining that the renderable attribute of the current model grid data is renderable.
Further, the model data file further includes a model data file path of a sub-level of the current level, and the apparatus further includes:
a first determining module, configured to determine whether to successfully load the model data file of the sub-hierarchy according to the model data file path of the sub-hierarchy;
and the second determining module is used for determining whether to call a sub-thread to analyze the model data file according to the model data file of the sub-level to obtain model rendering data of the sub-level of the three-dimensional model when determining that the model data file of the sub-level is successfully loaded.
Optionally, the model data file of the sub-level includes a resolution of a displayable range of the model mesh data of the root node of the sub-level, a current model mesh data of the root node of the sub-level, and a target map texture of the current model mesh data of the root node of the sub-level, and the second determining module is specifically configured to:
And when the resolution of the displayable range of the model grid data of the root node of the sub-level is larger than the maximum resolution of the camera, invoking a sub-thread to analyze the model data file to obtain model rendering data of the sub-level of the three-dimensional model, and determining the model rendering data of the sub-level as the model rendering data of the current root node.
Optionally, the second determining module is further specifically configured to:
and when the resolution of the displayable range of the model grid data of the root node of the sub-level is not more than the maximum resolution of the camera, triggering and executing the operation of rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object and displaying the three-dimensional model.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above. The specific working process of the functional module described above may refer to the corresponding process in the foregoing method embodiment, and will not be described herein.
According to the device, when a three-dimensional model rendering instruction is received, a scene description file of a three-dimensional model is loaded, a model data file path of a current root node of a current level of the three-dimensional model is obtained from the scene description file, the model data file path of the current root node of the current level of the three-dimensional model is obtained from the loaded scene description file by a main thread, then the main thread calls a sub-thread to load the model data file according to the model data file path and analyze the model data file, current model grid data of the current root node of the three-dimensional model and target map texture of the current model grid data are obtained by the main thread, finally the current model grid data and the target map texture are obtained from the sub-thread, a three-dimensional model of a target object is obtained by using rendering software to render the target map texture for the current model grid data, and the three-dimensional model is displayed, the three-dimensional data (model data) required by multi-thread collaborative loading and the three-dimensional model rendering of the target object are realized, the three-dimensional model rendering of the target object is completed by the main thread according to the current model grid data and the target map texture, the purpose of fully calling the processing capacity of a multi-core central processor is achieved, the three-dimensional model is effectively improved, the problem that the three-dimensional model rendering efficiency and the three-dimensional model of the target object is greatly caused by the large-dimensional model is greatly-dimensional model is avoided, the problem that the three-dimensional model is greatly loaded when the rendering time is required by the main thread is greatly; in addition, as only the model data file of the current root node of the current level is needed to be loaded and analyzed by each invoking sub-thread, the current model grid data of the current root node of the three-dimensional model and the target mapping texture of the current model grid data are obtained, the model data files of all root nodes of all levels do not need to be loaded and analyzed at one time, equipment resources and time cost needed by loading and analyzing all root nodes are greatly saved, the problem that when the rendering area of the three-dimensional model of the target object is large for I3S, the probability of success of loading the model data file of the three-dimensional model is extremely small, the problem that the rendering failure probability of the three-dimensional model of the target object is large is solved, and the probability of success of rendering the three-dimensional model of the target object is increased.
The embodiment of the invention also provides electronic equipment, which comprises a memory, a processor and a computer program stored in the memory and capable of running on the processor, wherein the three-dimensional model rendering method of the target object provided by any embodiment is realized when the processor executes the program.
The embodiment of the invention also provides a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the three-dimensional model rendering method of the target object provided by any of the above embodiments.
Referring now to FIG. 5, there is illustrated a schematic diagram of a computer system 500 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 5 is only an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the computer system 500 are also stored. The CPU 501, ROM 502, and RAM 503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The drive 510 is also connected to the I/O interface 505 as needed. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 501.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules and/or units involved in the embodiments of the present invention may be implemented in software, or may be implemented in hardware. The described modules and/or units may also be provided in a processor, e.g., may be described as: a processor includes a path acquisition module, a sub-thread invocation module, and a model rendering module. The names of these modules do not constitute a limitation on the module itself in some cases.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to include:
when a three-dimensional model rendering instruction is received, loading a scene description file of a three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file; invoking the sub-thread to load a model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target map textures of the current model grid data; and acquiring current model grid data and target map textures from the sub-threads, rendering the target map textures for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
According to the technical scheme of the embodiment of the invention, the data (model rendering data) required by the three-dimensional model of the target object is loaded and analyzed in a multithreading cooperation manner, so that the main thread finishes the three-dimensional model rendering of the target object according to the current model grid data and the target mapping texture, the purpose of fully calling the processing capacity of the multi-core central processing unit is achieved, the three-dimensional model rendering efficiency and speed of the target object are further effectively improved, the problem that when the rendering area of the three-dimensional model of the target object is large due to the fact that the loading and traversing of the model node tree consumes a large time and costs, the problem that the main thread is blocked and blocked in the three-dimensional model rendering occurs is avoided, and the condition that the loading efficiency of a model data file is reduced is avoided; in addition, as only the model data file of the current root node of the current level is needed to be loaded and analyzed by each invoking sub-thread, the current model grid data of the current root node of the three-dimensional model and the target mapping texture of the current model grid data are obtained, the model data files of all root nodes of all levels do not need to be loaded and analyzed at one time, equipment resources and time cost needed by loading and analyzing all root nodes are greatly saved, the problem that when the rendering area of the three-dimensional model of the target object is large for I3S, the probability of success of loading the model data file of the three-dimensional model is extremely small, the problem that the rendering failure probability of the three-dimensional model of the target object is large is solved, and the probability of success of rendering the three-dimensional model of the target object is increased.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.

Claims (10)

1. A method of rendering a three-dimensional model of a target object, the method comprising:
when the three-dimensional model rendering instruction is received, loading a scene description file of the three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file;
invoking a sub-thread to load the model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target mapping textures of the current model grid data;
and acquiring the current model grid data and the target map texture from the sub-thread, rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
2. The method of claim 1, wherein the invoking the sub-thread parses the model data file to obtain model rendering data for a current root node of the three-dimensional model, comprising:
and calling the sub-thread to analyze the model data file to obtain an initial mapping texture and current model grid data of a current root node of the three-dimensional model, and decoding the initial mapping texture to obtain a target mapping texture of the current model grid data.
3. The method of claim 1, further comprising, in the model data file, a current resolution of a displayable range of the current model mesh data, further comprising, after obtaining the current model mesh data and the target map texture from the sub-thread:
determining renderable properties of the current model mesh data according to the current resolution and a camera maximum resolution of the rendering software;
when the renderable attribute is renderable, triggering and executing the operation of utilizing rendering software to render the target map texture for the current model grid data to obtain a three-dimensional model of the target object and displaying the three-dimensional model;
And when the renderable attribute is non-renderable, invoking the sub-thread to delete the current model grid data of the current root node.
4. A method according to claim 3, wherein said determining renderable properties of said current model mesh data from said current resolution and a camera maximum resolution of said rendering software comprises:
determining that the renderable attribute of the current model mesh data is not renderable when the current resolution is greater than a camera maximum resolution of the rendering software;
and when the current resolution is not greater than the maximum resolution of the camera of the rendering software, determining that the renderable attribute of the current model grid data is renderable.
5. The method of claim 3, further comprising, in the model data file, a model data file path for a sub-level of the current level, after determining that the renderable attribute of the current model mesh data is renderable:
determining whether the model data file of the sub-level is successfully loaded according to the model data file path of the sub-level;
and when the model data file of the sub-level is determined to be successfully loaded, determining whether to call a sub-thread to analyze the model data file according to the model data file of the sub-level to obtain model rendering data of the sub-level of the three-dimensional model.
6. The method of claim 5, wherein the model data file of the sub-level includes a resolution of a displayable range of model mesh data of a root node of the sub-level, a current model mesh data of the root node of the sub-level, and a target map texture of the current model mesh data of the root node of the sub-level, determining whether to invoke a sub-thread to parse the model data file to obtain model rendering data of the sub-level of the three-dimensional model according to the model data file of the sub-level, comprising:
and when the resolution of the displayable range of the model grid data of the root node of the sub-level is larger than the maximum resolution of the camera, invoking a sub-thread to analyze the model data file to obtain model rendering data of the sub-level of the three-dimensional model, and determining the model rendering data of the sub-level as the model rendering data of the current root node.
7. The method of claim 6, wherein the method further comprises:
and when the resolution of the displayable range of the model grid data of the root node of the sub-level is not more than the maximum resolution of the camera, triggering and executing the operation of rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object and displaying the three-dimensional model.
8. A three-dimensional model rendering device for a target object, the device comprising:
the path acquisition module is used for loading a scene description file of the three-dimensional model and acquiring a model data file path of a current root node of a current level of the three-dimensional model from the scene description file when receiving the three-dimensional model rendering instruction;
the sub-thread calling module is used for calling a sub-thread to load the model data file according to the model data file path and analyze the model data file to obtain model rendering data of a current root node of the three-dimensional model, wherein the model rendering data comprises current model grid data and target mapping textures of the current model grid data;
and the model rendering module is used for acquiring the current model grid data and the target map texture from the sub-thread, rendering the target map texture for the current model grid data by using rendering software to obtain a three-dimensional model of the target object, and displaying the three-dimensional model.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the three-dimensional model rendering method of a target object according to any one of claims 1 to 7 when the program is executed.
10. A computer-readable storage medium, on which a computer program is stored, characterized in that the program, when executed by a processor, implements the three-dimensional model rendering method of a target object according to any one of claims 1 to 7.
CN202311217067.6A 2023-09-19 2023-09-19 Three-dimensional model rendering method, device and equipment of target object and storage medium Pending CN117274530A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311217067.6A CN117274530A (en) 2023-09-19 2023-09-19 Three-dimensional model rendering method, device and equipment of target object and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311217067.6A CN117274530A (en) 2023-09-19 2023-09-19 Three-dimensional model rendering method, device and equipment of target object and storage medium

Publications (1)

Publication Number Publication Date
CN117274530A true CN117274530A (en) 2023-12-22

Family

ID=89205653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311217067.6A Pending CN117274530A (en) 2023-09-19 2023-09-19 Three-dimensional model rendering method, device and equipment of target object and storage medium

Country Status (1)

Country Link
CN (1) CN117274530A (en)

Similar Documents

Publication Publication Date Title
EP3876161A1 (en) Method and apparatus for training deep learning model
CN110751696B (en) Method, device, equipment and medium for converting BIM (building information modeling) model data into glTF (glTF) data
CN110413812B (en) Neural network model training method and device, electronic equipment and storage medium
CN110675465B (en) Method and apparatus for generating image
CN112765513A (en) Fine-grained Web3D online visualization method for large-scale building scene
CN115439609B (en) Three-dimensional model rendering method, system, equipment and medium based on map service
CN112948043A (en) Fine-grained Web3D online visualization method for large-scale building scene
CN115546331A (en) Data rendering method and device, electronic equipment and computer readable medium
CN115982491A (en) Page updating method and device, electronic equipment and computer readable storage medium
CN115908672A (en) Three-dimensional scene rendering acceleration method, system, medium, device and terminal
CN117011397A (en) Data processing method, apparatus, device, readable storage medium, and program product
CN115731313A (en) SVG format picture processing method, device, equipment, medium and product
CN110310361B (en) Real-time transmission method, storage medium, equipment and system for building model
CN117270834A (en) Map rendering method, map rendering device, electronic equipment and storage medium
CN117274530A (en) Three-dimensional model rendering method, device and equipment of target object and storage medium
CN114237916B (en) Data processing method and related equipment
CN111199569A (en) Data processing method and device, electronic equipment and computer readable medium
CN108228904B (en) Method and apparatus for outputting information
CN113496543A (en) Point cloud data screening method and device, electronic equipment and storage medium
US20220189027A1 (en) Panorama Rendering Method, Electronic Device and Storage Medium
CN110688116A (en) Image file analysis method, device, equipment and readable medium
CN113797554B (en) Game engine resource processing method and device, storage medium and electronic equipment
CN115908687A (en) Method and device for training rendering network, method and device for rendering network, and electronic equipment
CN114862720A (en) Canvas restoration method and device, electronic equipment and computer readable medium
CN114328795A (en) Live-action three-dimensional data processing method and device, server and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination