WO2023134267A1 - 数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 - Google Patents

数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 Download PDF

Info

Publication number
WO2023134267A1
WO2023134267A1 PCT/CN2022/128311 CN2022128311W WO2023134267A1 WO 2023134267 A1 WO2023134267 A1 WO 2023134267A1 CN 2022128311 W CN2022128311 W CN 2022128311W WO 2023134267 A1 WO2023134267 A1 WO 2023134267A1
Authority
WO
WIPO (PCT)
Prior art keywords
grid
sub
triangle
vertex
information
Prior art date
Application number
PCT/CN2022/128311
Other languages
English (en)
French (fr)
Inventor
连冠荣
Original Assignee
腾讯科技(深圳)有限公司
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 腾讯科技(深圳)有限公司 filed Critical 腾讯科技(深圳)有限公司
Priority to US18/324,617 priority Critical patent/US20230351696A1/en
Publication of WO2023134267A1 publication Critical patent/WO2023134267A1/zh

Links

Images

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
    • G06T17/205Re-meshing
    • 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
    • G06T15/003D [Three Dimensional] image rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • G06T7/73Determining position or orientation of objects or cameras using feature-based methods
    • G06T7/75Determining position or orientation of objects or cameras using feature-based methods involving models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2200/00Indexing scheme for image data processing or generation, in general
    • G06T2200/04Indexing scheme for image data processing or generation, in general involving 3D image data

Definitions

  • the present application relates to data processing technologies, and in particular to a data processing method, device, equipment, computer-readable storage medium, and computer program product.
  • 3D grid data In computer graphics applications, in order to present virtual objects as realistically as possible, high-precision 3D grid data is often required. However, the complexity of the data is directly related to the computational cost at rendering time. Moreover, in related technologies, when rendering a virtual object, the 3D grid data is rendered as a whole. When the virtual object needs to be decomposed and displayed, complex calculations need to be performed on the overall 3D grid data, resulting in rendering It takes a long time, causing the display to freeze.
  • Embodiments of the present application provide a data processing method, device, computer-readable storage medium, and computer program product, which can improve rendering efficiency.
  • An embodiment of the present application provides a data processing method applied to computer equipment, including:
  • each hierarchical sub-grid structure includes at least one sub-grid
  • the cross-section ring of each sub-mesh is determined based on the vertex information and the triangle information, and the cross-section of each sub-mesh is rendered based on the cross-section ring of each sub-mesh.
  • An embodiment of the present application provides a data processing device, including:
  • a dimensionality reduction module configured to obtain 3D grid data to be processed, perform dimensionality reduction processing on the 3D grid data, and obtain 2D grid data, and the 2D grid data includes vertex information and triangle information;
  • a hierarchical construction module configured to construct a sub-grid hierarchical structure based on the two-dimensional grid data, wherein each level of sub-grid structure includes at least one sub-grid;
  • a triangle grouping module configured to perform triangular grouping on the two-dimensional grid data based on each sub-grid, to obtain a triangle grouping set corresponding to each sub-grid;
  • a hierarchical storage module configured to store each sub-grid and the triangle grouping set corresponding to each sub-grid hierarchically according to the sub-grid level;
  • the first determining module is configured to determine the cross-sectional ring of each sub-grid based on the vertex information and the triangle information, and based on the cross-sectional ring of each sub-grid, determine the cross-section of each sub-grid to render.
  • An embodiment of the present application provides a computer device, including:
  • the processor is configured to implement the data processing method provided in the embodiment of the present application when executing the executable instruction stored in the memory.
  • the embodiment of the present application provides a computer-readable storage medium, which stores executable instructions for causing a processor to execute the data processing method provided in the embodiment of the present application.
  • An embodiment of the present application provides a computer program product, including a computer program or an instruction.
  • the computer program or instruction is executed by a processor, the data processing method provided in the embodiment of the present application is implemented.
  • the dimension reduction process is performed on the 3D grid data to obtain 2D grid data, the 2D grid data includes vertex information and triangle information, and then based on the 2D grid data Subsequent processing can effectively reduce the amount of calculation and improve calculation efficiency; then, based on the two-dimensional grid data, a sub-grid hierarchical structure is constructed, wherein each level of sub-grid structure includes at least one sub-grid, and then Group the triangles in the two-dimensional grid data based on the area information of each sub-grid, obtain a triangle grouping set corresponding to each sub-grid, and combine the respective sub-grids and the respective sub-grids The corresponding triangle grouping set is stored hierarchically according to the sub-grid level; finally, the cross-sectional ring of each sub-grid is determined based on the vertex information and the triangle information, and based on the cross-sectional ring of each sub-grid , to render the cross-section of each sub
  • the sub-grid structure of different levels includes different numbers of sub-grids, that is, the sub-grids of different levels are divided into sub-grids according to different granularities, and the Each sub-grid and the corresponding triangle grouping set are stored hierarchically according to the sub-grid level.
  • the corresponding hierarchical structure can be obtained directly, and since the cross-section of each triangle grouping set has been The rendering is completed in advance, and when the rendering needs to be decomposed, it does not need to be calculated, but directly displayed, which can improve the rendering efficiency.
  • Fig. 1A is a schematic diagram of vertices, edges and faces
  • Figure 1B is a schematic diagram of a three-dimensional grid
  • Figure 1C is a schematic diagram of a two-dimensional grid
  • Figure 1D is a schematic diagram of a sub-grid
  • FIG. 1E is a schematic diagram of dividing a three-dimensional grid to obtain a spatial hierarchical data structure
  • FIG. 1F is a schematic diagram of dividing a two-dimensional grid to obtain a spatial hierarchical data structure
  • Fig. 1G is a schematic diagram of conformal mapping
  • Figure 1H is a schematic diagram of a cross section
  • Figure 1I is a schematic diagram of a contour ring in cross section
  • FIG. 2 is a schematic structural diagram of a data processing system architecture provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a server 400 provided by an embodiment of the present application.
  • FIG. 4 is a schematic flow chart of a data processing method provided in an embodiment of the present application.
  • FIG. 5 is a schematic diagram of an implementation process for constructing a sub-grid hierarchical structure provided by an embodiment of the present application
  • FIG. 6A is a schematic diagram of the implementation flow of layered rendering using the data processing method provided by the embodiment of the present application.
  • FIG. 6B is a schematic diagram of an implementation process of decomposing and rendering using the data processing method provided by the embodiment of the present application.
  • FIG. 6C is a schematic diagram of the application of decomposed rendering provided by the embodiment of the present application.
  • FIG. 6D is another schematic flowchart of the data processing method provided in the embodiment of the present application.
  • FIG. 7 is a schematic diagram of the implementation flow of the dimensionality reduction process provided by the embodiment of the present application.
  • Each step shown in Figure 8 determines the central coordinates of each triangle in the grid
  • FIG. 9A is a schematic diagram of an implementation process for constructing a sub-grid hierarchy provided by an embodiment of the present application.
  • FIG. 9B is a logical schematic diagram of the implementation of the sub-grid hierarchy construction function provided by the embodiment of the present application.
  • FIG. 9C is a schematic diagram of the sub-grid hierarchical structure provided by the embodiment of the present application.
  • FIG. 10A is a schematic diagram of the implementation process of triangular grouping of two-dimensional grids provided by the embodiment of the present application.
  • FIG. 10B is a logical schematic diagram of the implementation of the AddTriangle function provided by the embodiment of the present application.
  • Fig. 11A is a schematic diagram of the implementation flow of the calculation section ring provided by the embodiment of the present application.
  • FIG. 11B is a logical schematic diagram of the implementation of the section ring creation function provided by the embodiment of the present application.
  • first ⁇ second ⁇ third is only used to distinguish similar objects, and does not represent a specific ordering of objects. Understandably, “first ⁇ second ⁇ third” Where permitted, the specific order or sequencing may be interchanged such that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein.
  • Vertex It is a data structure that contains a 2-dimensional position vector [x, y] or a 3-dimensional position vector [x, y, z].
  • FIG. 3 Each face has 3 edges.
  • An edge is a data structure containing 2 index integers.
  • Figure 1A is a schematic diagram of vertices, edges, and faces. In Figure 1A, three vertices 0, 1, and 2, and three edges are: edge [0,1], edge [1,2], and edge [2,0] ], a face [0,1,2].
  • Grid It is a common method for displaying 3D game objects.
  • the grid is a data structure including vertex arrays and face arrays.
  • the three-dimensional grid is a data structure including vertex arrays and face arrays.
  • FIG. 1B is a schematic diagram of a three-dimensional grid. In the three-dimensional grid shown in FIG. 1B , each vertex contains a 3-dimensional space vector representing the position [x, y, z] of the vertex.
  • a two-dimensional grid is a data structure including a vertex array and a face array.
  • FIG. 1C is a schematic diagram of a two-dimensional grid. In the two-dimensional grid shown in FIG. 1C , each vertex contains a 2-dimensional space vector representing the position [x, y] of the vertex.
  • FIG. 1D is a schematic diagram of sub-grids.
  • FIG. 1D includes two sub-grids separated from the three-dimensional grid shown in FIG. 1B.
  • FIG. 1E is a schematic diagram of dividing a three-dimensional grid to obtain a spatial hierarchical data structure. As shown in FIG. 1E , after dividing the three-dimensional grid 131 , 132 and 133 can be obtained, and 132 can be divided again to obtain 1321 and 1322 .
  • FIG. 1F is a schematic diagram of dividing a two-dimensional grid to obtain a spatial hierarchical data structure. As shown in FIG. 1F, after dividing the two-dimensional grid 141, 142 and 143 can be obtained, and 142 can be divided again to obtain 1421 and 1422.
  • Conformal map also known as conformal transformation or conformal map, comes from the concepts of fluid mechanics and geometry, and is a map that keeps the angle constant.
  • a mapping is said to be a conformal (or conformal) transformation if it can preserve the orientation angles and directions between the passing curves. Conformal transformations preserve the angles and shapes of infinitesimal objects, but not necessarily their dimensions.
  • the conformal property can be expressed in terms of the Jacobian matrix of the derivative matrix of the coordinate transformation.
  • a transformation is conformal if its Jacobian is everywhere a scalar multiplied by a rotation matrix.
  • Figure 1G is a schematic diagram of conformal mapping.
  • Triangle vertex index the grid contains an array of vertices, each vertex is a 3-dimensional vector (x, y, z).
  • a triangle contains 3 indices (0, i1, i2). Each index is used to index the vertex array to get the position of the triangle vertex.
  • FIG. 12 The cross section is the visible surface after the grid is separated.
  • Figure 1H is a schematic diagram of the cross section, the cross section is 151 in Figure 1H, and the cross section 151 is originally hidden in the sphere.
  • Cross-section contour ring also called cross-section ring in the embodiment of the present application, is the outer edge contour of the cross-section, and consists of an index array.
  • FIG. 1I is a schematic diagram of a cross-sectional contour ring, where 161 in FIG. 1I is a cross-sectional contour ring.
  • Quaternary tree is a tree-like data structure, and there are four sub-blocks on each node.
  • Quadtrees are often used in the analysis and classification of two-dimensional spatial data. The data range can be square or rectangular or any other shape. All quadtree methods have a common feature: they can be decomposed into their own blocks, and each block has a node capacity. When the node reaches the maximum capacity, the node split tree data structure is distinguished according to the method of building a quadrangle tree.
  • Embodiments of the present application provide a data processing method, device, device, computer-readable storage medium, and computer program product, which can improve rendering efficiency.
  • the following describes exemplary applications of the computer equipment provided in the embodiments of the present application.
  • the embodiments of the present application provide
  • the computer device can be implemented as a notebook computer, a tablet computer, a desktop computer, a set-top box, a mobile device (for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated message device, a portable game device) and other types of user terminals, Can also be implemented as a server.
  • a mobile device for example, a mobile phone, a portable music player, a personal digital assistant, a dedicated message device, a portable game device
  • other types of user terminals Can also be implemented as a server.
  • an exemplary application when the device is implemented as a server will be described.
  • FIG. 2 is a schematic structural diagram of a data processing system 100 provided by an embodiment of the present application.
  • the data processing system 100 includes a terminal 200 , a network 300 and a server 400 .
  • the design terminal 200 is connected to the server 400 through the network 300, and the network 300 may be a wide area network or a local area network, or a combination of both.
  • the terminal 200 may be a terminal for designing a virtual scene or a virtual character. After the designer completes the design of the virtual scene and the virtual character through the design terminal, the corresponding three-dimensional grid data is obtained, and the three-dimensional grid data is sent to the server 400.
  • the server After receiving the 3D grid data, the 400 first performs dimensionality reduction processing to obtain 2D grid data, and then constructs a sub-grid hierarchical structure based on the 2D grid data, and performs triangulation in the 2D grid data. Grouping to obtain multiple triangle grouping sets. In the embodiment of the present application, the cross-section rings of each triangle grouping set are also determined, and the cross-sections corresponding to the cross-section rings are pre-rendered.
  • the server 400 will also hierarchically store each sub-grid and the corresponding triangle grouping set according to the sub-grid level.
  • the cross-section of the grouping set is pre-rendered, and when it needs to be decomposed and rendered, it does not need to be calculated, but is directly displayed, thereby improving rendering efficiency.
  • the server 400 can be an independent physical server, or a server cluster or a distributed system composed of multiple physical servers, and can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.
  • the terminal 200 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a smart vehicle-mounted device, etc., but is not limited thereto.
  • the terminal and the server may be connected directly or indirectly through wired or wireless communication, which is not limited in this embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a server 400 provided by an embodiment of the present application.
  • the server 400 shown in FIG. 3 includes: at least one processor 410 , at least one network interface 420 , a bus system 430 and a memory 440 .
  • Various components in the server 400 are coupled together through the bus system 430 .
  • the bus system 430 is used to realize connection and communication between these components.
  • the bus system 430 also includes a power bus, a control bus and a status signal bus.
  • the various buses are labeled as bus system 430 in FIG. 3 .
  • Processor 410 can be a kind of integrated circuit chip, has signal processing capability, such as general processor, digital signal processor (DSP, Digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware Components, etc., wherein the general-purpose processor can be a microprocessor or any conventional processor, etc.
  • DSP digital signal processor
  • DSP Digital Signal Processor
  • Memory 440 may be removable, non-removable or a combination thereof.
  • Exemplary hardware devices include solid state memory, hard drives, optical drives, and the like.
  • Memory 440 optionally includes one or more storage devices located physically remote from processor 410 .
  • Memory 440 includes volatile memory or nonvolatile memory, and may include both volatile and nonvolatile memory.
  • the non-volatile memory can be a read-only memory (ROM, Read Only Memory), and the volatile memory can be a random access memory (RAM, Random Access Memory).
  • ROM read-only memory
  • RAM random access memory
  • the memory 440 described in the embodiment of the present application is intended to include any suitable type of memory.
  • memory 440 is capable of storing data to support various operations, examples of which include programs, modules, and data structures, or subsets or supersets thereof, as exemplified below.
  • Operating system 441 including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;
  • Exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus ( USB, Universal Serial Bus), etc.;
  • the device provided by the embodiment of the present application can be realized by software.
  • FIG. 3 shows a data processing device 443 stored in the memory 440, which can be software in the form of programs and plug-ins, including the following software modules : Dimensionality reduction module 4431, layered construction module 4432, triangle grouping module 4433, layered storage module 4434 and first determination module 4435, these modules are logical, so can be combined or further disassembled arbitrarily according to the realized functions point. The function of each module will be explained below.
  • the device provided in the embodiment of the present application may be implemented in hardware.
  • the device provided in the embodiment of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the In the data processing method provided by the embodiment, for example, the processor in the form of a hardware decoding processor may adopt one or more Application Specific Integrated Circuits (ASIC, Application Specific Integrated Circuit), DSP, Programmable Logic Device (PLD, Programmable Logic Device) ), Complex Programmable Logic Device (CPLD, Complex Programmable Logic Device), Field Programmable Gate Array (FPGA, Field-Programmable Gate Array) or other electronic components.
  • ASIC Application Specific Integrated Circuit
  • DSP Programmable Logic Device
  • PLD Programmable Logic Device
  • CPLD Complex Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • the embodiment of the present application provides a data processing method.
  • the data processing method may be implemented by a computer device.
  • the computer device may be a terminal or a server.
  • the computer device is a server as an example for illustration.
  • FIG. 4 is a schematic flowchart of an implementation of the data processing method provided in the embodiment of the present application.
  • the data processing method provided in the embodiment of the present application will be described below with reference to each step shown in FIG. 4 .
  • step S101 the three-dimensional grid data to be processed is obtained, and the dimensionality reduction processing is performed on the three-dimensional grid data to obtain two-dimensional grid data.
  • the grid data is a data structure including vertex data and face arrays, and a 3D virtual object can be constructed through the 3D grid data.
  • the difference between 3D grid data and 2D grid data is that in 3D grid data, the position coordinates of each vertex in the vertex data are represented by a 3D space vector [x, y, z].
  • In 2D grid data The position coordinates of each vertex in the vertex data are represented by a two-dimensional space vector [x, y].
  • the preset mapping function is used to convert the 3D vertex position coordinates into 2D vertex position coordinates.
  • Two-dimensional mesh data includes vertex information and triangle information.
  • the vertex information can be a vertex array, which includes a plurality of vertex indices, and can also include the vertex position coordinates corresponding to each vertex index (that is, a two-dimensional vertex position vector), and the triangle information can be a triangle array (also called is an array of faces), the triangle array includes the vertex index of each triangle.
  • Step S102 constructing a sub-grid hierarchical structure based on the two-dimensional grid data.
  • sub-grid structures of different levels include different numbers of sub-grids.
  • the initial two-dimensional grid data can be determined as the first-level sub-grid, and then the initial two-dimensional grid data is divided to obtain multiple second-level sub-grids, and then continue Divide each sub-grid of the second level to obtain a plurality of sub-grids of the third level, and then continue to divide until a preset number of levels is obtained, thereby obtaining a hierarchical structure of sub-grids. Since the sub-grids of each level are obtained by dividing the sub-grids of the previous level except the sub-grids of the first level, the number of sub-grids included in the sub-grid structure of different levels is different.
  • Step S103 performing triangular grouping on the two-dimensional grid data based on each sub-grid to obtain a triangle grouping set corresponding to each sub-grid.
  • the two-dimensional grid data can be triangularly grouped based on the area information of each sub-grid.
  • the area information of the sub-grid can refer to the vertex coordinates of the smallest rectangular area that can enclose the sub-grid. For example, it can be are the vertex coordinates of the lower-left vertex and the vertex coordinates of the upper-right vertex of the minimum rectangular area.
  • the triangles located in the rectangular area where the sub-grid is located may constitute a triangle grouping set corresponding to the sub-grid.
  • Step S104 each sub-grid and the triangle grouping set corresponding to each sub-grid are hierarchically stored according to the sub-grid level.
  • the first-level sub-grid and the triangle grouping set corresponding to the first-level sub-grid are stored, and the second-level sub-grid and the triangle grouping corresponding to each second-level sub-grid are stored. storage, and so on. Since the sub-grids at different levels are divided into sub-grids according to different granularities, and each sub-grid and the corresponding triangle grouping set are stored hierarchically according to the sub-grid level, when it is necessary to render sub-grids with different granularities, directly It only needs to obtain the corresponding hierarchical structure, so that the rendering efficiency can be improved.
  • Step S105 determine the cross-section ring of each sub-grid based on the vertex information and triangle information, and render the cross-section of each sub-grid based on the cross-section ring of each sub-grid.
  • step S105 it is possible to determine the connecting edges that exist on the edges in the two-dimensional mesh based on the vertex information and the triangle information, and determine the cross-sectional rings of each sub-grid based on the connecting edges that only exist on the edges, that is, the cross-sectional
  • the ring includes the connecting edge (target edge) that only exists in one triangle, and then based on the cross-sectional ring of each sub-grid, the corresponding cross-section is determined.
  • the cross-section is the visible surface after separating different meshes. The cross section is not visible when the virtual object corresponding to the two-dimensional grid data is normally rendered, but is hidden inside.
  • the hidden cross-section is not rendered when rendering the virtual object, and the displayed cross-section is determined and rendered only when the cross-section is visible.
  • the cross-section of each sub-grid is rendered, so that when the virtual object needs to be decomposed and displayed, it is not necessary to perform decomposition calculation and rendering , can be directly displayed, and the display efficiency can be improved.
  • the dimensionality reduction processing is first performed on the three-dimensional grid data to obtain two-dimensional grid data, and the two-dimensional grid data includes vertices Information and triangle information, followed by subsequent processing based on the two-dimensional grid data, can effectively reduce the calculation amount and improve the calculation efficiency; then based on the two-dimensional grid data, construct a sub-grid hierarchical structure, in which, each level The sub-grid structure includes at least one sub-grid, and then the triangles in the two-dimensional grid data are grouped based on the area information of each sub-grid to obtain the triangle grouping set corresponding to each sub-grid, and the Each sub-grid and the triangle grouping set corresponding to each sub-grid are hierarchically stored according to the sub-grid level; finally, the cross-sectional ring of each sub-grid is determined based on the vertex information and the triangle information, And based on the cross-section ring of
  • the sub-grid structure of different levels includes different numbers of sub-grids, that is, the sub-grids of different levels are Sub-grids are divided according to different granularities, and each sub-grid and the corresponding triangle grouping set are stored hierarchically according to the sub-grid level. When it is necessary to render different granularity sub-grids, the corresponding hierarchical structure can be obtained directly. , and since the cross-sections of each triangle group set have been pre-rendered, when decomposing rendering is required, there is no need to perform calculations, but to display them directly, thereby improving rendering efficiency.
  • step S101 of "performing dimensionality reduction processing on the 3D grid data to obtain 2D grid data” may be implemented through the following steps S1011 to S1013, and each step will be described below.
  • Step S1011 acquiring a preset conformal mapping function.
  • Conformal mapping is a branch of complex variable function theory. It studies complex variable functions from a geometric point of view. Through conformal mapping functions, one area can be mapped to another area for research. This property can map some irregular or poorly expressed regional boundaries into regular or mature regional boundaries.
  • the preset conformal mapping function can map the three-dimensional space to the two-dimensional space, and keep the angle unchanged.
  • Step S1012 acquiring the three-dimensional coordinate information of each vertex from the three-dimensional grid data.
  • the corresponding three-dimensional coordinate information may be acquired based on the vertex index of each vertex, and the three-dimensional coordinate information represents the position of the vertex in the three-dimensional space.
  • Step S1013 using the conformal mapping function to perform conformal mapping on the three-dimensional coordinate information of each vertex to obtain the two-dimensional coordinate information of each vertex.
  • the three-dimensional coordinate information of each vertex can be substituted into the conformal mapping function to obtain the two-dimensional coordinate information of each vertex.
  • the conformal mapping function can be used to reduce the dimension of the three-dimensional grid data to obtain two-dimensional grid data, and the subsequent processing based on the two-dimensional grid data can effectively reduce the amount of calculation and improve the calculation efficiency. efficiency.
  • the above-mentioned step S102 of "building a sub-grid hierarchical structure based on the two-dimensional grid data" can be realized through steps S1021 to S1025 shown in FIG. illustrate.
  • Step S1021 determining the grid corresponding to the two-dimensional grid data as a first-level sub-grid.
  • Step S1022 obtain the vertex coordinates and center coordinates of the i-th target area corresponding to each i-th level sub-grid.
  • each sub-grid of the i-th level corresponds to an i-th target area
  • the vertex coordinates and center coordinates of each sub-grid of the i-th level corresponding to the i-th target area are obtained .
  • i 1, 2, . . . , (N-1)
  • N is the preset number of layers
  • N is an integer greater than 1.
  • this step is to obtain the vertex coordinates and center coordinates of the first level sub-grid corresponding to the first target area.
  • the first target area corresponding to the first-level sub-grid is the smallest rectangular area containing all triangles in the grid.
  • the vertex coordinates of the first target area can be the coordinates of the lower left corner vertex and the upper right corner vertex, or four
  • the coordinates of the vertices, the center coordinates can be determined based on the coordinates of the lower left vertex and the coordinates of the upper right vertex.
  • the coordinates of the lower left vertex are (x 1 , y 1 )
  • the coordinates of the upper right vertex are (x 2 , y 2 )
  • the center coordinates of the first target area are ((x 1 +x 2 )/2, (y 1 +y 2 )/2).
  • Step S1023 Divide each i-th level sub-grid based on the vertex coordinates and center coordinates of the i-th target area to obtain a plurality of (i+1)-th level sub-grids.
  • the first-level subgrid can be divided into two parts, for example, it can be divided based on the center coordinate along the length direction of the rectangle, or based on the center coordinate along the width direction of the matrix Division; in some embodiments, the first-level subgrid can also be divided into four parts, for example, it can be divided along the length and width directions of the rectangle based on the center coordinates to obtain four second-level subgrids.
  • subgrid identifiers are also set for subgrids at each level. Assume that each subgrid is divided into 4 subgrids again.
  • the identifier of the first level subgrid can be 0, and the second
  • the logo of the hierarchical sub-grid can be 4*(the logo of the parent grid of the previous level)+1, 4*(the logo of the parent grid of the previous level)+2, 4*(the logo of the parent grid of the previous level)+3 and 4*(identification of the parent grid of the previous level)+4, then the identifications of the four sub-grids of the second level are 1, 2, 3, and 4 respectively.
  • the sub-grid identified as 1 is divided again to obtain four third-level sub-grids with identifications of 5, 6, 7, and 8 respectively; the sub-grid identified as 2 is the second-level sub-grid
  • the marks of the four third-level sub-grids obtained by re-dividing are 9, 10, 11, and 12 respectively, and so on.
  • the identifiers of the hierarchical subgrids are 13, 14, 15, and 16 respectively; the identifiers of the four third-level subgrids obtained by subdividing the second-level subgrid whose subgrid is identified as 4 are 17, 18, 19, 20.
  • each sub-grid of the i-th level is divided, and each sub-grid is divided again
  • the number of subgrids is the same.
  • the second-level sub-grid is obtained by dividing the first-level sub-grid into 4 parts, that is, the second-level sub-grid includes 4 sub-grids
  • the third-level sub-grid is obtained by dividing the second-level sub-grid
  • each of the 4 sub-grids is divided into 4 sub-grids again, so the third-level sub-grid includes 16 sub-grids.
  • step S103 of "performing triangle grouping on the two-dimensional grid data based on each sub-grid to obtain a triangle grouping set corresponding to each sub-grid" can be implemented through the following steps:
  • Step S1031 determine the center coordinates of each triangle based on the vertex information and the triangle information.
  • step S1031 based on the vertex indexes of each triangle included in the triangle information, the coordinates of the three vertices of the triangle are obtained from the vertex information, and then the center coordinates of the triangle are determined based on the coordinates of the three vertices of the triangle.
  • the coordinates of the three vertices of the triangle are (x t1 , y t1 ), (x t2 , y t2 ), (x t3 , y t3 ), then the coordinates of the center of the triangle are ((x t1 +x t2 +x t3 )/3, (y t1 +y t2 +y t3 )/3).
  • Step S1032 acquiring the vertex coordinates of the jth sub-grid based on the area information of each sub-grid.
  • the area information of the sub-grid refers to the vertex coordinates of the smallest rectangular area that can enclose the sub-grid.
  • the vertex coordinates of the jth sub-grid can be the vertex coordinates of the two opposite corners of the j-th sub-grid corresponding to the rectangular area. For example, It is the vertex coordinates of the lower left corner and the vertex of the upper right corner, or the vertex coordinates of the upper left corner and the lower right corner.
  • Step S1033 based on the center coordinates of each triangle and the vertex coordinates of the jth subgrid, assign the triangle whose center coordinates are located in the target area corresponding to the jth subgrid to the jth subgrid corresponding to in the triangle grouping set of .
  • step S1033 the center coordinates of each triangle are compared with the vertex coordinates of the jth subgrid to determine whether the triangle is located in the target area corresponding to the jth subgrid, assuming that the jth subgrid corresponds to the target area of the jth subgrid.
  • the coordinates of the lower left vertex are (x 1 , y 1 )
  • the coordinates of the upper right vertex are (x 2 , y 2 )
  • the coordinates of the center of a triangle are (x c1 , y c1 )
  • x 1 ⁇ x c1 ⁇ x 2 and y 1 ⁇ y c1 ⁇ y 2 determine that the triangle is located in the target area corresponding to the j-th sub-grid, and assign the triangle to the triangle grouping set corresponding to the j-th sub-grid; when x 1 ⁇ x c1 ⁇ x 2 and y 1 ⁇
  • y c1 ⁇ y 2 it is determined that the triangle is not located in the target area corresponding to the j-th sub-grid, and at this time, it is determined whether the next triangle is in the target area corresponding to the j-th sub-grid.
  • the triangles located in each sub-grid can be determined based on the center coordinates of the triangles, and then when When it is necessary to render some sub-grid contents, the data corresponding to these sub-grids can be directly rendered, which can improve rendering efficiency.
  • step S1031 of "determining the center coordinates of each triangle based on the vertex information and the triangle information" may be implemented through the following steps S311 to S313, and each step will be described below.
  • Step S311 determine three vertex coordinates of each triangle based on the vertex information and the triangle information.
  • the vertex index of each triangle can be obtained from the triangle array corresponding to the triangle information, and then the vertex coordinate corresponding to the vertex index can be obtained from the vertex information based on the vertex index of the triangle, wherein the vertex coordinate includes the first A vertex coordinate value and a second vertex coordinate value, that is, the vertex coordinates are two-dimensional position vectors.
  • the vertex coordinates of a certain vertex are (x d1 , y d1 ), wherein the coordinate value of the first vertex is x d1 , and the coordinate value of the second vertex is y d1 .
  • Step S312 determining the first center coordinate value of each triangle based on the three first vertex coordinate values of each triangle.
  • the coordinate values of the first center of the triangle may be obtained by arithmetically averaging the coordinate values of the first three vertices of the triangle.
  • the coordinate values of the first three vertices of the first triangle are x d1 , x d2 , and x d3 respectively, then the coordinate value of the first center of the triangle is (x d1 +x d2 +x d3 )/3.
  • Step S313 determining the second center coordinate value of each triangle based on the three second vertex coordinate values of each triangle.
  • the coordinate values of the three second vertices of the triangle may be arithmetically averaged to obtain the second center coordinate value of the triangle.
  • the coordinate values of the three first vertices of the first triangle are y d1 , y d2 , and y d3 respectively, then the first center coordinate value of the triangle is (y d1 +y d2 +y d3 )/3.
  • the center coordinates of each triangle can be calculated, so that in the subsequent process, the center coordinates of the triangles are used to group the triangles instead of the coordinates of the three vertices. Reduce the amount of calculation and improve calculation efficiency.
  • step S105 of "determining the cross-sectional rings of each sub-mesh based on the vertex information and the triangle information" can be implemented by the following steps:
  • Step S1051 determine the target edge in each triangle grouping set based on the vertex information and the triangle information.
  • Step S1052 determining the target edges that are connected end to end and can form a closed loop from the plurality of target edges in each triangle grouping set.
  • the target edge in each triangle grouping is identified, and the target edge can also be called an edge edge in some embodiments, or an open edge (Open edge).
  • the target edge can be based on the starting point and The end point is to determine the target edge that is connected end to end and can form a closed loop.
  • Step S1053 determining each closed loop formed as a cross-section loop of each sub-grid.
  • the closed loop obtained in step S1052 is determined as the cross-section loop of each sub-grid. If the cross-section formed by the cross-section loop is a section that is displayed after the separation of adjacent sub-grids, then the sub-grid of a level The cross section is not displayed when the mesh is fully rendered. In some embodiments of the present application, after the cross-sectional rings of each sub-grid are determined, the rendering will be completed in advance, and when the virtual object needs to be decomposed and displayed, it can be directly displayed, thereby improving the display efficiency.
  • the above step S1051 of "determining target edges in each triangle grouping set based on the vertex information and the triangle information" includes:
  • Step S511 determine each connecting edge in the kth triangle grouping set based on the vertex information and the triangle information.
  • This step is implemented, and the vertex index of each triangle in the kth triangle grouping set can be obtained, and then the vertex coordinates are determined based on the vertex index. Based on the positional relationship between the coordinates of the vertices of the triangle, three connecting sides of the triangle are determined.
  • the coordinates of the three vertices OPQ of a triangle are (x o , y o ), (x p , y p ), (x q , y q ), respectively.
  • the connection relationship of the three vertices can be determined based on the coordinates of the three vertices. Assuming that the three vertices are in the order of POQ in the clockwise direction, then the three connecting sides of the triangle are PO, OQ, and QP. In this step, the connecting sides of each triangle in the triangle grouping set are determined. For example, if there are 10 triangles in the triangle grouping set, then the triangle grouping set includes 30 connecting edges.
  • Step S512 determining the sharing times of each connected side based on the triangle information.
  • the sharing times of the respective connecting edges are set to the first preset value;
  • the first connecting side is any one of the connecting sides.
  • the first preset value may be 1
  • the second preset value may be 1
  • the second preset value may also be 0.
  • the sharing times is the first preset value
  • the sharing times is the second preset value
  • Step S513 determining the connected edge whose sharing frequency is the first preset value as the target edge in the kth triangle grouping set.
  • the triangle grouping set is used as a unit to determine the target edge that only exists in one triangle in each triangle grouping set, so as to determine the transverse direction of the sub-grid corresponding to the triangle grouping set based on the determined target edge. section ring.
  • the rendering process may also be performed through the following steps S106A to S108A, and each step will be described below.
  • Step S106A acquiring the first target level selected when rendering the virtual object corresponding to the two-dimensional grid data.
  • the technician can pre-set the first target level selected when rendering the virtual object.
  • the second target level can be selected in advance, and all subnets for rendering the second target level will be set.
  • Grid or part of the sub-grid, when rendering part of the sub-grid of the second target level, also set the identifier of the sub-grid that needs to be rendered.
  • the first target level used when rendering the virtual object can be determined as the second level.
  • Step S107A acquiring at least one target sub-grid to be rendered in the first target layer.
  • the first target level is pre-set by the technician, it will also pre-set which sub-grids of the first target level need to be rendered. At this time, directly obtain the setting information to obtain at least one target sub-grid to be rendered logo. If the first target level is determined based on the actual virtual scene requirements, then in implementation, it is determined which level to choose as the first target level based on the need to render the whole or the rendered part, and the size of the rendered part. That is to say, when determining The part that needs to be rendered has been determined at the first target level, then the identification corresponding to the sub-grid that needs to be rendered can also be determined, for example, it is determined that 3/4 of the virtual object needs to be rendered, and the second sub-grid does not need to be rendered.
  • Step S108A rendering the at least one target sub-grid to obtain a first rendering result.
  • rendering is performed based on the multiple triangles in at least one target sub-grid to obtain a first rendering result.
  • the sub-grid hierarchical structure Since in the previous steps, the sub-grid hierarchical structure has been constructed, and the sub-grids of each level are divided into triangle groups, so when it is necessary to render some virtual objects, through the above steps S106A to S108A, it can be directly based on The size of the rendering part needs to determine the corresponding level and the sub-grid to be rendered, so as to improve rendering efficiency.
  • step S105 after step S105 , the following step S106B to step S109B may be used to perform decomposed rendering, and each step will be described below.
  • Step S106B when it is determined that the virtual object rendered based on the two-dimensional grid data meets the decomposition condition, determine a second target level selected for rendering the virtual object.
  • the second target level selected for rendering the virtual object can be determined according to the collision force. For example, if the collision force is small, a small part will be decomposed, so a higher-level second target level can be selected.
  • the third level can be selected, and the third level includes 16 sub-grids.
  • the second target level selected for rendering the virtual object may be determined according to the preset blasting power.
  • Step S107B determining the movement information and rotation information of each sub-grid in the second target layer.
  • each sub-grid of each level also has preset movement information and rotation information, and will not obtain movement information and rotation information when decomposing rendering is not required, and then when decomposing and rendering virtual objects are required Only then will the movement information and rotation information be obtained.
  • the movement information is used to represent the distance between the target rendering position and the current position
  • the rotation information is used to represent the rotation angle and direction between the target rendering orientation and the current rendering orientation.
  • Step S108B determining the rendering position of each sub-grid based on the movement information and rotation information of each sub-grid.
  • the initial position and initial orientation of each sub-grid can be obtained. After obtaining the movement information and rotation information of each sub-grid, the movement information, initial position, and initial orientation of each sub-grid can be used and rotation information to determine the rendering position of each sub-grid.
  • Step S109B rendering each sub-grid based on the rendering position to obtain a second rendering result.
  • the movement information between different sub-grids may be the same or different, and the rotation information between different sub-grids may be the same or different.
  • the movement information and rotation information of the sub-grids are the same, it means that the two or more sub-grids are rendered as a whole.
  • the 16 sub-grids of the third level are taken as an example for illustration.
  • each sub-grid is rendered for each sub-grid to obtain a second rendering result.
  • 501 in FIG. 6C is the virtual object rendered according to the original grid
  • 502 is the virtual object rendered during the shattering process
  • 503 is the virtual object decomposed and rendered after the shattering is completed.
  • the second target level used for rendering can be determined based on the pre-built sub-grid hierarchical structure, and the movement information of each sub-grid based on the second target level and rotation information to determine the rendering position of each sub-grid for rendering, which can efficiently realize the decomposed rendering of virtual objects.
  • the cross-sections of each sub-grid have been pre-rendered, so that when the virtual object needs to be decomposed and displayed, it can be displayed directly without decomposing calculation and rendering, which can improve display efficiency.
  • the data processing method provided in the embodiment of the present application can be applied to a game scene or a virtual reality scene, and the application to a game scene is taken as an example for description here.
  • the game scene includes a virtual object that will explode or decompose (for example, the virtual object is a time bomb)
  • the virtual object rendered according to the three-dimensional grid of the virtual object is shown as 501 in FIG.
  • the dimensionality reduction process is performed on the 3D grid data of the virtual object to obtain the 2D grid data; then, based on the 2D grid data, a sub-grid hierarchical The triangles in the grid data are grouped to obtain the triangle grouping set corresponding to each sub-grid; finally determine the cross-sectional rings of each sub-grid, and based on the cross-sectional rings of each sub-grid, each The cross-section of the sub-mesh is rendered.
  • the second target level used for rendering will be determined based on the explosive power of the virtual object and the pre-built sub-grid hierarchical structure, and based on the subnets of the second target level
  • the moving information and rotation information of the grid determines the rendering position of each sub-grid during the explosion process and the rendering position after the explosion, and then renders the virtual object shown in 502 in Figure 6C based on the rendering position during the explosion process, and based on the post-explosion
  • the virtual object shown in 503 in Figure C is rendered at the rendering position. Since the cross section generated after explosion decomposition has been pre-rendered, the decomposition rendering of virtual objects can be efficiently realized.
  • the embodiment of the present application provides a data processing method. Firstly, a three-dimensional grid is converted into a two-dimensional grid through a conformal map algorithm. Then group the two-dimensional grids with a spatial hierarchical data structure (Spatial Hierarchical Data structure).
  • the spatial hierarchical data structure can be Quad Tree, K-D Tree, etc., and finally save the triangle vertex indexes of the same group in the same node.
  • the method can also support subgrouping.
  • FIG. 6D is a schematic flow diagram of another implementation of the three-dimensional grid layered data structure representation method provided by the embodiment of the present application. The implementation process of the method will be described below with reference to FIG. 6D .
  • Step S601 reducing the dimension of the 3D grid to a 2D grid.
  • Step S602 determining the center of each triangle in the two-dimensional grid.
  • Step S603 building a sub-grid hierarchy.
  • Step S604 perform triangular grouping on the two-dimensional grid.
  • Step S605 determine the section ring.
  • Fig. 7 is a schematic diagram of the implementation flow of the dimensionality reduction process provided by the embodiment of the present application. As shown in Fig. 7, the dimensionality reduction of a three-dimensional grid to a two-dimensional grid can be performed through the following steps:
  • Step S6011 determine the conformal mapping function.
  • the conformal mapping function may be represented by ConformMap(), which is to convert a 3D vector into a 2D texture coordinate uv. For each mesh vertex, the corresponding two-dimensional texture coordinates can be determined through the conformal mapping function.
  • Step S6012 set the mesh vertex index ((meshVertIdx)) to 0.
  • Step S6013 using the conformal mapping function to calculate the texture coordinates from the vertex positions.
  • Step S6014 adding 1 to the grid vertex index.
  • Step S6015 judging whether the grid vertex index is smaller than the grid vertex number.
  • step S6012 if the grid vertex index is less than the grid vertex number, go to step S6012; if the grid vertex index is not less than the grid vertex number, it means that the dimensionality reduction process has been completed, and now go to step S602 to calculate the triangle center.
  • Step S6021 set the triangle index (triangleIDx) to 0.
  • Step S6022 obtain the index and vertex position of the first vertex of the triangleIDxth triangle.
  • Step S6023 acquire the index and vertex position of the second vertex of the triangleIDxth triangle.
  • Step S6024 obtain the index and vertex position of the third vertex of the triangleIDxth triangle.
  • Step S6025 calculate the triangle center.
  • Step S6026 add 1 to the triangle index triangleIDx.
  • Step S6027 judging whether the triangle index is smaller than the number of mesh triangles.
  • the triangle index is less than the number of mesh triangles, it means that there are still mesh triangles whose triangle centers have not been calculated, and then enter step S6022; if the triangle index is not less than the number of mesh triangles, it means that the calculation of all triangle centers in the mesh has been completed , enter step S603 at this time.
  • FIG. 9A is a schematic diagram of the implementation process of constructing the sub-grid hierarchy provided by the embodiment of the present application. The implementation process of constructing the sub-grid hierarchy will be described below with reference to the steps in FIG. 9A .
  • Step S6031 obtaining the maximum subnetwork level, the initial value of the ID of the root subgrid, and the initial value of the vertex coordinates of the root subgrid.
  • the maximum subnet level is 4, the initial value of the root subgrid ID is 0, the initial value of the coordinates of the lower left corner of the root subgrid is (0,0), and the vertex of the upper right corner The initial value of the coordinates is (1,1).
  • Step S6032 calling the sub-grid hierarchy construction function to complete the construction of the sub-grid hierarchy.
  • the sub-grid hierarchy construction function can be SubMesh (SubMeshLevel, SubMeshID, lowerLeft, upperRight).
  • maxSubMeshLevel is the maximum subnet level
  • rootSubMeshID is the ID of the root submesh
  • rootSubMeshLowerLeft is the coordinate of the lower left corner of the root submesh
  • rootSubMeshUpperRight is the coordinate of the upper right corner of the root submesh.
  • FIG. 9B is a schematic diagram of the implementation logic of the sub-grid hierarchy construction function provided by the embodiment of the present application. The implementation logic of the function will be described below with reference to FIG. 9B .
  • Step S321 determine subMeshes[subMeshID] as the current sub-mesh.
  • Step S322 set subMeshID as the current sub-grid ID, set the coordinates of the lower left corner of subMeshID as the coordinates of the lower-left corner vertex of the current sub-grid, and set the coordinates of the upper-right corner of subMeshID as the coordinates of the upper-right corner of the current sub-grid .
  • currentSM.subMeshID rootsubMeshID
  • currentSM.lowerLeft rootSubMeshLowerLeft
  • currentSM.upperRight rootSubMeshUpperRight.
  • Step S323 judging whether the sub-grid level is non-zero.
  • step S324 When the sub-grid level is not 0, enter step S324; when the sub-grid level is 0, enter step S329.
  • Step S324 calling SubMesh(SubMeshLevel-1, 4*SubMeshID+1, currentSM.GetSouthWest(), currentSM.GetCenter()) to determine the first sub-mesh of the current sub-mesh.
  • GetSouthWest() is a function to obtain the southwest coordinates of the current sub-grid.
  • This function returns a position coordinate, which is (lowerLeft.x, lowerLeft.y), and GetCenter() is to obtain the current sub-grid
  • the function of the center coordinates of the function the function returns the position coordinates as ((lowerLeft.x+upperRight.x)*0.5, (lowerLeft.y+upperRight.y)*0.5).
  • the first sub-grid ID of the current sub-grid is 4*current sub-grid ID+1, the coordinates of the lower left corner of the first sub-grid of the current sub-grid are the soiled coordinates of the current sub-grid, and the current sub-grid The coordinates of the upper right corner of the first subgrid of the grid are the center coordinates of the current subgrid.
  • Step S325 calling SubMesh(SubMeshLevel-1, 4*SubMeshID+2, currentSM.GetWest(), GetNorth()) to determine the second sub-mesh of the current sub-mesh.
  • GetWest() is a function to obtain the western coordinates of the current sub-grid, and the function returns a position coordinate, which is (lowerLeft.x,(lowerLeft.y+upperRight.y)*0.5)
  • GetNorth( ) is a function to obtain the north coordinates of the current subgrid, and the function returns the position coordinates as ((lowerLeft.x+upperRight.x)*0.5, upperRight.y).
  • the second sub-grid ID of the current sub-grid is 4*current sub-grid ID+2
  • the coordinate of the lower left corner of the second sub-grid of the current sub-grid is the west coordinate of the current sub-grid
  • the current sub-grid’s The upper right coordinate of the second subgrid is the north coordinate of the current subgrid.
  • Step S326 calling SubMesh(SubMeshLevel-1, 4*SubMeshID+3, currentSM.GetSouth(), GetEast()) to determine the third sub-mesh of the current sub-mesh.
  • GetSouth() is a function to obtain the southern coordinates of the current subgrid, and the function returns a position coordinate, which is ((lowerLeft.x+upperRight.x)*0.5, lowerLeft.y)
  • GetEast( ) is a function to obtain the west coordinates of the current subgrid, and the function returns the position coordinates as (lowerLeft.x, (lowerLeft.y+upperRight.y)*0.5).
  • the third sub-grid ID of the current sub-grid is 4*current sub-grid ID+3, the coordinate of the lower left corner of the third sub-grid of the current sub-grid is the south coordinate of the current sub-grid, and the current sub-grid’s The coordinates of the upper right corner of the third subgrid are the western coordinates of the current subgrid.
  • Step S327 calling SubMesh(SubMeshLevel-1, 4*SubMeshID+4, currentSM.GetCenter(), GetNorthEast()) to determine the fourth sub-grid of the current sub-grid.
  • GetNorthEast() is a function to obtain the northeast coordinates of the current subgrid, and the function returns a position coordinate, which is (upperRight.x, upperRight.y).
  • the fourth sub-grid ID of the current sub-grid is 4*current sub-grid ID+4, the coordinates of the lower left corner of the fourth sub-grid of the current sub-grid are the center coordinates of the current sub-grid, and the coordinates of the current sub-grid are The coordinates of the upper right corner of the fourth subgrid are the northeast coordinates of the current subgrid.
  • Step S328 return to the current subgrid.
  • Step S329 setting the first sub-grid, the second sub-grid, the third sub-grid and the fourth sub-grid of the current sub-grid to be empty.
  • Fig. 9C is a schematic diagram of the sub-grid hierarchical structure provided by the embodiment of the present application.
  • each sub-grid has its sub-grid, wherein, the root sub-grid is sub-grid 0, and the sub-grid 0 is divided into sub-grid 1, sub-grid 2, sub-grid 3 and sub-grid 4, sub-grid 1 is further divided into sub-grid 5, sub-grid 6, sub-grid 7 and sub-grid 8, sub-grid Grid 5 is further divided into sub-grid 21 , sub-grid 22 , sub-grid 23 and sub-grid 24 .
  • sub-grid 2 , sub-grid 3 and sub-grid 4 and sub-grid 6 , sub-grid 7 and sub-grid 8 will continue to divide sub-grids, which are not shown in FIG. 9C .
  • FIG. 10A is a schematic diagram of the implementation process of triangular grouping of two-dimensional grids provided by the embodiment of the present application. The implementation process of triangular grouping of two-dimensional grids will be described below in conjunction with FIG. 10A .
  • Step S6041 set mesh.triangles as SourceTriangle, and initialize the ID of the root sub-grid to 0.
  • Step S6042 using the AddTriangle function to assign triangle grouping sets to each sub-grid.
  • the AddTriangle function may be AddTriangle(subMeshID, triangles).
  • rootSubMeshID and SourceTriangle may be used as function parameters to complete triangle grouping.
  • FIG. 10B is a schematic diagram of an implementation logic of the AddTriangle function provided by the embodiment of the present application. The implementation logic of the AddTriangle function will be described below in conjunction with FIG. 10B .
  • Step S421 determine subMeshes[subMeshID] as the current sub-mesh.
  • Step S422 initialize parameter i to 0.
  • Step S423 obtaining the center coordinate c of the i-th triangle.
  • Step S428, determine whether i is less than the total number of triangles.
  • step S423 when i is less than the total number of triangles, enter step S423; when i is not less than the total number of triangles, it means that the current sub-grid has been grouped, and then enter step S429.
  • Step S429 determine whether the first sub-grid divided by the current sub-grid is empty.
  • step S4210 If the first sub-grid divided by the current sub-grid is not empty, go to step S4210; if the first sub-grid divided by the current sub-grid is empty, go to step S4211.
  • Step S4210 calling AddTriangle(4*subMeshID+1, triangles) to assign a triangle grouping set to the first sub-mesh divided by the current sub-mesh.
  • Step S4211 determine whether the second sub-grid divided by the current sub-grid is empty.
  • step S4212 If the second sub-grid divided by the current sub-grid is not empty, go to step S4212; if the second sub-grid divided by the current sub-grid is empty, go to step S4213.
  • Step S4212 calling AddTriangle(4*subMeshID+2, triangles) to assign a triangle grouping set to the second sub-mesh divided by the current sub-mesh.
  • Step S4213 determine whether the third sub-grid divided by the current sub-grid is empty.
  • step S4214 If the third sub-grid divided by the current sub-grid is not empty, go to step S4214; if the second sub-grid divided by the current sub-grid is empty, go to step S4215.
  • Step S4214 calling AddTriangle(4*subMeshID+3, triangles) to assign a triangle grouping set to the third sub-mesh divided by the current sub-mesh.
  • Step S4215 determine whether the fourth sub-grid divided by the current sub-grid is empty.
  • step S4216 If the fourth sub-grid divided by the current sub-grid is not empty, go to step S4216; if the fourth sub-grid divided by the current sub-grid is empty, go to step S605.
  • Step S4216 calling AddTriangle(4*subMeshID+4, triangles) to assign a triangle grouping set to the fourth sub-mesh divided by the current sub-mesh.
  • FIG. 11A is a schematic diagram of the implementation process of the calculation cross-section ring provided by the embodiment of the present application. The implementation process of the calculation cross-section ring will be described below with reference to FIG. 11A .
  • Step S6051 initialize the ID of the root subgrid to 0.
  • Step S6052 using the section ring creation function to determine the cross-section ring of each sub-grid.
  • the section loop creation function can be BuildCrossSectionLoop(subMeshID).
  • the ID of the root subgrid can be determined as a parameter of the section loop creation function, and the cross section loop of each subgrid can be determined by calling this function recursively. section ring.
  • FIG. 11B is a schematic diagram of the implementation logic of the section ring creation function provided by the embodiment of the present application. The implementation logic will be described below in conjunction with FIG. 11B .
  • Step S521, determine subMeshes[subMeshID] as the current sub-mesh.
  • subMeshID is the ID of the root sub-mesh.
  • Step S522 initialize the array of edge sharing times to 0.
  • Step S524 obtaining the i-th triangle in the triangle grouping set of the current sub-grid.
  • Step S527 obtaining the reverse side of the jth side.
  • Step S5210 judging whether j is less than 3.
  • step S526 if j is less than 3, go to step S526; if j is not less than 3, go to step S5211.
  • Step S5212 judging whether i is smaller than the number of triangles in the triangle grouping set corresponding to the current sub-mesh.
  • step S524 If i is less than the number of triangles in the triangle grouping set corresponding to the current sub-mesh, go to step S524; if i is not less than the number of triangles in the triangle grouping set corresponding to the current sub-mesh, go to step S5213.
  • Step S5214 judging whether the kth element of the array of edge sharing times is non-zero.
  • step S5215 when the kth element is non-zero, enter step S5215; when the kth element is 0, enter step S5216.
  • Step S5215 adding the connection edge corresponding to the kth element to the cross-section ring corresponding to the current sub-grid.
  • Step S5217 judge whether k is less than the total number of edges corresponding to the current sub-grid.
  • step S5214 If k is less than the total number of edges corresponding to the current sub-grid, go to step S5214; if k is not less than the total number of sides corresponding to the current sub-grid, go to step S5218.
  • Step S5218 determine whether the first sub-grid divided by the current sub-grid is empty.
  • step S5219 When the first sub-grid divided by the current sub-grid is not empty, go to step S5219; when the first sub-grid divided by the current sub-grid is empty, go to step S5220.
  • Step S5219 calling BuildCrossSectionLoop(4*subMeshID+1) to determine the section loop of the first sub-mesh divided by the current sub-mesh.
  • Step S5220 determine whether the second sub-grid divided by the current sub-grid is empty.
  • step S5221 When the second sub-grid divided by the current sub-grid is not empty, go to step S5221; when the second sub-grid divided by the current sub-grid is empty, go to step S5222.
  • Step S5221 calling BuildCrossSectionLoop(4*subMeshID+2) to determine the section loop of the second sub-mesh divided by the current sub-mesh.
  • Step S5222 determine whether the third sub-grid divided by the current sub-grid is empty.
  • step S5223 When the third sub-grid divided by the current sub-grid is not empty, go to step S5223; when the second sub-grid divided by the current sub-grid is empty, go to step S5224.
  • Step S5223 calling BuildCrossSectionLoop(4*subMeshID+3) to determine the section loop of the third sub-mesh divided by the current sub-mesh.
  • Step S5224 determine whether the fourth sub-grid divided by the current sub-grid is empty.
  • step S5225 When the fourth sub-grid divided by the current sub-grid is not empty, go to step S5225; when the fourth sub-grid divided by the current sub-grid is empty, end the process.
  • Step S5225 calling BuildCrossSectionLoop(4*subMeshID+4) to determine the section loop of the fourth sub-mesh divided by the current sub-mesh.
  • the data processing method provided by the embodiment of the present application reduces the dimensionality of three-dimensional grid data to two-dimensional grid data, thereby being able to deal with grouping problems in a low-dimensional (two-dimensional) without using high-dimensional (three-dimensional) octets
  • the tree is used to deal with the grouping problem, which can reduce the computational complexity, calculate the coordinates of each triangle in the two-dimensional grid data after dimensionality reduction, and construct a sub-grid hierarchical structure.
  • each sub-grid is assigned a triangle grouping set to support multiple "multi-level explosion" effects, and the cross-sectional ring of each sub-grid is determined and cached, which can improve rendering efficiency and achieve real-time rendering.
  • the software modules stored in the data processing device 443 of the memory 440 can be include:
  • the dimensionality reduction module 4431 is configured to obtain the three-dimensional mesh data to be processed, perform dimensionality reduction processing on the three-dimensional mesh data, and obtain two-dimensional mesh data, and the two-dimensional mesh data includes vertex information and triangle information;
  • the hierarchical construction module 4432 is configured to construct a sub-grid hierarchical structure based on the two-dimensional grid data, wherein each hierarchical sub-grid structure includes at least one sub-grid;
  • the triangle grouping module 4433 is configured to perform triangle grouping on the two-dimensional grid data based on each sub-grid, and obtain a triangle grouping set corresponding to each sub-grid;
  • the hierarchical storage module 4434 is configured to store each sub-grid and the triangle grouping set corresponding to each sub-grid hierarchically according to the sub-grid level;
  • the first determining module 4435 is configured to determine the cross-sectional ring of each sub-grid based on the vertex information and the triangle information, and based on the cross-sectional ring of each sub-grid, determine the cross-sectional ring of each sub-grid Sections are rendered.
  • the dimensionality reduction module 4431 is further configured to:
  • the conformal mapping is performed on the three-dimensional coordinate information of each vertex by using the conformal mapping function to obtain the two-dimensional coordinate information of each vertex.
  • the layered building block 4432 is further configured to:
  • N is the number of preset layers, and N is an integer greater than 1 ;
  • the triangle grouping module 4433 is further configured to:
  • the triangle grouping module 4433 is further configured to:
  • the vertex coordinates include a first vertex coordinate value and a second vertex coordinate value
  • the second center coordinate values of the respective triangles are determined based on the three second vertex coordinate values of the respective triangles.
  • the first determination module 4435 is further configured to:
  • Each closed loop formed is determined as a cross-sectional loop of each sub-grid.
  • the first determination module 4435 is further configured to:
  • connection edge with the sharing frequency equal to the first preset value as the target edge in the kth triangle grouping set.
  • the first determination module 4435 is further configured to:
  • the first connecting edge is any connecting edge among the connecting edges.
  • the device also includes:
  • the first acquisition module is configured to acquire the first target level selected when rendering the virtual object corresponding to the two-dimensional grid data
  • a second acquiring module configured to acquire at least one target sub-grid to be rendered in the first target hierarchy
  • the first rendering module is configured to render the at least one target sub-grid to obtain a first rendering result.
  • the device also includes:
  • the second determination module is configured to determine the second target level selected when rendering the virtual object when it is determined that the virtual object rendered based on the two-dimensional grid data meets the decomposition condition;
  • a third determination module configured to determine movement information and rotation information of each sub-grid in the second target hierarchy
  • a fourth determination module configured to determine the rendering position of each sub-grid based on the movement information and rotation information of each sub-grid
  • the second rendering module is configured to render each sub-grid based on the rendering position to obtain a second rendering result.
  • An embodiment of the present application provides a computer program product or computer program, where the computer program product or computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium.
  • the processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the above-mentioned data processing method in the embodiment of the present application.
  • An embodiment of the present application provides a computer-readable storage medium storing executable instructions, wherein executable instructions are stored, and when the executable instructions are executed by a processor, the processor will be caused to execute the data processing method provided in the embodiment of the present application , for example, the data processing method shown in FIG. 4, FIG. 5, FIG. 6A, and FIG. 6B.
  • the computer-readable storage medium may be a ferroelectric random access memory (FRAM, Ferroelectric Random Access Memory), a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read Only Memory) , Erasable Programmable Read Only Memory (EPROM, Erasable Programmable Read Only Memory), Electrically Erasable Programmable Read Only Memory (EEPROM, Electrically Erasable Programmable Read Only Memory), flash memory, magnetic surface memory, optical disc, or read-only Memory such as compact disk memory (CD-ROM, Compact Disc Read-Only Memory); It can also be various devices including one or any combination of the above-mentioned memory.
  • FRAM Ferroelectric random access memory
  • ROM read-only memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read Only Memory
  • EEPROM Electrically Erasable Programmable Read Only Memory
  • flash memory magnetic surface memory
  • optical disc or read-only Memory such as compact disk memory (CD-ROM, Compact Disc Read
  • executable instructions may take the form of programs, software, software modules, scripts, or code written in any form of programming language, including compiled or interpreted languages, or declarative or procedural languages, and its Can be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.
  • executable instructions may, but do not necessarily correspond to files in a file system, may be stored as part of a file that holds other programs or data, for example, in a Hyper Text Markup Language (HTML) document in one or more scripts, in a single file dedicated to the program in question, or in multiple cooperating files (for example, files that store one or more modules, subroutines, or sections of code).
  • HTML Hyper Text Markup Language
  • executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or alternatively, on multiple computing devices distributed across multiple sites and interconnected by a communication network. to execute.

Landscapes

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

Abstract

本申请提供了一种数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品;方法包括:获取待处理的三维网格数据,对三维网格数据进行降维处理,得到二维网格数据;基于二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;基于各个子网格对二维网格数据进行三角形分组,得到各个子网格对应的三角形分组集合;将各个子网格及各个子网格对应的三角形分组集合按照子网格层次进行分层存储;基于顶点信息和三角形信息确定各个子网格的横截面环,并基于各个子网格的横截面环,对各个子网格的横截面进行渲染。

Description

数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品
相关申请的交叉引用
本申请基于申请号为202210050745.3、申请日为2022年1月17日的中国专利申请提出,并要求以上中国专利申请的优先权,以上中国专利申请的全部内容在此引入本申请作为参考。
技术领域
本申请涉及数据处理技术,尤其涉及一种数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品。
背景技术
在计算机图形应用中,为了尽可能真实呈现虚拟对象,往往需要高精度的三维网格数据。然而,数据的复杂性直接关系到渲染时计算成本。并且在相关技术中,进行虚拟对象进行渲染时,是将三维网格数据进行整体渲染,在需要将虚拟对象进行分解显示时,则需要对整体的三维网格数据进行复杂的计算,从而导致渲染需要花费较长时间,从而造成显示的卡顿。
发明内容
本申请实施例提供一种数据处理方法、装置、计算机可读存储介质及计算机程序产品,能够提高渲染效率。
本申请实施例的技术方案是这样实现的:
本申请实施例提供一种数据处理方法,应用于计算机设备,包括:
获取待处理的三维网格数据,对所述三维网格数据进行降维处理,得到二维网格数据,所述二维网格数据包括顶点信息和三角形信息;
基于所述二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;
基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合;
将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;
基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染。
本申请实施例提供一种数据处理装置,包括:
降维模块,配置为获取待处理的三维网格数据,对所述三维网格数据进行降维处理,得到二维网格数据,所述二维网格数据包括顶点信息和三角形信息;
分层构建模块,配置为基于所述二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;
三角形分组模块,配置为基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合;
分层存储模块,配置为将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;
第一确定模块,配置为基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染。
本申请实施例提供一种计算机设备,包括:
存储器,用于存储可执行指令;
处理器,用于执行所述存储器中存储的可执行指令时,实现本申请实施例提供的数据处理方法。
本申请实施例提供一种计算机可读存储介质,存储有可执行指令,用于引起处理器执行时,实现本申请实施例提供的数据处理方法。
本申请实施例提供一种计算机程序产品,包括计算机程序或指令,所述计算机程序或指令被处理器执行时实现本申请实施例提供的数据处理方法。
本申请实施例具有以下有益效果:
在获取到待处理的三维网格数据之后,首先对三维网格数据进行降维处理,得到二维网格数据,该二维网格数据包括顶点信息和三角形信息,之后基于二维网格数据进行后续的处理,能够有效降低计算量,提高计算效率;然后再基于二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格,之后基于各个子网格的区域信息对所述二维网格数据中的三角形进行分组,得到所述各个子网格对应的三角形分组集合,并将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;最后基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染,由于不同层次的子网格结构包括不同个数的子网格,也即不同层次的子网格是按照不同粒度进行子网格划分的,并且将各个子网格和对应的三角形分组集合按照子网格层次进行分层存储,当需要渲染不同粒度子网格时直接获取对应的分层结构即可,并且由于已经将各个三角形分组集合的横截面预先完成渲染,在需要分解渲染时,无需再进行计算,而是直接显示,从而能够提高渲染效率。
附图说明
图1A为顶点、边、面的示意图;
图1B为三维网格示意图;
图1C为二维网格示意图;
图1D为子网格示意图;
图1E为将三维网格进行分割得到空间分层数据结构的示意图;
图1F为将二维网格进行分割得到空间分层数据结构的示意图;
图1G为共形映射示意图;
图1H为横截面的示意图;
图1I为横截面的轮廓环示意图;
图2为本申请实施例提供的数据处理系统架构的结构示意图;
图3为本申请实施例提供的服务器400的结构示意图;
图4为本申请实施例提供的数据处理方法的一种流程示意图;
图5为本申请实施例提供的构建子网格分层结构的实现流程示意图;
图6A为利用本申请实施例提供的数据处理方法进行分层渲染的实现流程示意图;
图6B为利用本申请实施例提供的数据处理方法进行分解渲染的实现流程示意图;
图6C为本申请实施例提供的分解渲染的应用示意图;
图6D为本申请实施例提供的数据处理方法的另一种流程示意图;
图7为本申请实施例提供的降维过程的实现流程示意图;
图8所示的各个步骤确定网格中各个三角形的中心坐标;
图9A为本申请实施例提供的构建子网格层次结构的实现流程示意图;
图9B为本申请实施例提供的子网格层次结构构建函数的实现逻辑示意图;
图9C为本申请实施例提供的子网格分层结构的示意图;
图10A为本申请实施例提供的对二维网格进行三角形分组的实现流程示意图;
图10B为本申请实施例提供的AddTriangle函数的实现逻辑示意图;
图11A为本申请实施例提供的计算截面环的实现流程示意图;
图11B为本申请实施例提供的截面环创建函数的实现逻辑示意图。
具体实施方式
为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,所描述的实施例不应视为对本申请的限制,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。
在以下的描述中,涉及到“一些实施例”,其描述了所有可能实施例的子集,但是可以理解,“一些实施例”可以是所有可能实施例的相同子集或不同子集,并且可以在不冲突的情况下相互结合。
在以下的描述中,所涉及的术语“第一\第二\第三”仅仅是是区别类似的对象,不代表针对对象的特定排序,可以理解地,“第一\第二\第三”在允许的情况下可以互换特定的顺序或先后次序,以使这里描述的本申请实施例能够以除了在这里图示或描述的以外的顺序实施。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。本文中所使用的术语只是为了描述本申请实施例的目的,不是旨在限制本申请。
对本申请实施例进行进一步详细说明之前,对本申请实施例中涉及的名词和术语进行说明,本申请实施例中涉及的名词和术语适用于如下的解释。
1)顶点:是一个数据结构,包含一个2维位置向量[x,y]或3维位置向量[x,y,z]。
2)面:是一个包含3个索引整数的数据结构,索引指示面顶点使用的顶点。
3)边:每个面有3条边。边是包含2个索引整数的数据结构。图1A为顶点、边、面的示意图,在图1A中包括,三个顶点0、1、2,三条边分别为:边[0,1]、边[1,2]、边[2,0],一个面[0,1,2]。
4)网格:是3D游戏对象显示的常用方法,网格是包含顶点数组和面数组的数据结构。
5)三维网格,是包含顶点数组和面数组的数据结构。图1B为三维网格示意图,在图1B所示的三维网格中,每个顶点包含一个3维空间向量,表征顶点的位置[x,y,z]。
6)二维网格,是包含顶点数组和面数组的数据结构。图1C为二维网格示意图,在图1C所示的二维网格中,每个顶点包含一个2维空间向量,表征顶点的位置[x,y]。
7)子网格,是从网格分离出来的更少的网格,图1D为子网格示意图,图1D中包括从图1B所示的三维网格中分离出来的两个子网格。
8)三维空间分层数据结构,通过空间分割等手段,将三维的顶点分组并放在分离的数据结构中。图1E为将三维网格进行分割得到空间分层数据结构的示意图,如图1E所示,将三维网格131进行分割后能够得到132和133,将132再次进行分割得到1321和1322。
9)二维空间分层数据结构,通过空间分割等手段,将二维的顶点分组并放在分离的数据结构中。图1F为将二维网格进行分割得到空间分层数据结构的示意图,如图1F所示,将二维网格141进行分割后能够得到142和143,将142再次进行分割得到1421和1422。
10)共形变换(Conformal map),又称保角变换或者共形映射,来自于流体力学和几何学的概念,是一个保持角度不变的映射。一个映射如果能够保持穿过的曲线间的定向角度和方向,则可以称该映射为为共形(或者保角)变换。共形变换保持了角度以及无穷小物体的形状,但是不一定保持它们的尺寸。共形的性质可以用坐标变换的导数矩阵雅可比矩阵的术语来表述。如果变换的雅可比矩阵处处都是一个纯量乘以一个旋转矩阵,则变换是共形的。图1G为共形映射示意图。
11)三角形顶点索引,网格包含一顶点数组,每个顶点都是一个3维向量(x,y,z)。一个三角形包含3个索引(0,i1,i2)。每个索引都用来索引顶点数组,而得到三角形顶点的位置。
12)横截面,是把网格分开后的可见面,图1H为横截面的示意图,横截面面为图1H中的151,横截面151本来藏在球体。
13)横切面轮廓环,在本申请实施例中又称为横截面环,为横切面的外边缘轮廓,由一个索引数组组成。图1I为横截面的轮廓环示意图,其中图1I中的161为横截面轮廓环。
14)四元树,是一种树状数据结构,在每一个节点上会有四个子区块。四元树常应用于二维空间数据的分析与分类。数据范围可以是方形或矩形或其他任意形状。所有的四元树法有共同之特点:可分解成为各自的区块,每个区块都有节点容量。当节点达到最大容量时,节点分裂树状数据结构依造四元树法加以区分。
本申请实施例提供一种数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品,能够提高渲染效率,下面说明本申请实施例提供的计算机设备的示例性应用,本申请实施例提供的计算机设备可以实施为笔记本电脑,平板电脑,台式计算机,机顶盒,移动设备(例如,移动电话,便携式音乐播放器,个人数字助理,专用消息设备,便携式游戏设备)等各种类型的用户终端,也可以实施为服务器。下面,将说明设备实施为服务器时示例性应用。
参见图2,图2是本申请实施例提供的数据处理系统100的架构示意图,如图1所示,该数据处理系统100包括终端200、网络300和服务器400。其中,设计终端200通过网络300连接服务器400,网络300可以是广域网或者局域网,又或者是二者的组合。
终端200可以是用于设计虚拟场景或虚拟人物的终端,设计人员通过设计终端完成虚拟场景和虚拟人物的设计后,得到对应的三维网格数据,并将三维网格数据发送至服务器400,服务器400在接收到该三维网格数据之后,首先进行降维处理,得到二维网格数据,然后基于二维网格数据构建子网格分层结构,并将二维网格数据中的三角形进行分组,得到多个三角形分组集合,在本申请实施例中,还会确定出各个三角形分组集合的横截面环,并预先渲染出横截面环对应的横截面。服务器400还会将各个子网格 和对应的三角形分组集合按照子网格层次进行分层存储,当需要渲染不同粒度子网格时直接获取对应的分层结构即可,并且由于已经将各个三角形分组集合的横截面预先完成渲染,在需要分解渲染时,无需再进行计算,而是直接显示,从而能够提高渲染效率。
在一些实施例中,服务器400可以是独立的物理服务器,也可以是多个物理服务器构成的服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务、CDN、以及大数据和人工智能平台等基础云计算服务的云服务器。终端200可以是智能手机、平板电脑、笔记本电脑、台式计算机、智能音箱、智能手表、智能车载设备等,但并不局限于此。终端以及服务器可以通过有线或无线通信方式进行直接或间接地连接,本申请实施例中不做限制。
参见图3,图3为本申请实施例提供的服务器400的结构示意图,图3所示的服务器400包括:至少一个处理器410、至少一个网络接口420、总线系统430和存储器440。服务器400中的各个组件通过总线系统430耦合在一起。可理解,总线系统430用于实现这些组件之间的连接通信。总线系统430除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图3中将各种总线都标为总线系统430。
处理器410可以是一种集成电路芯片,具有信号的处理能力,例如通用处理器、数字信号处理器(DSP,Digital Signal Processor),或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等,其中,通用处理器可以是微处理器或者任何常规的处理器等。
存储器440可以是可移除的,不可移除的或其组合。示例性的硬件设备包括固态存储器,硬盘驱动器,光盘驱动器等。存储器440可选地包括在物理位置上远离处理器410的一个或多个存储设备。
存储器440包括易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。非易失性存储器可以是只读存储器(ROM,Read Only Memory),易失性存储器可以是随机存取存储器(RAM,Random Access Memory)。本申请实施例描述的存储器440旨在包括任意适合类型的存储器。
在一些实施例中,存储器440能够存储数据以支持各种操作,这些数据的示例包括程序、模块和数据结构或者其子集或超集,下面示例性说明。
操作系统441,包括用于处理各种基本系统服务和执行硬件相关任务的系统程序,例如框架层、核心库层、驱动层等,用于实现各种基础业务以及处理基于硬件的任务;
网络通信模块442,用于经由一个或多个(有线或无线)网络接口420到达其他计算设备,示例性的网络接口420包括:蓝牙、无线相容性认证(WiFi)、和通用串行总线(USB,Universal Serial Bus)等;
在一些实施例中,本申请实施例提供的装置可以采用软件方式实现,图3示出了存储在存储器440中的数据处理装置443,其可以是程序和插件等形式的软件,包括以下软件模块:降维模块4431、分层构建模块4432、三角形分组模块4433、分层存储模块4434和第一确定模块4435,这些模块是逻辑上的,因此根据所实现的功能可以进行任意的组合或进一步拆分。将在下文中说明各个模块的功能。
在另一些实施例中,本申请实施例提供的装置可以采用硬件方式实现,作为示例,本申请实施例提供的装置可以是采用硬件译码处理器形式的处理器,其被编程以执行本申请实施例提供的数据处理方法,例如,硬件译码处理器形式的处理器可以采用一个或多个应用专用集成电路(ASIC,Application Specific Integrated Circuit)、DSP、可编程逻辑器件(PLD,Programmable Logic Device)、复杂可编程逻辑器件(CPLD,Complex  Programmable Logic Device)、现场可编程门阵列(FPGA,Field-Programmable Gate Array)或其他电子元件。
将结合本申请实施例提供的服务器的示例性应用和实施,说明本申请实施例提供的数据处理方法。
本申请实施例提供一种数据处理方法,该数据处理方法可以是由计算机设备实现的,该计算机设备可以是终端,也可以是服务器,在本申请实施例中以计算机设备是服务器为例进行说明。图4为本申请实施例提供的数据处理方法的一种实现流程示意图,以下结合图4示出的各个步骤对本申请实施例提供的数据处理方法进行说明。
步骤S101,获取待处理的三维网格数据,对三维网格数据进行降维处理,得到二维网格数据。
网格数据为包括顶点数据和面数组的数据结构,通过三维网格数据可以构建出三维虚拟对象。三维网格数据与二维网格数据的不同在于,三维网格数据中,顶点数据中的各个顶点位置坐标用三维空间向量[x,y,z]来表征,在二维网格数据中,顶点数据中的对各个顶点位置坐标用二维空间向量[x,y]来表征。对三维网格数据进行降维处理得到二维网格数据在实现时,是利用预设的映射函数将三维的顶点位置坐标转换为二维的顶点位置坐标。
二维网格数据包括顶点信息和三角形信息。顶点信息可以是一个顶点数组,该顶点数组包括多个顶点索引,还可以包括各个顶点索引对应的顶点位置坐标(也即二维的顶点位置向量),三角形信息可以是一个三角形数组(也可以称为面数组),该三角形数组中包括每个三角形的顶点索引。
步骤S102,基于二维网格数据,构建子网格分层结构。
其中,不同层次的子网格结构包括不同个数的子网格。在一些实施例中,可以将初始的二维网格数据确定为第一层次的子网格,然后对初始的二维网格数据进行划分,得到多个第二层次的子网格,再继续对每个第二层次的子网格进行划分,得到第三层次的多个子网格,再继续进行划分,直至得到预设的层级次数,从而得到子网格分层结构。由于除第一层次的子网格之外,每个层次的子网格都是对上一层次的子网格进行划分得到的,因此,不同层次的子网格结构包括的子网格数是不同的。
步骤S103,基于各个子网格对二维网格数据进行三角形分组,得到各个子网格对应的三角形分组集合。
步骤S103在实现时,可以基于各个子网格的区域信息对二维网格数据进行三角形分组,子网格的区域信息可以是指能够包围住子网格的最小矩形区域的顶点坐标,例如可以是该最小矩形区域的左下角顶点的顶点坐标和右上角顶点的顶点坐标。
在基于各个子网格的区域信息对二维网格数据进行三角形分组时,首先确定二维网格数据中各个三角形的中心坐标,然后按照层次顺序确定每个层次中各个子网格对应的三角形分组集合,在一些实施例中,可以将位于子网格所在矩形区域的三角形构成该子网格对应的三角形分组集合。
步骤S104,将各个子网格及各个子网格对应的三角形分组集合按照子网格层次进行分层存储。
也就是说,将第一层次的子网格及该第一层次的子网格对应的三角形分组集合进行存储,将第二层次的子网格及各个第二层级子网格对应的三角形分组自己进行存储,依次类推。由于不同层次的子网格是按照不同粒度进行子网格划分的,并且将各个子网格和对应的三角形分组集合按照子网格层次进行分层存储,当需要渲染不同粒度子网格时直接获取对应的分层结构即可,从而能够提高渲染效率。
步骤S105,基于顶点信息和三角形信息确定各个子网格的横截面环,并基于各个 子网格的横截面环,对各个子网格的横截面进行渲染。
步骤S105在实现时,可以基于顶点信息和三角形信息确定出二维网格中存在于边缘的连接边,并基于仅存在于边缘的连接边确定各个子网格的横截面环,也即横截面环包括仅存在于一个三角形的连接边(目标边),然后再基于各个子网格的横截面环,确定出对应的横截面,横截面也即是把不同的网格分开后的可见面,该横截面在正常渲染该二维网格数据对应的虚拟对象时是不可见的,而是隐藏在内部的。在相关技术中,隐藏在内部的横截面在渲染虚拟对象时是不进行渲染的,只有在横截面可见时,才会确定显示出的横截面,并进行渲染。在本申请实施例中,会在渲染二维网格数据对应的虚拟对象时,对各个子网格的横截面进行渲染,如此能够在需要对虚拟对象进行分解显示时,无需进行分解计算和渲染,直接显示即可,能够提高显示效率。
在本申请实施例提供的数据处理方法中,在获取到待处理的三维网格数据之后,首先对三维网格数据进行降维处理,得到二维网格数据,该二维网格数据包括顶点信息和三角形信息,之后基于二维网格数据进行后续的处理,能够有效降低计算量,提高计算效率;然后再基于二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格,之后基于各个子网格的区域信息对所述二维网格数据中的三角形进行分组,得到所述各个子网格对应的三角形分组集合,并将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;最后基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染,由于不同层次的子网格结构包括不同个数的子网格,也即不同层次的子网格是按照不同粒度进行子网格划分的,并且将各个子网格和对应的三角形分组集合按照子网格层次进行分层存储,当需要渲染不同粒度子网格时直接获取对应的分层结构即可,并且由于已经将各个三角形分组集合的横截面预先完成渲染,在需要分解渲染时,无需再进行计算,而是直接显示,从而能够提高渲染效率。
在一些实施例中,上述步骤S101中的“对三维网格数据进行降维处理,得到二维网格数据”,可以通过下述的步骤S1011至步骤S1013实现,以下对各个步骤进行说明。
步骤S1011,获取预设的共形映射函数。
共形映射是复变函数论的一个分支,它从几何的观点来研究复变函数,通过共形映射函数能够把一个区域映射到另一个区域进行研究。这个性质可以将一些不规则或者不好用数学公式表达的区域边界映射成规则的或已成熟的区域边界。在本申请实施例中,该预设的共形映射函数能够将三维空间映射到二维空间,并且保持角度不变。
步骤S1012,从所述三维网格数据中获取各个顶点的三维坐标信息。
在一些实施例中,可以基于各个顶点的顶点索引获取对应的三维坐标信息,该三维坐标信息表征顶点在三维空间的位置。
步骤S1013,利用所述共形映射函数对所述各个顶点的三维坐标信息进行共形映射,得到所述各个顶点的二维坐标信息。
在一些实施例中,可以将各个顶点的三维坐标信息代入共形映射函数,即可得到各个顶点的二维坐标信息。
通过上述的步骤S1011至步骤S1013,能够利用共形映射函数将三维网格数据进行降维,得到二维网格数据,基于二维网格数据进行后续的处理,能够有效降低计算量,提高计算效率。
在一些实施例中,上述的步骤S102“基于所述二维网格数据,构建子网格分层结构”可以通过图5所示的步骤S1021至步骤S1025实现,以下结合图5对各个步骤进行说明。
步骤S1021,将二维网格数据对应的网格确定为第一层次子网格。
步骤S1022,获取各个第i层次的子网格对应的第i目标区域的顶点坐标和中心坐 标。
在本申请实施例中,第i层次的各个子网格都对应有一个第i目标区域,在该步骤中获取的是第i层次的各个子网格对应第i目标区域的顶点坐标和中心坐标。i=1,2,..,(N-1),N为预设层次数,N为大于1的整数。
当i为1时,该步骤也即获取第一层次子网格对应第一目标区域的顶点坐标和中心坐标。第一层次子网格对应的第一目标区域为包含网格内所有三角形的最小矩形区域,第一目标区域的顶点坐标可以是左下角顶点的坐标和右上角顶点的坐标,也可以是四个顶点的坐标,中心坐标可以是基于左下角顶点的坐标和右上角顶点的坐标确定的。假设左下角顶点的坐标为(x 1,y 1),右上角顶点的坐标为(x 2,y 2),第一目标区域的中心坐标为((x 1+x 2)/2,(y 1+y 2)/2)。
例如,当i为2时,第二层次子网格有4个,那么,在该步骤中确定的是这4个子网格对应的第二目标区域的顶点坐标和中心坐标。
步骤S1023,基于所述第i目标区域的顶点坐标和中心坐标对所述各个第i层次子网格进行划分,得到多个第(i+1)层次子网格。
如果i为1,步骤S1023在实现时,可以将第一层次子网格划分为两个部分,例如可以基于中心坐标延矩形的长度方向进行划分,也可以是基于中心坐标延矩阵的宽度方向进行划分;在一些实施例中,也可以将第一层次的子网格划分为四个部分,例如可以基于中心坐标延矩形的长度方向和宽度方向进行划分,得到四个第二层次子网格。
在本申请实施例中,还会为每个层级的子网格设置子网格标识,假设每个子网格再次划分为4个子网格,第一层次子网格的标识可以为0,第二层次子网格的标识可以是4*(上一层次父网格标识)+1、4*(上一层次父网格标识)+2、4*(上一层次父网格标识)+3和4*(上一层次父网格标识)+4,那么,四个第二层次子网格的标识分别为1、2、3、4。将子网格标识为1的子网格再次进行划分得到的四个第三层次子网格的标识分别为5、6、7、8;将子网格标识为2的第二层次子网格再次划分得到的四个第三层次子网格的标识分别为9、10、11、12,以此类推,将子网格标识为3的第二层次子网格再次划分得到的四个第三层次子网格的标识分别为13、14、15、16;将子网格标识为4的第二层次子网格再次划分得到的四个第三层次子网格的标识分别为17、18、19、20。
需要说明的是,在对第i层次子网格进行划分得到第(1+1)层次的子网格时,是将第i层次的每个子网格进行划分,并且每个子网格再次划分的子网格数是相同的。例如第二层次子网格是将第一层次子网格划分为4份得到的,也即第二层次子网格包括4个子网格,在将第二层次子网格进行划分得到第三层次子网格时,将这4个子网格中的每一个再次划分为4个子网格,那么第三层次子网格包括16个子网格。通过上述步骤S1021至步骤S1025即构建出子网格分层结构,从而为后续的三角形分组提供必要的数据基础。
在一些实施例中,上述步骤S103“基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合”,可以通过以下步骤实现:
步骤S1031,基于所述顶点信息和所述三角形信息确定各个三角形的中心坐标。
步骤S1031在实现时,基于三角形信息中包括的各个三角形的顶点索引,从顶点信息中获取三角形的三个顶点坐标,然后再基于三角形的三个顶点坐标,确定该三角形的中心坐标。
假设三角形的三个顶点坐标分别为(x t1,y t1)、(x t2,y t2)、(x t3,y t3),那么该三角形的中心坐标为((x t1+x t2+x t3)/3,(y t1+y t2+y t3)/3)。
步骤S1032,基于各个子网格的区域信息获取第j个子网格的顶点坐标。
其中,j=1,2,…,M,M为子网格总数,M为正整数。子网格的区域信息是指能够包围住子网格的最小矩形区域的顶点坐标,第j个子网格的顶点坐标可以是第j个子网格对应矩形区域两个对角的顶点坐标,例如可以是左下角顶点坐标和右上角顶点坐标,也可以是左上角顶点坐标和右下角顶点坐标。
步骤S1033,基于所述各个三角形的中心坐标和所述第j个子网格的顶点坐标,将中心坐标位于所述第j个子网格对应的目标区域的三角形分配至所述第j个子网格对应的三角形分组集合中。
步骤S1033在实现时,将每个三角形的中心坐标与第j个子网格的顶点坐标进行比较,以确定三角形是否位于第j个子网格对应的目标区域,假设第j个子网格对应目标区域的左下角顶点坐标为(x 1,y 1),右上角顶点的坐标为(x 2,y 2)某三角形的中心坐标为(x c1,y c1),判断该三角形是否位于该第j个子网格对应目标区域,在一些实施例中,判断是否满足x 1<x c1<x 2且y 1<y c1<y 2,当满足x 1<x c1<x 2且y 1<y c1<y 2时确定该三角形位于该第j个子网格对应的目标区域,将三角形分配至所述第j个子网格对应的三角形分组集合中;当不满足x 1<x c1<x 2且y 1<y c1<y 2时确定该三角形不位于该第j个子网格对应的目标区域,此时确定下一个三角形是否在该第j个子网格对应的目标区域。
由于不同层次的子网格是按照不同粒度进行划分得到的,在划分好子网格后,通过上述步骤S1031至步骤S1033,可以基于三角形的中心坐标确定出位于每个子网格的三角形,之后当需要渲染某些部分子网格内容时,直接渲染位于这些子网格对应的数据即可,从而能够提高渲染效率。
在一些实施例中,上述步骤S1031“基于所述顶点信息和所述三角形信息确定各个三角形的中心坐标”可以通过下述的步骤S311至步骤S313实现,以下对各个步骤进行说明。
步骤S311,基于所述顶点信息和所述三角形信息确定各个三角形的三个顶点坐标。
步骤S311在实现时,可以从三角形信息对应的三角形数组中,获取每个三角形的顶点索引,然后再基于三角形的顶点索引从顶点信息中获取顶点索引对应的顶点坐标,其中,该顶点坐标包括第一顶点坐标值和第二顶点坐标值,也即该顶点坐标为二维位置向量。例如某一顶点的顶点坐标为(x d1,y d1),其中第一顶点坐标值为x d1,第二顶点坐标值为y d1
步骤S312,基于所述各个三角形的三个第一顶点坐标值确定所述各个三角形的第一中心坐标值。
在一些实施例中,可以是将三角形的三个第一顶点坐标值进行算术平均,得到该三角形的第一中心坐标值。例如第一个三角形的三个第一顶点坐标值分别为x d1、x d2、x d3,那么该三角形的第一中心坐标值为(x d1+x d2+x d3)/3。
步骤S313,基于所述各个三角形的三个第二顶点坐标值确定所述各个三角形的第二中心坐标值。
与步骤S312类似,步骤S313在实现时,可以是将三角形的三个第二顶点坐标值进行算术平均,得到该三角形的第二中心坐标值。例如第一个三角形的三个第一顶点坐标值分别为y d1、y d2、y d3,那么该三角形的第一中心坐标值为(y d1+y d2+y d3)/3。
通过上述的步骤S311至步骤S313,能够计算出各个三角形的中心坐标,从而在后续过程中利用三角形的中心坐标进行三角形分组,而不是利用三个顶点坐标来进行三角形分组,能够在很大程度上降低计算量,提升计算效率。
在一些实施例中,上述步骤S105“基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环”,可以通过以下步骤实现:
步骤S1051,基于所述顶点信息和所述三角形信息确定各个三角形分组集合中的目 标边。
该步骤在实现时,首先确定各个三角形分组集合中所包括的连接边的共用次数,该共用次数能够表征连接边是仅存在于一个三角形的边还是存在于两个三角形的边,然后再基于共用次数确定出仅存在于一个三角形的目标边。
步骤S1052,从所述各个三角形分组集合中的多个目标边中确定出首尾相接且能构成闭环的目标边。
通过上述步骤S1051将各个三角形分组中的目标边识别出来,目标边在一些实施例中也可以称为边缘边,或者开放边(Open edge),在该步骤中,可以基于各个目标边的起点和终点,确定出首尾相接且能构成闭环的目标边。简单举例来说,假设有6个目标边,分别为边1(A,B)、边2(B,C)、边3(C,D)、边4(D,A)、边5(E,F)、边6(H,I),可以发现,边1、边2、边3、边4彼此的终点是相邻边的起点,且形成了闭环,因此边1、边2、边3、边4为首尾相接且能构成闭环的目标边。
步骤S1053,将构成的各个闭环确定为所述各个子网格的横截面环。
在该步骤中,将步骤S1052得到的闭环确定为各个子网格的横截面环,如果横截面环构成的横截面为相邻子网格分离后才显示出的截面,那么将一个层次的子网格全部渲染出来时则不会显示该横截面。在本申请的一些实施例中,在确定出各个子网格的横截面环之后,会预先完成渲染,在需要分解显示虚拟对象时,则可直接显示,从而能够提高显示效率。
在一些实施例中,上述步骤S1051“基于所述顶点信息和所述三角形信息确定各个三角形分组集合中的目标边”,包括:
步骤S511,基于所述顶点信息和所述三角形信息确定第k个三角形分组集合中的各个连接边。
这里,k=1,2,…,M,M为子网格总数,该步骤在实现,可以获取第k个三角形分组集合中每个三角形的顶点索引,然后再基于顶点索引确定出顶点坐标,基于三角形的顶点坐标之间的位置关系,确定出三角形的三条连接边。
例如,一个三角形的三个顶点OPQ的坐标分别为(x o,y o)、(x p,y p)、(x q,y q),在本申请实施例中假设三角形的顶点之间是顺时针方向连接,那么可以基于三个顶点的坐标可以确定出三个顶点的连接关系,假设三个顶点按照顺时针方向为POQ的顺序,那么三角形的三条连接边分别为PO、OQ、QP。在该步骤中确定出三角形分组集合中各个三角形的连接边。例如,三角形分组集合中有10个三角形,那么该三角形分组集合中包括30个连接边。
步骤S512,基于所述三角形信息确定所述各个连接边的共用次数。
该步骤在实现时,首先将所述各个连接边的共用次数设置为第一预设值;然后依次判断是否存在与第一连接边具有相同顶点且方向相反的第二连接边,当除第一连接边之外的其他连接边中存在与所述第一连接边具有相同顶点且方向相反的第二连接边时,将所述第一连接边的共用次数更新为第二预设值;其中,所述第一连接边为所述各个连接边中的任一连接边。当除第一连接边之外的其他连接边中不存在与所述第一连接边具有相同顶点且方向相反的第二连接边时,保持第一连接边的共用次数为第一预设值。例如第一预设值可以为1,第二预设值为1,第二预设值还可以为0。
也就是说,当一个连接边只存在于一个三角形时,共用次数为第一预设值,当一个连接边不止存在于一个三角形时,共用次数为第二预设值。
步骤S513,将共用次数为第一预设值的连接边确定为第k个三角形分组集合中的目标边。
通过上述步骤S511至步骤S513,以三角形分组集合为单位,确定每个三角形分组 集合中仅存在于一个三角形的目标边,从而在基于确定出的目标边中确定三角形分组集合对应子网格的横截面环。
在一些实施例中,如图6A所示,在步骤S105之后,还可以通过下述的步骤S106A至步骤S108A进行渲染过程,以下对各个步骤进行说明。
步骤S106A,获取渲染所述二维网格数据对应的虚拟对象时选用的第一目标层次。
该步骤在实现时,可以由技术人员预先设置好渲染虚拟对象时所选用的第一目标层次,例如,可以预先设置好选用第二目标层次,且会设置好渲染第二目标层次的全部子网格还是部分子网格,当渲染第二目标层次的部分子网格时,还要设置需要渲染的子网格标识。
也可以根据实际的虚拟场景需求确定渲染虚拟对象时所选用的第一目标层次,例如根据实际的虚拟场景需求确定需要渲染完整的虚拟对象时,则确定第一目标层次为第一层次,如果根据实际的虚拟场景需求确定需要渲染四分之三的虚拟对象时,可以确定第一目标层次为第二层次。
步骤S107A,获取所述第一目标层次中待渲染的至少一个目标子网格。
如果第一目标层次是由技术人员预先设置好的,那么会同时预先设置需要渲染第一目标层次的哪些子网格,此时直接获取设置信息即可获取到待渲染的至少一个目标子网格的标识。如果第一目标层次是基于实际的虚拟场景需求确定的,那么在实现时,是基于需要渲染全部还是渲染部分,以及渲染部分的大小确定选用哪个层次作为第一目标层次,也就是说,在确定第一目标层次时已经确定出需要渲染的部分,那么也就能够确定出需要渲染的子网格对应的标识,例如确定需要渲染虚拟对象的3/4,并且不需要渲染2号子网格,那么此时需要渲染的即为1、3、4三个子网格。再例如确定需要渲染虚拟对象的13/16,确定第一目标层次为第三层次,并且不需要渲染8、9、10三个子网格,那么就可以确定出渲染其他13个子网格。
步骤S108A,对所述至少一个目标子网格进行渲染,得到第一渲染结果。
在该步骤中,基于至少一个目标子网格中的多个三角形进行渲染,即可得到第一渲染结果。
由于在前述步骤中,已经构建了子网格分层结构,并且对每个层次的子网格划分了三角形分组,因此在需要渲染部分虚拟对象时,通过上述步骤S106A至步骤S108A,可以直接基于需要渲染部分的大小确定对应的层次以及待渲染的子网格,从而提高渲染效率。
在一些实施例中,如图6B所示,在步骤S105之后,还可以通过下述的步骤S106B至步骤S109B进行分解渲染,以下对各个步骤进行说明。
步骤S106B,当确定基于所述二维网格数据渲染出的虚拟对象达到分解条件时,确定渲染所述虚拟对象时选用的第二目标层次。
在实现时,可以是检测到一虚拟对象与其他虚拟对象发生碰撞时,确定达到分解条件,此时可以根据碰撞力度确定渲染虚拟对象时选用的第二目标层次。比如碰撞力度小时,会有小部分分解出来,那么选用较高层级的第二目标层次,例如可以选用第三层次,在第三层次中包括16个子网格。在一些实施例中,当确定虚拟对象达到预设的爆破时机时,确定达到分解条件,此时可以根据预设的爆破威力确定渲染虚拟对象时选用的第二目标层次。
步骤S107B,确定所述第二目标层次中各个子网格的移动信息和旋转信息。
在本申请实施例中,每个层次的各个子网格还具有预设的移动信息和旋转信息,在不需要分解渲染时,不会获取移动信息和旋转信息,之后在需要分解渲染虚拟对象时才会获取移动信息和旋转信息。移动信息用于表征目标渲染位置与当前位置的距离,旋 转信息用于表征目标渲染朝向与当前渲染朝向的旋转角度和旋转方向。
步骤S108B,基于所述各个子网格的移动信息和旋转信息确定所述各个子网格的渲染位置。
该步骤在实现时,可以获取各个子网格的初始位置和初始朝向,在获取到各个子网格的移动信息和旋转信息之后,就可以利用各个子网格的移动信息和初始位置、初始朝向和旋转信息确定出各个子网格的渲染位置。
步骤S109B,基于所述渲染位置对所述各个子网格进行渲染,得到第二渲染结果。
不同子网格之间的移动信息可能是相同的,也可能是不同的,不同子网格之间的旋转信息可能是相同的,也可能是不同的,当两个或者两个以上子网格的移动信息和旋转信息均相同时,说明这两个或两个以上子网格是以一个整体进行渲染的。例如以第三层次的16个子网格为例进行说明。假设在分解渲染时,第8、9、10、15个子网格的渲染位置不同于其他子网格,除8、9、1、150之外的其他12个子网格作为一个整体渲染,那么基于各个子网格的渲染位置为各个子网格进行渲染,得到第二渲染结果。图6C中501为按照原网格渲染出的虚拟对象,502为破碎过程中渲染出的虚拟对象,503为破碎完成后分解渲染出的虚拟对象。
通过上述步骤S106B至步骤S109B,能够在虚拟对象达到分解条件时,基于预先构建的子网格分层结构确定渲染所用的第二目标层次,并且基于第二目标层次的各个子网格的移动信息和旋转信息确定出各个子网格的渲染位置,从而进行渲染,能够高效实现虚拟对象的分解渲染。并且在步骤S105中,已经对对各个子网格的横截面进行了预先渲染,如此能够在需要对虚拟对象进行分解显示时,无需进行分解计算和渲染,直接显示即可,能够提高显示效率。
下面,将说明本申请实施例在一个实际的应用场景中的示例性应用。
本申请实施例提供的数据处理方法,可以应用于游戏场景或者虚拟现实场景,这里以应用于游戏场景为例进行说明。当游戏场景中包括会产生爆炸或分解的虚拟对象(例如虚拟对象为定时炸弹)时,按照该虚拟对象的三维网格渲染出的虚拟对象如图6C中的501所示,而利用本申请实施例提供的数据处理方法,首先将虚拟对象的三维网格数据进行降维处理,得到二维网格数据;然后再基于二维网格数据,构建子网格分层结构,之后所述二维网格数据中的三角形进行分组,得到所述各个子网格对应的三角形分组集合;最后确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染。在渲染出图6C中501所示的虚拟对象时,会基于虚拟对象的爆炸威力和预先构建的子网格分层结构确定渲染所用的第二目标层次,并且基于第二目标层次的各个子网格的移动信息和旋转信息确定出各个子网格在爆炸过程中的渲染位置和爆炸之后的渲染位置,然后基于爆炸过程中的渲染位置渲染出图6C中502所示的虚拟对象,基于爆炸之后的渲染位置渲染出图C中503所示的虚拟对象。由于爆炸分解之后产生的横截面已经预先渲染完成,因此能够高效实现虚拟对象的分解渲染。
本申请实施例提供一种数据处理方法,首先通过一个共形变换(Conformal map)的算法将三维网格转换为二维网格。之后把二维网格以空间分层数据结构(Spatial Hierarchical Data structure)分组,空间分层数据结构可以是Quad Tree、K-D Tree等,最后将同组的三角形顶点索引保存在同一节点。此外,该方法还可以支持子分组。
图6D为本申请实施例提供的三维网格分层数据结构表示方法的再一种实现流程示意图,以下结合图6D对该方法的实现过程进行说明。
步骤S601,将三维网格降维至二维网格。
步骤S602,确定二维网格中各个三角形的中心。
步骤S603,构建子网格层次结构。
步骤S604,对二维网格进行三角形分组。
步骤S605,确定截面环。
以下结合图示,对各个步骤的实现过程进行说明。
图7为本申请实施例提供的降维过程的实现流程示意图,如图7所示,可以通过以下步骤将三维网格降维至二维网格:
步骤S6011,确定共形映射函数。
在本申请实施例中,共形映射函数可以用ConformMap()来表示,该函数是将3D向量转换为2D纹理坐标uv。对于每个网格顶点,通过共形映射函数能够确定出相应的二维纹理坐标。
步骤S6012,将网格顶点索引((meshVertIdx))设置为0。
步骤S6013,利用共形映射函数从顶点位置计算纹理坐标。
在实现时,可以利用公式(1-1)计算顶点纹理坐标:
mesh.uv[meshVertIdx]=ConformMap(Meshvert[meshVertIDx])     (1-1);
步骤S6014,网格顶点索引加1。
步骤S6015,判断网格顶点索引是否小于网格顶点数。
其中,如果网格顶点索引小于网格顶点数,则进入步骤S6012;如果网格顶点索引不小于网格顶点数,说明已经完成降维过程,此时进入步骤S602进行三角形中心计算。
在对网格中每个顶点进行降维,确定出各个顶点的索引后,可以通过图8所示的各个步骤确定网格中各个三角形的中心坐标,以下结合图8对确定三角形中心的实现过程进行说明。
步骤S6021,将三角形索引(triangleIDx)设置为0。
步骤S6022,获取第triangleIDx个三角形的第一个顶点的索引和顶点位置。
其中,i0=triangles[triangleIdx].indices[0],v0=mesh.vert[i0]。
步骤S6023,获取第triangleIDx个三角形的第二个顶点的索引和顶点位置。
其中,i1=triangles[triangleIdx].indices[1],v1=mesh.vert[i1]。
步骤S6024,获取第triangleIDx个三角形的第三个顶点的索引和顶点位置。
其中,i2=triangles[triangleIdx].indices[2],v2=mesh.vert[i2]。
步骤S6025,计算三角形中心。
其中,可以根据triangle_center[TriangleIdx]=(v0+v1+v2)/3,计算出三角形中心。
步骤S6026,将三角形索引triangleIDx加1。
步骤S6027,判断三角形索引是否小于网格三角形数。
其中,如果三角形索引小于网格三角形数,说明还存在未计算三角形中心的网格三角形,此时进入步骤S6022;如果三角形索引不小于网格三角形数,说明已完成网格内所有三角形中心的计算,此时进入步骤S603。
图9A为本申请实施例提供的构建子网格层次结构的实现流程示意图,以下结合图9A的各步骤对构建子网格层次结构的实现过程进行说明。
步骤S6031,获取最大子网层级以及根子网格ID的初始值和根子网格的顶点坐标的初始值。
在本申请实施例中,示例性示出最大子网层级为4、根子网格ID的初始值为0、根子网格的左下角的坐标的初始值为(0,0),右上角的顶点坐标初始值为(1,1)。
步骤S6032,调用子网格层次结构构建函数以完成子网格层次结构构建。
子网格层次构建函数可以为SubMesh(SubMeshLevel,SubMeshID,lowerLeft,upperRight),步骤S6032在实现时,可以通过rootMesh=SubMesh(maxSubMeshLevel,rootSubMeshID,rootSubMeshLowerLeft,rootSubMeshUpperRight)完成子网格层次结构 构建。其中maxSubMeshLevel为最大子网层级,rootSubMeshID为根子网格ID,rootSubMeshLowerLeft为根子网格的左下角的坐标,rootSubMeshUpperRight根子网格的右上角的坐标。
图9B为本申请实施例提供的子网格层次结构构建函数的实现逻辑示意图,以下结合图9B对该函数的实现逻辑进行说明。
步骤S321,将subMeshes[subMeshID]确定为当前子网格。
也即,currentSM=subMeshes[subMeshID]。
步骤S322,将subMeshID设置为当前子网格ID,将subMeshID的左下角的坐标设置为当前子网格的左下角顶点坐标,将subMeshID的右上角的坐标设置为当前子网格的右上角顶点坐标。
也即currentSM.subMeshID=rootsubMeshID,currentSM.lowerLeft=rootSubMeshLowerLeft,currentSM.upperRight=rootSubMeshUpperRight。
步骤S323,判断子网格层级是否为非0。
当子网格层级为非0时,进入步骤S324;当子网格层级为0时,进入步骤S329。
步骤S324,调用SubMesh(SubMeshLevel-1,4*SubMeshID+1,currentSM.GetSouthWest(),currentSM.GetCenter())确定当前子网格的第一个子网格。
其中,GetSouthWest()为获取当前子网格的西南部坐标的函数,该函数返回的是一个位置坐标,该位置坐标为(lowerLeft.x,lowerLeft.y),GetCenter()为获取当前子网格的中心坐标的函数,该函数返回的是位置坐标为((lowerLeft.x+upperRight.x)*0.5,(lowerLeft.y+upperRight.y)*0.5)。当前子网格的第一个子网格ID为4*当前子网格ID+1,当前子网格的第一个子网格的左下角坐标为当前子网格的西南部坐标,当前子网格的第一个子网格的右上角坐标为当前子网格的中心坐标。
步骤S325,调用SubMesh(SubMeshLevel-1,4*SubMeshID+2,currentSM.GetWest(),GetNorth())确定当前子网格的第二个子网格。
其中,GetWest()为获取当前子网格的西部坐标的函数,该函数返回的是一个位置坐标,该位置坐标为(lowerLeft.x,(lowerLeft.y+upperRight.y)*0.5),GetNorth()为获取当前子网格的北部坐标的函数,该函数返回的是位置坐标为((lowerLeft.x+upperRight.x)*0.5,upperRight.y)。当前子网格的第二个子网格ID为4*当前子网格ID+2,当前子网格的第二个子网格的左下角坐标为当前子网格的西部坐标,当前子网格的第二个子网格的右上角坐标为当前子网格的北部坐标。
步骤S326,调用SubMesh(SubMeshLevel-1,4*SubMeshID+3,currentSM.GetSouth(),GetEast())确定当前子网格的第三个子网格。
其中,GetSouth()为获取当前子网格的南部坐标的函数,该函数返回的是一个位置坐标,该位置坐标为((lowerLeft.x+upperRight.x)*0.5,lowerLeft.y),GetEast()为获取当前子网格的西部坐标的函数,该函数返回的是位置坐标为(lowerLeft.x,(lowerLeft.y+upperRight.y)*0.5)。当前子网格的第三个子网格ID为4*当前子网格ID+3,当前子网格的第三个子网格的左下角坐标为当前子网格的南部坐标,当前子网格的第三个子网格的右上角坐标为当前子网格的西部坐标。
步骤S327,调用SubMesh(SubMeshLevel-1,4*SubMeshID+4,currentSM.GetCenter(),GetNorthEast())确定当前子网格的第四个子网格。
其中,GetNorthEast()为获取当前子网格的东北部坐标的函数,该函数返回的是一个位置坐标,该位置坐标为(upperRight.x,upperRight.y)。当前子网格的第四个子网格ID为4*当前子网格ID+4,当前子网格的第四个子网格的左下角坐标为当前子网格的中心坐标,当前子网格的第四个子网格的右上角坐标为当前子网格的东北部坐标。
步骤S328,返回当前子网格。
步骤S329,设置当前子网格的第一个子网格、第二个子网格、第三个子网格和第四个子网格均为空。
图9C为本申请实施例提供的子网格分层结构的示意图,如图9C所示,每个子网格都有它的子网格,其中,根子网格为子网格0,子网格0划分为子网格1、子网格2、子网格3和子网格4,子网格1又划分为子网格5、子网格6、子网格7和子网格8,子网格5又划分为子网格21、子网格22、子网格23和子网格24。实际上子网格2、子网格3和子网格4以及子网格6、子网格7和子网格8还会继续划分子网格,在图9C中未示出。
图10A为本申请实施例提供的对二维网格进行三角形分组的实现流程示意图,以下结合图10A对二维网格进行三角形分组的实现过程进行说明。
步骤S6041,将mesh.triangles设置为SourceTriangle,将根子网格ID初始化为0。
步骤S6042,利用AddTriangle函数为各个子网格分配三角形分组集合。
AddTriangle函数可以为AddTriangle(subMeshID,triangles),步骤S6042在实现时,可以将rootSubMeshID和SourceTriangle作为函数参数,完成三角形分组。
图10B为本申请实施例提供的AddTriangle函数的实现逻辑示意图,以下结合图10B对AddTriangle函数的实现逻辑进行说明。
步骤S421,将subMeshes[subMeshID]确定为当前子网格。
也即,currentSM=subMeshes[subMeshID]。
步骤S422,将参数i初始化为0。
步骤S423,获取第i个三角形的中心坐标c。
步骤S424,判断是否满足c.x>=currentSM.lowerLeft.x并且c.x<currentSM.upperRight.x。
其中,如果满足c.x>=currentSM.lowerLeft.x并且c.x<currentSM.upperRight.x,说明第i个三角形的中心坐标的x坐标在当前子网格的x坐标范围内,此时进入步骤S425;如果不满足c.x>=currentSM.lowerLeft.x并且c.x<currentSM.upperRight.x,进入步骤S427。
步骤S425,判断是否满足c.y>=currentSM.lowerLeft.y并且c.y<currentSM.upperRight.y。
其中,如果满足c.y>=currentSM.lowerLeft.y并且c.y<currentSM.upperRight.y进入步骤S426;如果不满足c.y>=currentSM.lowerLeft.y并且c.y<currentSM.upperRight.y,进入步骤S427。
步骤S426,将第i个三角形添加至当前子网格对应的三角形分组集合中。
步骤S427,将i的取值累加1,也即i=i+1。
步骤S428,确定i是否小于三角形总数。
其中,当i小于三角形总数,进入步骤S423;当i不小于三角形总数,说明已经对当前子网格分组完毕,此时进入步骤S429。
步骤S429,确定当前子网格划分出的第一个子网格是否为空。
如果当前子网格划分出的第一个子网格不为空,进入步骤S4210;如果当前子网格划分为出的第一个子网格为空,进入步骤S4211。
步骤S4210,调用AddTriangle(4*subMeshID+1,triangles)为当前子网格划分出的第一子网格分配三角形分组集合。
步骤S4211,确定当前子网格划分出的第二个子网格是否为空。
如果当前子网格划分出的第二个子网格不为空,进入步骤S4212;如果当前子网格划分为出的第二个子网格为空,进入步骤S4213。
步骤S4212,调用AddTriangle(4*subMeshID+2,triangles)为当前子网格划分出的第二子网格分配三角形分组集合。
步骤S4213,确定当前子网格划分出的第三个子网格是否为空。
如果当前子网格划分出的第三个子网格不为空,进入步骤S4214;如果当前子网格划分为出的第二个子网格为空,进入步骤S4215。
步骤S4214,调用AddTriangle(4*subMeshID+3,triangles)为当前子网格划分出的第三子网格分配三角形分组集合。
步骤S4215,确定当前子网格划分出的第四个子网格是否为空。
如果当前子网格划分出的第四个子网格不为空,进入步骤S4216;如果当前子网格划分为出的第四个子网格为空,进入步骤S605。
步骤S4216,调用AddTriangle(4*subMeshID+4,triangles)为当前子网格划分出的第四子网格分配三角形分组集合。
通过上述步骤S421至步骤S4216,对于网格(mesh.triangles)的所有三角形,将其放入函数Adds Triangle进行处理,该函数会检查各个三角形中心是否在子网格的矩形区域内。如果三角形在子网格所在矩形区域内,则将该三角形添加到该子网格的三角形分组集合中,处理完所有的三角形后,会进一步确定各个三角形是否在当前子网格划分出的子网格中,通过该递归过程直至没有子网格。
图11A为本申请实施例提供的计算截面环的实现流程示意图,以下结合图11A对计算截面环的实现过程进行说明。
步骤S6051,将根子网格ID初始化为0。
步骤S6052,利用截面环创建函数确定各个子网格的横截面环。
其中,截面环创建函数可以为BuildCrossSectionLoop(subMeshID),步骤S6052在实现时,可以将根子网格ID确定为该截面环创建函数的参数,通过递归调用该函数,从而确定出各个子网格的横截面环。
图11B为本申请实施例提供的截面环创建函数的实现逻辑示意图,以下结合图11B对该实现逻辑进行说明。
步骤S521,将subMeshes[subMeshID]确定为当前子网格。
也即,currentSM=subMeshes[subMeshID],在调用该函数时,subMeshID为根子网格ID。
步骤S522,将边共用次数数组初始化为0。
步骤S523,设置i=0。
步骤S524,获取当前子网格的三角形分组集合中的第i个三角形。
步骤S525,设置j=0。
步骤S526,获取第i个三角形的第j条边。
步骤S527,获取第j条边的反向边。
步骤S528,将第j条边的共用次数加1,将第j条边的反向边的共用次数减1。
步骤S529,将j的取值累加1,也即j=j+1。
步骤S5210,判断j是否小于3。
其中,如果j小于3,转入步骤S526;如果j不小于3,进入步骤S5211。
步骤S5211,将i的取值累加1,也即i=i+1。
步骤S5212,判断i是否小于当前子网格对应三角形分组集合的三角形数。
如果i小于当前子网格对应三角形分组集合的三角形数,进入步骤S524;如果i不小于当前子网格对应三角形分组集合的三角形数,进入步骤S5213。
步骤S5213,设置k=0。
步骤S5214,判断边共用次数数组的第k个元素是否为非0。
其中,当第k个元素为非0,进入步骤S5215;当第k个元素为0,进入步骤S5216。
步骤S5215,将该第k个元素对应的连接边添加至该当前子网格对应的横截面环中。
步骤S5216,将k的取值累加1,也即k=k+1。
步骤S5217,判断k是否小于当前子网格对应的边总数。
如果k小于当前子网格对应的边总数,进入步骤S5214;如果k不小于当前子网格对应的边总数,进入步骤S5218。
步骤S5218,确定当前子网格划分出的第一个子网格是否为空。
当当前子网格划分出的第一个子网格不为空,进入步骤S5219;当当前子网格划分为出的第一个子网格为空,进入步骤S5220。
步骤S5219,调用BuildCrossSectionLoop(4*subMeshID+1),确定当前子网格划分出的第一子网格的截面环。
步骤S5220,确定当前子网格划分出的第二个子网格是否为空。
当当前子网格划分出的第二个子网格不为空,进入步骤S5221;当当前子网格划分为出的第二个子网格为空,进入步骤S5222。
步骤S5221,调用BuildCrossSectionLoop(4*subMeshID+2),确定当前子网格划分出的第二子网格的截面环。
步骤S5222,确定当前子网格划分出的第三个子网格是否为空。
当当前子网格划分出的第三个子网格不为空,进入步骤S5223;当当前子网格划分为出的第二个子网格为空,进入步骤S5224。
步骤S5223,调用BuildCrossSectionLoop(4*subMeshID+3),确定当前子网格划分出的第三子网格的截面环。
步骤S5224,确定当前子网格划分出的第四个子网格是否为空。
当当前子网格划分出的第四个子网格不为空,进入步骤S5225;当当前子网格划分为出的第四个子网格为空,结束流程。
步骤S5225,调用BuildCrossSectionLoop(4*subMeshID+4),确定当前子网格划分出的第四子网格的截面环。
本申请实施例提供的数据处理方法,通过将三维网格数据降维到二维网格数据,从而能够在一个低维度(二维)去处理分组问题,而不用高维度(三维)的八叉树来处理分组问题,能够降低计算复杂度,在降维后计算二维网格数据中各个三角形的坐标,并构建子网格分层结构。之后,为每个子网格分配三角形分组集合,从而能够支持多次“多层级爆炸”的效果,并确定且缓存各个子网格的横截面环,能够提高渲染效率,实现实时渲染。
下面继续说明本申请实施例提供的数据处理装置443的实施为软件模块的示例性结构,在一些实施例中,如图3所示,存储在存储器440的数据处理装置装置443中的软件模块可以包括:
降维模块4431,配置为获取待处理的三维网格数据,对所述三维网格数据进行降维处理,得到二维网格数据,所述二维网格数据包括顶点信息和三角形信息;
分层构建模块4432,配置为基于所述二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;
三角形分组模块4433,配置为基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合;
分层存储模块4434,配置为将所述各个子网格及所述各个子网格对应的三角形分 组集合按照子网格层次进行分层存储;
第一确定模块4435,配置为基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染。
在一些实施例中,该降维模块4431,还配置为:
获取预设的共形映射函数;
从所述三维网格数据中获取各个顶点的三维坐标信息;
利用所述共形映射函数对所述各个顶点的三维坐标信息进行共形映射,得到所述各个顶点的二维坐标信息。
在一些实施例中,该分层构建模块4432,还配置为:
将所述二维网格数据对应的网格确定为第一层次子网格;
获取各个第i层次的子网格对应的第i目标区域的顶点坐标和中心坐标,i=1,2,..,(N-1),N为预设层次数,N为大于1的整数;
基于所述第i目标区域的顶点坐标和中心坐标对所述各个第i层次子网格进行划分,得到多个第(i+1)层次子网格。
在一些实施例中,该三角形分组模块4433,还配置为:
基于所述顶点信息和所述三角形信息确定各个三角形的中心坐标;
基于各个子网格的区域信息获取第j个子网格的顶点坐标,j=1,2,…,M,M为子网格总数,M为正整数;
基于所述各个三角形的中心坐标和所述第j个子网格的顶点坐标,将中心坐标位于所述第j个子网格对应的目标区域的三角形分配至所述第j个子网格对应的三角形分组集合中。
在一些实施例中,该三角形分组模块4433,还配置为:
基于所述顶点信息和所述三角形信息确定各个三角形的三个顶点坐标,其中,所述顶点坐标包括第一顶点坐标值和第二顶点坐标值;
基于所述各个三角形的三个第一顶点坐标值确定所述各个三角形的第一中心坐标值;
基于所述各个三角形的三个第二顶点坐标值确定所述各个三角形的第二中心坐标值。
在一些实施例中,该第一确定模块4435,还配置为:
基于所述顶点信息和所述三角形信息确定各个三角形分组集合中的目标边,所述目标边为仅存在于一个三角形的边;
从所述各个三角形分组集合中的多个目标边中确定出首尾相接且能构成闭环的目标边;
将构成的各个闭环确定为所述各个子网格的横截面环。
在一些实施例中,该第一确定模块4435,还配置为:
基于所述顶点信息和所述三角形信息确定第k个三角形分组集合中的各个连接边,k=1,2,…,M,M为子网格总数,M为正整数;
基于所述三角形信息确定所述各个连接边的共用次数;
将共用次数为第一预设值的连接边确定为第k个三角形分组集合中的目标边。
在一些实施例中,该第一确定模块4435,还配置为:
将所述各个连接边的共用次数设置为第一预设值;
当除第一连接边之外的其他连接边中存在与所述第一连接边具有相同顶点且方向相反的第二连接边时,将所述第一连接边的共用次数更新为第二预设值;其中,所述第一连接边为所述各个连接边中的任一连接边。
在一些实施例中,该装置还包括:
第一获取模块,配置为获取渲染所述二维网格数据对应的虚拟对象时选用的第一目标层次;
第二获取模块,配置为获取所述第一目标层次中待渲染的至少一个目标子网格;
第一渲染模块,配置为对所述至少一个目标子网格进行渲染,得到第一渲染结果。
在一些实施例中,该装置还包括:
第二确定模块,配置为当确定基于所述二维网格数据渲染出的虚拟对象达到分解条件时,确定渲染所述虚拟对象时选用的第二目标层次;
第三确定模块,配置为确定所述第二目标层次中各个子网格的移动信息和旋转信息;
第四确定模块,配置为基于所述各个子网格的移动信息和旋转信息确定所述各个子网格的渲染位置;
第二渲染模块,配置为基于所述渲染位置对所述各个子网格进行渲染,得到第二渲染结果。
需要说明的是,本申请实施例针对数据处理装置的描述,与上述方法实施例的描述是类似的,具有同方法实施例相似的有益效果。对于本装置实施例中未披露的技术细节,请参照本申请方法实施例的描述而理解。
本申请实施例提供了一种计算机程序产品或计算机程序,该计算机程序产品或计算机程序包括计算机指令,该计算机指令存储在计算机可读存储介质中。计算机设备的处理器从计算机可读存储介质读取该计算机指令,处理器执行该计算机指令,使得该计算机设备执行本申请实施例上述的数据处理方法。
本申请实施例提供一种存储有可执行指令的计算机可读存储介质,其中存储有可执行指令,当可执行指令被处理器执行时,将引起处理器执行本申请实施例提供的数据处理方法,例如,如图4、图5、图6A、图6B示出的数据处理方法。
在一些实施例中,计算机可读存储介质可以是铁电随机存储器(FRAM,Ferroelectric Random Access Memory)、只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read Only Memory)、带电可擦除可编程只读存储器(EEPROM,Electrically Erasable Programmable Read Only Memory)、闪存、磁表面存储器、光盘、或只读光盘存储器(CD-ROM,Compact Disc Read-Only Memory)等存储器;也可以是包括上述存储器之一或任意组合的各种设备。
在一些实施例中,可执行指令可以采用程序、软件、软件模块、脚本或代码的形式,按任意形式的编程语言(包括编译或解释语言,或者声明性或过程性语言)来编写,并且其可按任意形式部署,包括被部署为独立的程序或者被部署为模块、组件、子例程或者适合在计算环境中使用的其它单元。
作为示例,可执行指令可以但不一定对应于文件系统中的文件,可以可被存储在保存其它程序或数据的文件的一部分,例如,存储在超文本标记语言(HTML,Hyper Text Markup Language)文档中的一个或多个脚本中,存储在专用于所讨论的程序的单个文件中,或者,存储在多个协同文件(例如,存储一个或多个模块、子程序或代码部分的文件)中。
作为示例,可执行指令可被部署为在一个计算设备上执行,或者在位于一个地点的多个计算设备上执行,又或者,在分布在多个地点且通过通信网络互连的多个计算设备上执行。
以上所述,仅为本申请的实施例而已,并非用于限定本申请的保护范围。凡在本申 请的精神和范围之内所作的任何修改、等同替换和改进等,均包含在本申请的保护范围之内。

Claims (14)

  1. 一种数据处理方法,应用于计算机设备,所述方法包括:
    获取待处理的三维网格数据,对所述三维网格数据进行降维处理,得到二维网格数据,所述二维网格数据包括顶点信息和三角形信息;
    基于所述二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;
    基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合;
    将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;
    基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对所述各个子网格的横截面进行渲染。
  2. 根据权利要求1中所述的方法,其中,所述对所述三维网格数据进行降维处理,得到二维网格数据,包括:
    获取预设的共形映射函数;
    从所述三维网格数据中获取各个顶点的三维坐标信息;
    利用所述共形映射函数对所述各个顶点的三维坐标信息进行共形映射,得到所述各个顶点的二维坐标信息。
  3. 根据权利要求1中所述的方法,其中,所述基于所述二维网格数据,构建子网格分层结构,包括:
    将所述二维网格数据对应的网格确定为第一层次子网格;
    获取各个第i层次的子网格对应的第i目标区域的顶点坐标和中心坐标,i=1,2,..,(N-1),N为预设层次数,N为大于1的整数;
    基于所述第i目标区域的顶点坐标和中心坐标对所述各个第i层次子网格进行划分,得到多个第(i+1)层次子网格。
  4. 根据权利要求1中所述的方法,其中,所述基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合,包括:
    基于所述顶点信息和所述三角形信息确定各个三角形的中心坐标;
    基于各个子网格的区域信息获取第j个子网格的顶点坐标,j=1,2,…,M,M为子网格总数,M为正整数;
    基于所述各个三角形的中心坐标和所述第j个子网格的顶点坐标,将中心坐标位于所述第j个子网格对应的目标区域的三角形分配至所述第j个子网格对应的三角形分组集合中。
  5. 根据权利要求4中所述的方法,其中,所述基于所述顶点信息和所述三角形信息确定各个三角形的中心坐标,包括:
    基于所述顶点信息和所述三角形信息确定各个三角形的三个顶点坐标,其中,所述顶点坐标包括第一顶点坐标值和第二顶点坐标值;
    基于所述各个三角形的三个第一顶点坐标值确定所述各个三角形的第一中心坐标值;
    基于所述各个三角形的三个第二顶点坐标值确定所述各个三角形的第二中心坐标值。
  6. 根据权利要求1中所述的方法,其中,所述基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,包括:
    基于所述顶点信息和所述三角形信息确定各个三角形分组集合中的目标边,所述目标边为仅存在于一个三角形的边;
    从所述各个三角形分组集合中的多个目标边中确定出首尾相接且能构成闭环的目标边;
    将构成的各个闭环确定为所述各个子网格的横截面环。
  7. 根据权利要求6中所述的方法,其中,所述基于所述顶点信息和所述三角形信息确定各个三角形分组集合中的目标边,包括:
    基于所述顶点信息和所述三角形信息确定第k个三角形分组集合中的各个连接边,k=1,2,…,M,M为子网格总数,M为正整数;
    基于所述三角形信息确定所述各个连接边的共用次数;
    将共用次数为第一预设值的连接边确定为第k个三角形分组集合中的目标边。
  8. 根据权利要求7中所述的方法,其中,所述基于所述三角形信息确定所述各个连接边的共用次数,包括:
    将所述各个连接边的共用次数设置为第一预设值;
    当除第一连接边之外的其他连接边中存在与所述第一连接边具有相同顶点且方向相反的第二连接边时,将所述第一连接边的共用次数更新为第二预设值;其中,所述第一连接边为所述各个连接边中的任一连接边。
  9. 根据权利要求1至8任一项所述的方法,其中,所述方法还包括:
    获取渲染所述二维网格数据对应的虚拟对象时选用的第一目标层次;
    获取所述第一目标层次中待渲染的至少一个目标子网格;
    对所述至少一个目标子网格进行渲染,得到第一渲染结果。
  10. 根据权利要求1至8任一项所述的方法,其中,所述方法还包括:
    当确定基于所述二维网格数据渲染出的虚拟对象达到分解条件时,确定渲染所述虚拟对象时选用的第二目标层次;
    确定所述第二目标层次中各个子网格的移动信息和旋转信息;
    基于所述各个子网格的移动信息和旋转信息确定所述各个子网格的渲染位置;
    基于所述渲染位置对所述各个子网格进行渲染,得到第二渲染结果。
  11. 一种数据处理装置,所述装置包括:
    降维模块,配置为获取待处理的三维网格数据,对所述三维网格数据进行降维处理,得到二维网格数据,所述二维网格数据包括顶点信息和三角形信息;
    分层构建模块,配置为基于所述二维网格数据,构建子网格分层结构,其中,每个层次的子网格结构至少包括一个子网格;
    三角形分组模块,配置为基于各个子网格对所述二维网格数据进行三角形分组,得到所述各个子网格对应的三角形分组集合;
    分层存储模块,配置为将所述各个子网格及所述各个子网格对应的三角形分组集合按照子网格层次进行分层存储;
    第一确定模块,配置为基于所述顶点信息和所述三角形信息确定所述各个子网格的横截面环,并基于所述各个子网格的横截面环,对各个子网格的横截面进行渲染。
  12. 一种计算机设备,所述计算机设备包括:
    存储器,用于存储可执行指令;
    处理器,用于执行所述存储器中存储的可执行指令时,实现权利要求1至10任一项所述的数据处理方法。
  13. 一种计算机可读存储介质,存储有可执行指令,所述可执行指令被处理器执行时实现权利要求1至10任一项所述的数据处理方法。
  14. 一种计算机程序产品,包括计算机程序或指令,所述计算机程序或指令被处理器执行时实现权利要求1至10任一项所述的数据处理方法。
PCT/CN2022/128311 2022-01-17 2022-10-28 数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品 WO2023134267A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US18/324,617 US20230351696A1 (en) 2022-01-17 2023-05-26 Data processing method and apparatus, device, computer-readable storage medium, and computer program product

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210050745.3 2022-01-17
CN202210050745.3A CN116486033A (zh) 2022-01-17 2022-01-17 数据处理方法、装置、设备及计算机可读存储介质

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US18/324,617 Continuation US20230351696A1 (en) 2022-01-17 2023-05-26 Data processing method and apparatus, device, computer-readable storage medium, and computer program product

Publications (1)

Publication Number Publication Date
WO2023134267A1 true WO2023134267A1 (zh) 2023-07-20

Family

ID=87221932

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/128311 WO2023134267A1 (zh) 2022-01-17 2022-10-28 数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品

Country Status (3)

Country Link
US (1) US20230351696A1 (zh)
CN (1) CN116486033A (zh)
WO (1) WO2023134267A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117078890A (zh) * 2023-10-13 2023-11-17 芯瑞微(上海)电子科技有限公司 一种三维几何模型网格剖分方法、系统、装置以及计算机可读介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100045670A1 (en) * 2007-12-06 2010-02-25 O'brien Daniel Systems and Methods for Rendering Three-Dimensional Objects
CN101872488A (zh) * 2009-04-27 2010-10-27 鸿富锦精密工业(深圳)有限公司 曲面渲染系统及方法
US20120249557A1 (en) * 2011-03-31 2012-10-04 Luxology, Llc System for particle editing
CN109461205A (zh) * 2018-09-29 2019-03-12 北京航空航天大学 一种从烟花视频重建三维烟花的方法
CN112700517A (zh) * 2020-12-28 2021-04-23 北京字跳网络技术有限公司 生成烟花视觉效果的方法、电子设备、存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100045670A1 (en) * 2007-12-06 2010-02-25 O'brien Daniel Systems and Methods for Rendering Three-Dimensional Objects
CN101872488A (zh) * 2009-04-27 2010-10-27 鸿富锦精密工业(深圳)有限公司 曲面渲染系统及方法
US20120249557A1 (en) * 2011-03-31 2012-10-04 Luxology, Llc System for particle editing
CN109461205A (zh) * 2018-09-29 2019-03-12 北京航空航天大学 一种从烟花视频重建三维烟花的方法
CN112700517A (zh) * 2020-12-28 2021-04-23 北京字跳网络技术有限公司 生成烟花视觉效果的方法、电子设备、存储介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117078890A (zh) * 2023-10-13 2023-11-17 芯瑞微(上海)电子科技有限公司 一种三维几何模型网格剖分方法、系统、装置以及计算机可读介质
CN117078890B (zh) * 2023-10-13 2024-01-12 芯瑞微(上海)电子科技有限公司 一种手机三维几何模型网格剖分方法和系统

Also Published As

Publication number Publication date
CN116486033A (zh) 2023-07-25
US20230351696A1 (en) 2023-11-02

Similar Documents

Publication Publication Date Title
KR101336013B1 (ko) Bim 데이터와 gis 데이터의 연동 처리 시스템 및 방법
CN110020620A (zh) 一种大姿态下的人脸识别方法、装置及设备
Nourian et al. Voxelization algorithms for geospatial applications: Computational methods for voxelating spatial datasets of 3D city models containing 3D surface, curve and point data models
Zhu et al. A new reconstruction method for 3D buildings from 2D vector floor plan
CN115294258B (zh) 三维模型的展开方法、装置、设备及计算机可读存储介质
WO2023134267A1 (zh) 数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品
US20100036647A1 (en) Efficient computation of Voronoi diagrams of general generators in general spaces and uses thereof
Gan et al. Research on role modeling and behavior control of virtual reality animation interactive system in Internet of Things
CN103559374A (zh) 一种多子网格模型上进行面分裂型曲面细分的方法
CN113393030A (zh) 车辆运营区域潜力站点选址方法、系统、终端及介质
CN109754458A (zh) 三维场景的构建方法、装置及计算机可读存储介质
CN114708358B (zh) 对象处理方法、装置、设备及计算机可读存储介质
CN114177613A (zh) 导航网格更新方法、装置、设备及计算机可读存储介质
CN114429528A (zh) 图像处理方法、装置、设备、计算机程序及存储介质
CN102012941A (zh) 一种不同维度矢量数据统一表达、存储及运算的处理方法
Kijewski-Correa et al. CyberEye: Development of integrated cyber-infrastructure to support rapid hurricane risk assessment
CN112053440A (zh) 单体化模型的确定方法及通信装置
CN115994197A (zh) GeoSOT网格数据计算方法
Jund et al. A unified structure for crowd simulation
Lü et al. Data environment construction for virtual geographic environment
CN112364190A (zh) 一种球面图像索引方法及装置
Choudhury et al. Scalable visibility color map construction in spatial databases
CN115830255A (zh) 一种仿真场景生成方法、装置、电子设备和存储介质
Nguyen Building TIN (triangular irregular network) problem in topology model
CN117422810B (zh) 结构与参数引导的室内要素规则化与关系推理方法及终端

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22919901

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2022919901

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2022919901

Country of ref document: EP

Effective date: 20240329