Texture rendering method and device of stereoscopic model, electronic equipment, computer readable storage medium and computer program product
By converting the 3D model to a spherical coordinate system and dividing it into sub-models for voxelization, the problem of low rendering efficiency in existing technologies is solved, achieving a more efficient texture rendering effect.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2026-05-26
AI Technical Summary
Existing technologies suffer from high memory consumption and computational complexity in rendering 3D models due to pixelation in Cartesian coordinates, resulting in low rendering efficiency.
The 3D model is converted to a spherical coordinate system and divided into multiple sub-models. Each sub-model is then voxelized and finally combined into a third 3D model for texture rendering.
It reduces the extra time and memory consumption of model structure processing, improves model voxelization efficiency, reduces the total time of texture rendering, and improves rendering efficiency.
Smart Images

Figure CN122089905A_ABST
Abstract
Description
Technical Field
[0001] This application relates to computer graphics processing technology, and more particularly to a method, apparatus, electronic device, computer-readable storage medium, and computer program product for texture rendering of a three-dimensional model. Background Technology
[0002] Taking games as an example, during gameplay, large-scale 3D models need to be processed and rendered in real time. Many 3D models are often too large or too complex, leading to rendering timeouts and missing effects. Related technologies often render 3D models by pixelating the entire model in Cartesian coordinates, loading the entire model, and then voxelizing it. This results in high memory consumption and computational complexity during voxelization, making the process too time-consuming and inefficient. Summary of the Invention
[0003] This application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for texture rendering of three-dimensional models, which can improve the efficiency and flexibility of model texture rendering.
[0004] The technical solution of this application embodiment is implemented as follows:
[0005] This application provides a texture rendering method for a 3D model, the method comprising:
[0006] The first solid model is converted into a second solid model in a spherical coordinate system, wherein the coordinate system used by the first solid model is different from the spherical coordinate system.
[0007] The second 3D model is divided into multiple sub-models;
[0008] The multiple sub-models are voxelized to obtain multiple voxel datasets, wherein one sub-model corresponds to one voxel dataset;
[0009] The multiple voxel datasets are combined into a voxel dataset for the third stereo model;
[0010] Based on the voxel data of the voxel dataset of the third stereo model located in the surface region of the third stereo model, the texture of the third stereo model is rendered.
[0011] This application provides a texture rendering device for a three-dimensional model, the device comprising:
[0012] The model conversion module is used to convert the first solid model into a second solid model in a spherical coordinate system, wherein the coordinate system used by the first solid model is different from the spherical coordinate system.
[0013] The model segmentation module is used to segment the second 3D model into multiple sub-models;
[0014] A voxel processing module is used to voxelize the multiple sub-models respectively to obtain multiple voxel datasets, wherein one sub-model corresponds to one voxel dataset;
[0015] A voxel combination module is used to combine the multiple voxel datasets into a voxel dataset for a third stereo model.
[0016] The texture rendering module is used to render the texture of the third stereo model based on the voxel data in the voxel dataset of the third stereo model located in the surface region of the third stereo model.
[0017] This application provides an electronic device, the electronic device comprising:
[0018] Memory is used to store executable instructions or computer programs.
[0019] The processor, when executing computer-executable instructions or computer programs stored in the memory, implements the texture rendering method for the stereoscopic model provided in the embodiments of this application.
[0020] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the texture rendering method for a 3D model provided in this application when executed by a processor.
[0021] This application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, they implement the texture rendering method for a three-dimensional model provided in this application.
[0022] The embodiments of this application have the following beneficial effects:
[0023] By converting the 3D model to a spherical coordinate system and dividing the converted model into multiple sub-models, the voxelization process for each sub-model, based on the geometric information contained in each sub-model, reduces the extra time spent processing the model structure compared to calculating the complex structure of the entire model when voxelizing it. Loading the segmented sub-models also reduces the memory usage during the voxelization process compared to loading the entire model. The computational complexity of the sub-models is much lower than that of the overall model, thus improving the voxelization efficiency and reducing the latency during the voxelization process. Since voxelization is a key step in model texture rendering, it also reduces the time consumed by complete texture rendering and improves rendering efficiency. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the architecture of the texture rendering system 100 for a three-dimensional model provided in this application embodiment;
[0025] Figure 2 This is a schematic diagram of the structure of the electronic device 500 provided in the embodiments of this application;
[0026] Figure 3A This is a first flowchart illustrating the texture rendering method for a 3D model provided in this application embodiment;
[0027] Figure 3B This is a second flowchart illustrating the texture rendering method for a 3D model provided in this application embodiment;
[0028] Figure 3C This is a schematic diagram of the third process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0029] Figure 3D This is a schematic diagram of the fourth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0030] Figure 3E This is a schematic diagram of the fifth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0031] Figure 3F This is a schematic diagram of the sixth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0032] Figure 3G This is a schematic diagram of the seventh process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0033] Figure 3H This is the eighth flowchart of the texture rendering method for a 3D model provided in the embodiments of this application;
[0034] Figure 3I This is a ninth flowchart illustrating the texture rendering method for a 3D model provided in this application embodiment;
[0035] Figure 3J This is a schematic diagram of the tenth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0036] Figure 3K This is a schematic diagram of the eleventh step of the texture rendering method for a 3D model provided in the embodiments of this application;
[0037] Figure 3L This is a schematic diagram of the twelfth step of the texture rendering method for a 3D model provided in the embodiments of this application;
[0038] Figure 3MThis is a schematic diagram of the thirteenth step of the texture rendering method for a 3D model provided in the embodiments of this application;
[0039] Figure 3N This is a schematic diagram of the fourteenth step of the texture rendering method for a 3D model provided in the embodiments of this application;
[0040] Figure 3O This is the fifteenth flowchart of the texture rendering method for a 3D model provided in the embodiments of this application;
[0041] Figure 3P This is a schematic diagram of the first overall process of the texture rendering method for a three-dimensional model provided in the embodiments of this application;
[0042] Figure 3Q This is a second overall flowchart of the texture rendering method for a 3D model provided in the embodiments of this application;
[0043] Figure 4A This is a schematic diagram of the translation of the three-dimensional model provided in the embodiments of this application;
[0044] Figure 4B This is a schematic diagram of model scaling provided in an embodiment of this application;
[0045] Figure 4C This is a schematic diagram of the model coordinate transformation provided in the embodiments of this application;
[0046] Figure 4D This is a schematic diagram of the segmentation process of the second stereoscopic model provided in the embodiments of this application;
[0047] Figure 4E This is a schematic diagram of the voxelization of the sub-model provided in the embodiments of this application;
[0048] Figure 4F This is a schematic diagram illustrating the conversion of a second solid model into a third solid model, provided in an embodiment of this application.
[0049] Figure 5A This is a schematic diagram illustrating the principle of the pooling operation provided in the embodiments of this application;
[0050] Figure 5B This is a schematic diagram of the convolution and pooling operations provided in the embodiments of this application;
[0051] Figure 5C This is a schematic diagram illustrating the training principle of the voxel conversion model provided in the embodiments of this application;
[0052] Figure 6 This is an overall technical framework diagram provided in the embodiments of this application;
[0053] Figure 7 This is a schematic diagram of the architecture of the convolutional neural network provided in the embodiments of this application.
[0054] It should be noted that the terms "first" and "second" mentioned above are only used to distinguish between different options and do not represent the degree of superiority or inferiority of the options or their priority in the implementation process. Detailed Implementation
[0055] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0056] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0057] In the following description, the terms "first / second / third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first / second / third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0058] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0059] Unless otherwise specified, "at least one" as used below refers to one or more cases, and "multiple" can refer to two or more cases.
[0060] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0061] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0062] 1) A three-dimensional model, also known as a solid model, is a digital representation of an object in three-dimensional space. It describes the shape and structure of the object through a series of basic geometric elements such as points, lines, and surfaces. Three-dimensional models can be divided into different types, such as polygonal models, surface models, and volumetric models.
[0063] 2) Spherical coordinates are a method of representing the position of a point in three-dimensional space. They use three coordinates to describe the point's location in space. The following is the concept of spherical coordinates:
[0064] Radial distance (R): This is the straight-line distance from the origin to the point. It is the most important coordinate in the spherical coordinate system and determines the size of the point in space.
[0065] Polar Angle (θ): Also known as the zenith angle, it is the angle between the positive z-axis and the z-axis. It determines the position of the point in a plane perpendicular to the z-axis.
[0066] Azimuth angle (φ): The angle between the projection of a point onto the xy-plane from the positive x-axis and the x-axis. It determines the position of the point on the xy-plane.
[0067] 3) Voxel: A voxel is the smallest volume unit that makes up a 3D model. It is a cube with a fixed side length and is usually used to represent a data point or sample in space.
[0068] Taking a sphere as an example in 3D modeling, the voxel representation of a sphere refers to using voxels (i.e., 3D pixels) in 3D space to approximate the shape of a sphere. Because a voxel is a unit of a cube, a certain number of voxels are usually needed to approximate the surface and volume of a sphere when representing it.
[0069] The following is the basic method for voxelization of a sphere: First, define the center point and radius of the sphere; determine the resolution of the voxel lattice, i.e., the size of the voxels; use an algorithm to determine whether each voxel is located inside the sphere. For example, for each voxel center in the voxel lattice, calculate its distance to the center of the sphere. If this distance is less than or equal to the radius of the sphere, then this voxel belongs to the sphere. For example, for larger spheres, an octree decomposition method can be used to decompose the sphere into multiple smaller regions, using high-density voxels only where necessary to reduce the number of voxels; based on the results of the above algorithm, fill the voxels that meet the conditions. The filling method can be any of the following:
[0070] Surface representation: Only voxels located on the surface of the sphere are labeled.
[0071] Volume representation: All voxels filling the interior of the sphere.
[0072] Edge processing: Since voxels are discrete cubic units, inaccurate representations may occur at the edges of the sphere, requiring edge smoothing.
[0073] Voxel attributes: In addition to location information, each voxel may also need to contain other attributes, such as color, material, density, etc., for subsequent rendering or physical simulation.
[0074] 4) Voxelization is a process in computer graphics and computer vision that involves converting continuous three-dimensional spatial data into discrete voxel representations.
[0075] 5) Voxel data is a discrete representation of 3D spatial data, which approximates the continuous 3D spatial structure through the position and attribute information of voxels. Voxel data includes the position coordinates and attributes of each voxel in 3D space, usually represented by an index in a 3D array or 3D coordinates (x, y, z). Voxel attributes can include color, material type, and transparency.
[0076] 6) A voxel dataset refers to the collection of voxel data included in a 3D model. A voxel dataset can represent a 3D array or data structure, consisting of voxel data in three dimensions, corresponding to three spatial dimensions:
[0077] Horizontal dimension: This dimension usually refers to the number of voxels along the x-axis, which determines the horizontal resolution and width of the voxel dataset.
[0078] Vertical dimension: This dimension refers to the number of voxels along the y-axis, which determines the resolution and height of the voxel dataset in the vertical direction.
[0079] Vertical dimension: This dimension refers to the number of voxels along the z-axis, which determines the resolution and thickness of the voxel dataset in the depth direction.
[0080] 7) Computing power parameters refer to a series of indicators that measure the computing power of electronic devices. These parameters are typically used to describe the performance of the device when performing data processing and computation tasks. The computing power parameters of electronic devices include:
[0081] Processing speed: This refers to the number of instructions or the amount of data that an electronic device can execute per second. It is usually measured in Operations Per Second (OPS).
[0082] Core Count: This refers to the number of processor cores in an electronic device. Multi-core processors can execute multiple tasks simultaneously, thus improving processing efficiency.
[0083] Thread Count: This refers to the maximum number of threads that a processor can handle simultaneously. A thread is the smallest unit that an operating system can schedule; multithreading can improve the efficiency of multitasking.
[0084] Cache Size: This refers to the size of the processor's internal cache. The cache is a small storage area located between the processor and main memory. It stores frequently used data and instructions to reduce the number of times the processor accesses main memory, thus improving data access speed.
[0085] Memory Capacity: This refers to the amount of RAM that an electronic device can install. Larger memory capacity allows for the running of more or larger applications while maintaining system smoothness.
[0086] Memory bandwidth: This refers to the amount of data that memory can read or write per second. Higher memory bandwidth results in faster data transfer speeds, which helps improve overall performance.
[0087] Graphics Processing Unit (GPU): A GPU is a processor specifically designed for graphics rendering and parallel computing. GPU performance is typically measured by parameters such as the number of CUDA cores or Tensor cores.
[0088] Storage speed refers to the data read and write speed of the storage media in an electronic device (such as a solid-state drive (SSD) or a hard disk drive (HDD). Storage speed affects the speed at which data is loaded and saved.
[0089] 8) Radial range refers to a circular or spherical region defined with a center point as the center and a certain distance as the radius. Radial range has the following properties:
[0090] Symmetry: The radial range is usually symmetrical because it is symmetrical about the center point.
[0091] Variableness: The size of the radial range can be adjusted as needed, that is, the radius can be changed to adapt to different application scenarios.
[0092] Limitations: In some cases, radial range may be physically limited, for example, signal propagation may be blocked by obstacles.
[0093] 9) The slice radius is the radius of the concentric spherical surface from the center of the sphere to its surface in spherical coordinates. Different sizes of concentric spherical surfaces correspond to different slice radii. For example, for a sphere centered at the origin, if the radius of the sphere is 4r, and if it is divided once every time the radial radius increases by r, then 4 sub-models are obtained, with slice radii of r, 2r, 3r and 4r respectively.
[0094] 10) A geometry dataset refers to a collection of relevant data within a given interval, used to describe geometric shape and structural information. A geometry dataset includes spherical coordinates and material information within that interval. Material information describes the surface material properties of the model, including at least one of the following: color, texture, reflectivity, and transparency. One geometry dataset corresponds to one sub-model.
[0095] 11) A tensor is a multidimensional array in which each element corresponds to a value in a specific coordinate system. The dimension of a tensor is called its "order" or "rank," which indicates the number of dimensions of the data it contains. Tensors can be represented in various ways, including multidimensional arrays, symbolic representations, or graphical representations.
[0096] 12) Texture assignment refers to the process of applying the pixel values (color, brightness, etc.) of a texture image to the surface of a 3D model. This process typically involves mapping the coordinates of the texture image to the vertices of the model surface, thereby determining the texture coordinates of each vertex.
[0097] 13) In response to, used to indicate the conditions or states on which the operation performed depends. When the conditions or states on which it depends are met, one or more operations performed may be performed in real time or with a set delay. Unless otherwise specified, there is no restriction on the order in which the multiple operations are performed.
[0098] 14) Human-computer interaction interface, which is used to provide human-computer interaction functions or to display the third-dimensional model after rendering texture.
[0099] For example, graphical user interfaces (GUIs) include augmented reality (AR) interfaces, virtual reality (VR) interfaces, voice user interfaces (VUIs), interactive projection interfaces (using projection technology to display information on a flat surface), eye-tracking interfaces (interfaces controlled by detecting the user's gaze), holographic interfaces (three-dimensional holograms formed by projecting images using holographic projection technology, allowing users to see stereoscopic images without wearing special glasses), multimodal interfaces (interfaces that combine multiple interaction methods, such as tactile, visual, and auditory interaction), and brain-machine interfaces (BMIs).
[0100] When rendering 3D models, the relevant technologies perform pixelation on the entire 3D model in Cartesian coordinates. This results in excessive memory consumption and high computational complexity during the voxelization process, making the voxelization process too time-consuming and rendering inefficient.
[0101] Based on the above analysis, the applicant found that the texture rendering methods of the 3D models in the relevant technologies cannot quickly perform voxelization processing on the models. In order to address the above problems, the embodiments of this application provide a texture rendering method for 3D models, which can improve the efficiency and flexibility of model texture rendering.
[0102] The following describes exemplary applications of the electronic devices provided in the embodiments of this application. These electronic devices can be implemented as various types of terminals such as laptops, tablets, desktop computers, set-top boxes, smartphones, smart speakers, smartwatches, smart TVs, and in-vehicle terminals, or as servers. Exemplary applications of the electronic devices as terminals or servers will be described below.
[0103] See Figure 1 , Figure 1 This is a schematic diagram of the architecture of the texture rendering system 100 for a three-dimensional model provided in this application embodiment. In order to realize the texture rendering application supporting a three-dimensional model, the terminal 400 connects to the server 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two.
[0104] Terminal 400 is used to convert the first solid model into a second solid model in spherical coordinates; divide the second solid model into multiple sub-models; voxelize the multiple sub-models to obtain multiple voxel datasets; combine the multiple voxel datasets into a third solid model; render the texture of the third solid model based on the voxel data of the surface in the third solid model; and display the texture-rendered third solid model on the human-computer interaction interface 410.
[0105] Taking a game scene as an example, server 200 can be used to convert a first 3D model into a second 3D model in spherical coordinates; divide the second 3D model into multiple sub-models; voxelize each sub-model to obtain multiple voxel datasets; combine the multiple voxel datasets into a third 3D model, and send the third 3D model to terminal 400, so that terminal 400 can render the texture of the third 3D model based on the voxel data of the surface in the third 3D model, and display the texture-rendered third 3D model on the human-computer interaction interface 410. Alternatively, the terminal can complete the above coordinate system transformation, model segmentation, and texture rendering process independently.
[0106] In some embodiments, server 200 may be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Terminals and servers can be connected directly or indirectly via wired or wireless communication, which is not limited in this embodiment.
[0107] See Figure 2 , Figure 2 This is a schematic diagram of the structure of the electronic device 500 provided in the embodiments of this application. Figure 2 The electronic device 500 shown can be Figure 1 The terminal 400 or server 200, and the electronic device 500 include: at least one processor 510, memory 550, at least one network interface 520, and user interface 530. The various components in the terminal 500 are coupled together via a bus system 540. It is understood that the bus system 540 is used to implement communication between these components. In addition to a data bus, the bus system 540 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 2 The general labeled all buses as Bus System 540.
[0108] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc.
[0109] User interface 530 includes one or more output devices 531 that enable the presentation of media content, including one or more speakers and / or one or more visual displays. User interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.
[0110] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state storage, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices physically located away from the processor 510.
[0111] The memory 550 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), and the volatile memory may be random access memory (RAM). The memory 550 described in this application embodiment is intended to include any suitable type of memory.
[0112] In some embodiments, memory 550 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or supersets thereof, as illustrated below.
[0113] Operating system 551 includes system programs for handling various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, driver layer, etc., for implementing various basic business functions and handling hardware-based tasks;
[0114] The network communication module 552 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 including: Bluetooth, WiFi, and Universal Serial Bus (USB), etc.
[0115] Presentation module 553 is configured to enable the presentation of information (e.g., a user interface for operating peripheral devices and displaying content and information) via one or more output devices 531 (e.g., a display screen, a speaker, etc.) associated with user interface 530;
[0116] The input processing module 554 is used to detect and translate one or more user inputs or interactions from one or more input devices 532.
[0117] In some embodiments, the apparatus provided in this application can be implemented in software. Figure 2 A texture rendering apparatus 555 for a stereo model stored in memory 550 is shown. This apparatus can be software in the form of programs or plugins, and includes the following software modules: a model conversion module 5551, a model segmentation module 5552, a voxel processing module 5553, a voxel combination module 5554, and a texture rendering module 5555. These modules are logically connected and can therefore be arbitrarily combined or further separated according to their implemented functions. The functions of each module will be described below.
[0118] In some embodiments, the terminal or server can implement the texture rendering method for the stereoscopic model provided in this application by running various computer-executable instructions or computer programs. For example, computer-executable instructions can be microprogram-level commands, machine instructions, or software instructions. Computer programs can be native programs or software modules in an operating system; they can be native applications (APPs), i.e., programs that need to be installed in the operating system to run, such as game APPs; or they can be applets that can be embedded in any APP, i.e., programs that only need to be downloaded to a browser environment to run. In summary, the aforementioned computer-executable instructions can be any form of instruction, and the aforementioned computer programs can be any form of application, module, or plugin.
[0119] The following describes the texture rendering method for a stereoscopic model provided in the embodiments of this application. As mentioned above, the electronic device implementing the texture rendering method for a stereoscopic model in the embodiments of this application can be a terminal or a server, or a combination of both. Therefore, the executing entity of each step will not be described again below.
[0120] For ease of explanation, this application uses a sphere as an example to illustrate the three-dimensional model. However, those skilled in the art will understand from the embodiments of this application that the texture rendering method for three-dimensional models provided in this application can be applied to models of any shape in a virtual scene, such as cubes, cylinders, cones, irregular player characters or non-player characters, etc.
[0121] See Figure 3A , Figure 3A This is a first flowchart illustrating the texture rendering method for a 3D model provided in this application embodiment, which can be executed by the aforementioned terminal or server, and will be combined with... Figure 3A The steps shown are explained.
[0122] In step 101, the first solid model is converted into a second solid model in a spherical coordinate system, wherein the coordinate system used by the first solid model is different from the spherical coordinate system.
[0123] For example, the coordinate system used in the first solid model can be any of the following coordinate systems: Cartesian coordinate system, Polar coordinate system, View coordinate system, World coordinate system, or Cylindrical coordinate system. See also Figure 4A , Figure 4A This is a schematic diagram illustrating the translation of the three-dimensional model provided in an embodiment of this application. Figure 4A The left-hand image shows the first solid model 406, which is located in a Cartesian coordinate system.
[0124] In some embodiments, where the coordinate system used by the first solid model is a Cartesian coordinate system, see [link to documentation]. Figure 3B , Figure 3B This is a schematic diagram of the second process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3A Step 101 can be done Figure 3B Steps 1011 to 1014 are implemented, and the details are explained below.
[0125] In step 1011, the center point of the first solid model is determined based on the maximum and minimum values of the horizontal coordinates, the maximum and minimum values of the vertical coordinates, and the maximum and minimum values of the vertical coordinates of the vertices in the first solid model.
[0126] In some embodiments, for each vertex in the first solid model, the coordinates of each vertex are obtained, wherein the horizontal, vertical, or longitudinal coordinates of the vertex can be positive or negative coordinates, and the coordinates of vertices located on the positive coordinate axis are greater than the coordinates of vertices located on the negative coordinate axis; the vertex with the largest horizontal coordinate, the vertex with the smallest horizontal coordinate, the vertex with the largest vertical coordinate, the vertex with the smallest vertical coordinate, the vertex with the largest vertical coordinate, and the vertex with the smallest vertical coordinate in the first solid model are queried respectively; the average of the maximum and minimum values of the horizontal coordinates is used as the horizontal coordinate of the center point of the first solid model; the average of the maximum and minimum values of the vertical coordinates is used as the vertical coordinate of the center point of the first solid model; and the average of the maximum and minimum values of the vertical coordinates is used as the vertical coordinate of the center point of the first solid model, so as to determine the position of the center point of the first solid model.
[0127] For example, the coordinates of each vertex include horizontal, vertical, and triangular coordinates. For instance, for vertex v... i The coordinates are (x i y i , z i ), where i represents the i-th vertex, x i y is the horizontal coordinate. i Z is the vertical coordinate. i Let x be the vertical coordinate. If vertex v1 is the vertex with the largest horizontal coordinate in the first solid model, then let x be the horizontal coordinate of vertex v1. max Let x represent the maximum value of the horizontal coordinate; if vertex v2 is the vertex with the smallest horizontal coordinate in the first solid model, then the horizontal coordinate of vertex v2 is denoted as x. min Let represent the minimum value of the horizontal coordinate; if vertex v3 is the vertex with the largest vertical coordinate in the first solid model, then the vertical coordinate of vertex v3 is denoted as y. max Let y represent the maximum value of the vertical coordinate; if vertex v4 is the vertex with the smallest vertical coordinate in the first solid model, then the vertical coordinate of vertex v4 is denoted as y. min Let z represent the minimum value of the vertical coordinate; if vertex v5 is the vertex with the largest vertical coordinate in the first solid model, then the vertical coordinate of vertex v5 is denoted as z. max Let z represent the maximum value of the vertical coordinate; if vertex v6 is the vertex with the smallest vertical coordinate in the first solid model, then the vertical coordinate of vertex v6 is denoted as z. min , representing the minimum value of the vertical coordinate. The maximum value of the horizontal coordinate, x. max and minimum value x min mean The horizontal coordinate of the center point of the first solid model; the maximum value of the vertical coordinate y max and minimum value y min mean The vertical coordinate of the center point of the first solid model; the maximum value of the vertical coordinate z max and minimum value z min mean Let c be the vertical coordinate of the center point of the first solid model. See Figure 4A In the left-hand diagram, the lateral coordinate of vertex A is the maximum value of the lateral coordinate of the first solid model 406, denoted as x. max The horizontal coordinate of vertex G is the minimum value of the horizontal coordinate of the first solid model 406, denoted as x. min The vertical coordinate of vertex E is the maximum value of the vertical coordinate of the first solid model 406, denoted as y. max The vertical coordinate of vertex F is the minimum value of the vertical coordinate of the first solid model 406, denoted as y. min The vertical coordinate of vertex B is the maximum value of the vertical coordinate of the first solid model 406, denoted as z. max The vertical coordinate of vertex D is the minimum value of the vertical coordinate of the first solid model 406, denoted as z. min The center point of the first solid model 406 can be denoted as point C, and the coordinates of point C are...
[0128] In step 1012, the first solid model is translated to the origin of the Cartesian coordinate system based on the center point to obtain the fourth solid model.
[0129] In some embodiments, the coordinates of each vertex in the first solid model are subtracted from the center point along each coordinate dimension (horizontal dimension, vertical dimension, and vertical dimension) to translate the first solid model to the origin o(0, 0, 0) of the Cartesian coordinate system, thus obtaining the fourth solid model.
[0130] Following the example of step 1011 above, if the coordinates of any vertex in the first solid model are vertex v i The coordinates are (x i y i , z i ), and vertex v i Each dimension's coordinates (i.e., horizontal, vertical, and angular coordinates) are relative to the center point. By subtracting the values, we obtain the vertex coordinates. make Then vertex v i (x i y i , z i Transform ) into v′ i (x′ i y′ i , z′i The vertices obtained from multiple subtractions are combined to form the fourth solid model. See also... Figure 4A The right-hand image will Figure 4A The center point C in the left figure is translated to the origin O. That is, the coordinates of each vertex of the first solid model 406 are subtracted from the coordinates of the original center point C to obtain new coordinates. The vertices corresponding to the multiple new coordinates are combined to form the fourth solid model 407. In the first solid model 406, the position of point A is translated to the position of point C, and the position of point C is translated to the origin.
[0131] In step 1013, the fourth solid model is scaled down to a unit cube to obtain the fifth solid model.
[0132] Here, the side length of the unit cube can be manually set; for example, the side length of the unit cube can be set to one centimeter, one decimeter, or one millimeter. See also Figure 4B , Figure 4B This is a schematic diagram of model scaling provided in the embodiments of this application. Figure 4B The left side diagram shows the fourth solid model 407. If the side length of the unit cube 408 is 1 cm, then the fourth solid model is scaled into the unit cube 408 to obtain the fifth solid model 409. That is, the maximum distance from the vertex to the origin in the fifth solid model 409 is less than or equal to the side length of the unit cube 408, which is 1 cm. For example, OB = OD = OG = OA = 1 cm.
[0133] In some embodiments, see Figure 3C , Figure 3C This is a schematic diagram of the third process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3B Step 1013 can be achieved through Figure 3B Steps 10131 to 10134 are implemented, and the details are explained below.
[0134] In step 10131, the bounding box of the first solid model is determined.
[0135] In some embodiments, the bounding box of the first stereo model includes a horizontal bounding box, a vertical bounding box, and a vertical bounding box. The difference between the maximum and minimum values of the horizontal coordinates is used as the horizontal bounding box, the difference between the maximum and minimum values of the vertical coordinates is used as the vertical bounding box, and the difference between the maximum and minimum values of the vertical coordinates is used as the vertical bounding box.
[0136] Following the example of step 1011 above, determine the difference x between the maximum and minimum values of the horizontal coordinate. max -x min , as the horizontal bounding box; determine the difference y between the maximum and minimum values of the vertical coordinate. max -y min, as the vertical bounding box; determine the difference z between the maximum and minimum values of the vertical coordinates. max -z min , as the vertical bounding box. See also Figure 4A In the left-hand diagram, the horizontal bounding box represents the difference between the horizontal coordinates of point A and point G; the vertical bounding box represents the difference between the vertical coordinates of point E and point F; and the vertical bounding box represents the difference between the vertical coordinates of point B and point D.
[0137] In step 10132, the maximum side length of the first solid model is determined based on the bounding box.
[0138] In some embodiments, the maximum value of the horizontal bounding box, the vertical bounding box, and the vertical frame is taken as the maximum side length of the first solid model.
[0139] Following the example in step 10131 above, the maximum side length of the first solid model can be expressed by the following formula:
[0140] s = max(x max -x min y max -y min , z max -z min (1)
[0141] Where s represents the maximum side length, max is used to find the maximum value among multiple values, and x max The x-coordinate represents the maximum value of the horizontal axis. min The y-axis represents the minimum value of the horizontal coordinate. max The value of the vertical axis is represented by y. min The z-axis represents the minimum value of the vertical coordinate. max The z-coordinate represents the maximum value of the vertical coordinate. min This represents the minimum value of the vertical coordinate. See also: Figure 4A In the left-hand diagram, since OB = OD = OG = OA = 1 cm, the maximum side length = AG = EF = BD = 2 cm.
[0142] In step 10133, the scaling ratio of the fourth solid model is determined based on the maximum side length.
[0143] In some embodiments, the reciprocal of the maximum side length is used as the scaling factor for the fourth solid model.
[0144] Following the example in step 10132 above, the reciprocal of the maximum side length, which is also the scaling ratio of the fourth solid model, can be expressed by the following formula:
[0145]
[0146] Where k represents the scaling factor of the fourth solid model. See also Figure 4B The scaling factor of the fourth solid model 409 is 1 / maximum side length = 1 / 2.
[0147] Here, the scaling ratio can be manually set according to the size of the fourth stereo model, such as 1 / 2, 1 / 4 or 1 / 10, and there is no limitation here.
[0148] In step 10134, the fourth solid model is scaled to the unit cube according to the scaling ratio to obtain the fifth solid model.
[0149] In some embodiments, the product of the coordinates of each dimension of each vertex in the fourth solid model and the scaling ratio is determined to obtain the scaled vertex coordinates. The positions of the scaled vertices are determined based on the scaled vertex coordinates, and the scaled vertices are combined to form the fifth solid model. If the volume of the fourth solid model is smaller than the unit cube, the fourth solid model is enlarged until any vertex of the model is on the edge of the unit cube; if the volume of the fourth solid model is larger than the unit cube, the fourth solid model is reduced until the coordinates of all vertices of the model are within the coordinate range of the unit cube.
[0150] Following the example of step 10133 above, for any vertex v′ in the fourth solid model i Determine vertex v′ i Coordinates of each dimension (i.e., horizontal coordinate x′) i Vertical coordinate y′ i and vertical coordinate z′ i The product of the product and the scaling factor can be expressed by the following formula:
[0151]
[0152] Where k represents the scaling ratio, v′ i Let s represent the coordinates of a vertex along a certain dimension, s represent the maximum side length, and v″ represent the coordinates of the vertex along a certain dimension. i Represents vertex v′ i The product of the coordinates of a certain dimension and the scaling factor.
[0153] v″ i As scaled vertex coordinates, the scaled vertex coordinates v″ i The coordinates of each dimension are represented as follows: horizontal coordinate Vertical axis Vertical coordinates Then the scaled vertex coordinates v″ i It can be represented as (x″) i ,y″ i , z″ i This combines multiple scaled vertices into a fifth solid model. See also... Figure 4B The right-hand diagram shows that the coordinates of each vertex in the fourth solid model 407 are multiplied by the scaling factor 1 / 2 to obtain the scaled vertex coordinates. The vertices corresponding to the scaled vertex coordinates are then combined to form the fifth solid model 409.
[0154] See also Figure 3B In step 1014, the coordinates of each vertex of the fifth solid model are converted into spherical coordinates in the spherical coordinate system, and the points corresponding to the spherical coordinates are used as vertices of the second solid model. The second solid model is constructed based on the vertices of the second solid model.
[0155] In some embodiments, for each vertex, the square of the coordinate in each dimension is determined, the sum of the squares of the coordinates in each dimension is calculated, and the sum raised to the power of 1 / 2 is taken as the radial distance of the vertex; a first ratio of the vertical coordinate to the horizontal coordinate is determined, and the arctangent of twice the first ratio is performed to obtain the azimuth value of the vertex; a second ratio of the vertical coordinate to the radial distance is determined, and the arccosine of the second ratio is performed to obtain the polar angle value of the vertex. The radial distance, polar angle value, and azimuth angle value are combined to form the spherical coordinates of the vertex, and the point corresponding to the spherical coordinates is taken as the vertex of the second solid model. The second solid model is constructed based on multiple vertices.
[0156] Following the example of step 10134 above, with vertex v″ i (x″ i ,y″ i , z″ i For example, the square of the horizontal coordinate is The square of the vertical axis is The square of the vertical coordinate is The sum of the squares of the coordinates in each dimension is The sum to the power of 1 / 2 is The radial distance r of this vertex i The first ratio of the vertical coordinate to the horizontal coordinate is Taking the arctangent of twice the first ratio, we get... As the azimuth value of this vertex The second ratio of the vertical coordinate to the radial distance is Performing an inverse cosine operation on the second ratio yields... The polar angle θ of this vertex i The spherical coordinates of this vertex are then expressed as: The point corresponding to the spherical coordinates is used as the vertex of the second solid model, and the second solid model is constructed based on multiple vertices. See also Figure 4C , Figure 4C This is a schematic diagram of the model coordinate transformation provided in the embodiments of this application. Taking any vertex M in the fifth solid model 409 as an example, in Figure 4CIn the left-hand diagram, the coordinates of vertex M are (x, y, z). After converting the Cartesian coordinate system to spherical coordinates, in... Figure 4C In the right-hand diagram, the distance from vertex M to the origin is taken as the radial distance r of the vertex, and the arctangent of the ratio of the vertical coordinate to the horizontal coordinate of vertex M is taken as the azimuth angle value. Taking the inverse cosine of the ratio of the vertical coordinate to the radial distance of vertex M as the polar angle θ, the spherical coordinates of vertex M are:
[0157] This application's embodiments, by calculating the maximum and minimum values of the horizontal, vertical, and longitudinal coordinates, can accurately determine the geometric center of the model, improving the accuracy of subsequent translation and scaling operations and ensuring that the model's position and scale in space are correctly handled. Translating the model to the origin simplifies model processing. At the origin, the model is unaffected by any offset, improving the accuracy of subsequent scaling and rendering operations. Scaling the model to a uniform size facilitates comparison and combination of different models. Calculations are performed within a unit cube, simplifying the calculation process, avoiding the handling of large-scale numerical values, and improving computational efficiency.
[0158] See also Figure 3A In step 102, the second 3D model is divided into multiple sub-models.
[0159] For example, see Figure 4D , Figure 4D This is a schematic diagram illustrating the segmentation process of the second three-dimensional model provided in an embodiment of this application. Figure 4D The left-hand image shows the second solid model 401, transformed from the first solid model in Cartesian coordinates and located in spherical coordinates. Figure 4D In the right-hand diagram, the second solid model 401 is divided into multiple sub-models, showing a 1 / 8 cross-section of the sub-model. The actual sub-model is a complete spherical shell with a thickness of r. The multiple sub-models include sub-model 402, sub-model 403, sub-model 404, and sub-model 405.
[0160] In some embodiments, see Figure 3D , Figure 3D This is a schematic diagram of the fourth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3A Step 102 can be achieved through Figure 3D Steps 1021 to 1023 are implemented, and the details are explained below.
[0161] In step 1021, the number of subdivisions is determined based on the computing power parameters of the electronic device. The computing power parameters are positively correlated with the number of subdivisions, and the number of subdivisions represents the number of sub-models to be obtained from the second 3D model.
[0162] As an example, the computing power parameters of an electronic device include at least one of the following: the number of cores of the Central Processing Unit (CPU), CPU frequency, the number of cores of the Graphics Processing Unit (GPU), GPU frequency, memory capacity, memory bandwidth, and storage speed. The number of sub-models to be divided represents the number of sub-models to be divided in the second 3D model. The relationship between the computing power parameter P and the number of sub-models to be divided N can be represented by the function: P = f(a) * N, where f(a) represents a positive number greater than 1 or a direct proportional function.
[0163] In step 1022, multiple slice radii are determined based on the maximum distance between the vertices in the second solid model and the origin of the spherical coordinate system, as well as the number of slices to be divided.
[0164] In some embodiments, the distance between a vertex in the second solid model and the origin of the spherical coordinate system is used as the radial radius of the vertex.
[0165] For example, with vertex v″ i (x″ i y′ i , z′ i Taking the second solid model as an example, the distance between a vertex and the origin of the spherical coordinate system can be expressed by the following formula:
[0166]
[0167] Where, r i x″ represents the distance between a vertex in the second solid model and the origin of the spherical coordinate system. i y″ represents the lateral coordinate of a vertex in the second solid model. i Z″ represents the longitudinal coordinate of a vertex in the second solid model. i Let r represent the vertical coordinates of the vertices in the second solid model. Then the maximum distance can be expressed as max(r). i ).
[0168] In some embodiments, see Figure 3E , Figure 3E This is a schematic diagram of the fifth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3D Step 1022 can be achieved through Figure 3E Steps 10221 to 10222 are implemented, and the details are explained below.
[0169] In step 10221, the ratio of the maximum distance to the number of segments to be divided is determined.
[0170] Following the examples from steps 1021 and 1022 above, the maximum distance max(r) iThe ratio of the number of parts to be divided to the number of parts N can be expressed by the following formula:
[0171]
[0172] Where max(r) i ) represents the maximum distance, N represents the number of partitions, and Δr is the maximum distance max(r i The ratio of the number of sub-models to the number of sub-models N, which represents the distance between any two adjacent sub-models. See also Figure 4D Maximum distance max(r) i If the number of items to be divided is N = 4, then the ratio is 4r. That is, the distance between any two adjacent sub-models is r.
[0173] In step 10222, an arithmetic sequence with a ratio as the common difference is generated, and multiple elements in the arithmetic sequence are used as slice radii, wherein the minimum value of the arithmetic sequence is the ratio, and the maximum value of the arithmetic sequence is the product of the ratio and the number to be divided.
[0174] Following the example in step 10221 above, the arithmetic sequence a with the ratio Δr as the common difference... j It can be represented as a j = j * Δr, where 1 ≤ j ≤ N, j is a natural number, j represents the count of the slice radius, when j = 1, the minimum value of the arithmetic sequence a1 = Δr; when j = N, the maximum value of the arithmetic sequence a1 = Δr. N =N*Δr. The radius of each slice is the product of its order and the ratio. See also Figure 4D In the right-hand diagram, the minimum number of arithmetic progressions is r, and the maximum number of arithmetic progressions is 4r. Therefore, the arithmetic progression sequence with the ratio r as the common difference is {r, 2r, 3r, 4r}, which means that the radii of the multiple slices are r, 2r, 3r, and 4r respectively.
[0175] See also Figure 3D In step 1023, the second solid model is divided into multiple sub-models according to multiple slice radii, wherein different slice radii correspond to different sub-models.
[0176] In some embodiments, the number of sub-models is the same as the number of slice radii.
[0177] For example, if the total number of sub-models is N (the number of sub-models to be divided), then the total number of slice radii is also N. The order of the slice radii corresponds one-to-one with the order of the sub-models. For instance, the first slice radius (i.e., the minimum slice radius) corresponds to the first sub-model, and the last slice radius (i.e., the maximum slice radius) corresponds to the last sub-model. See also... Figure 4DIn the right-hand diagram, slice radius r corresponds to submodel 405, slice radius 2r corresponds to submodel 404, slice radius 3r corresponds to submodel 403, and slice radius 4r corresponds to submodel 402.
[0178] This application adjusts the number of model segments based on the actual performance of the device. High-performance devices can perform finer segmentation, while low-performance devices can reduce the number of segments to avoid overload. A ratio of the maximum distance to the number of segments is determined. This ratio provides a benchmark for generating an arithmetic progression sequence of slice radii, ensuring the uniformity of slice radii and making the segmented sub-models spatially evenly distributed, which is beneficial for subsequent processing and rendering. By adjusting the tolerance of the arithmetic progression sequence, the size and number of sub-models can be flexibly controlled. Segmenting the model based on slice radii allows the model to adapt to different application requirements. The segmented sub-models can be processed independently to facilitate parallel and distributed processing, thereby improving computational efficiency. Different sub-models can correspond to different levels of detail, allowing for hierarchical processing of the model, such as using different levels of detail during rendering. Different computational resources can be allocated according to the complexity of the sub-models to optimize the overall processing flow.
[0179] In some embodiments, see Figure 3F , Figure 3F This is a schematic diagram of the sixth process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3D Step 1023 can be achieved through Figure 3E Steps 10231 to 10233 are implemented, and the details are explained below.
[0180] In step 10231, the radial range of the spherical coordinate system is divided into multiple intervals based on multiple slice radii.
[0181] In some embodiments, the multiple intervals are adjacent to each other, and an interval has a first slice radius as the maximum value of its radial range and a second slice radius as the minimum value of its radial range. The second slice radius is the radius that is second only to the first slice radius among the multiple slice radii.
[0182] For example, for the j-th slice radius, when j = 1, the radial range between the origin of the spherical coordinate system and the first slice radius is used as one interval; when j is greater than or equal to 2, the radial range between the (j-1)-th slice radius and the j-th slice radius is used as one interval. See also Figure 4DThe right-hand diagram defines the radial range between the origin of the spherical coordinate system and the first slice radius r (i.e., the slice radius r corresponding to sub-model 405) as one interval; the radial range between the first slice radius r and the second slice radius r (i.e., the slice radius r corresponding to sub-model 404) as one interval; the radial range between the second slice radius r and the third slice radius r (i.e., the slice radius r corresponding to sub-model 403) as one interval; and the radial range between the third slice radius r and the fourth slice radius r (i.e., the slice radius r corresponding to sub-model 402) as one interval.
[0183] In step 10232, multiple geometric datasets located in multiple intervals are extracted from the second solid model. Specifically, a geometric dataset is extracted from one interval, and the geometric dataset includes multiple spherical coordinates within the interval and material information within the interval.
[0184] For example, see Figure 4D In the right-hand diagram, for the first interval, all spherical coordinates with radial radii from 0 to r and the material information within the first interval are extracted, and the spherical coordinates with radial radii from 0 to r and the material information within the first interval are used as the geometric dataset corresponding to the first interval; for the second interval, the spherical coordinates with radial radii from r to 2r and the material information within the second interval are used as the geometric dataset corresponding to the second interval; for the third interval, the spherical coordinates with radial radii from 2r to 3r and the material information within the third interval are used as the geometric dataset corresponding to the third interval; for the fourth interval, the spherical coordinates with radial radii from 3r to 4r and the material information within the fourth interval are used as the geometric dataset corresponding to the fourth interval.
[0185] In step 10233, multiple geometric datasets are used as multiple sub-models.
[0186] Here, a geometric dataset is used as a sub-model. In each sub-model, the azimuth range of the spherical coordinates is [0°, 360°), and the polar range is [0°, 180°].
[0187] This application's embodiments, by dividing the radial range of the spherical coordinate system into multiple intervals, allow for more detailed management and processing of different parts of the model. In scenarios with highly complex models or requiring local optimization, this facilitates localized model processing. The geometric dataset within each interval can be processed independently of other intervals, enabling parallel computation. Multiple processing units can simultaneously process different geometric datasets, thereby accelerating the overall processing speed. Computational resources can be optimally allocated based on the complexity and importance of the geometric dataset within each interval; more resources can be allocated to important or complex intervals to ensure both quality and efficiency. During rendering, sub-models located within specific intervals can be selectively rendered based on the viewpoint and clipping plane, reducing unnecessary rendering computations and improving rendering efficiency.
[0188] See also Figure 3A In step 103, multiple sub-models are voxelized to obtain multiple voxel datasets, where each sub-model corresponds to one voxel dataset.
[0189] For example, see Figure 4E , Figure 4E This is a schematic diagram of the voxelization of the sub-model provided in the embodiments of this application. Figure 4E In the left-hand image, the second solid model 401 is divided into multiple sub-models, showing a 1 / 8 cross-section of each sub-model. The actual sub-model is a complete spherical shell with thickness r. The multiple sub-models include sub-models 402, 403, 404, and 405. Figure 4E In the right-hand figure, multiple sub-models are voxelized, that is, multiple sub-models are filled with voxels (unit cubes) to obtain the approximate shape of each sub-model. For any sub-model, the set of multiple voxel data after voxelization of the sub-model is used as the voxel dataset of the sub-model.
[0190] In some embodiments, see Figure 3G , Figure 3G This is a schematic diagram of the seventh process of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3A Step 103 can be performed for each sub-model. Figure 3G Steps 1031 to 1034 are implemented, and the details are explained below.
[0191] In step 1031, the initialization tensor set of the sub-model is obtained, wherein the initialization tensor set includes multiple initialization tensors, and one initialization tensor corresponds to a vertex in the sub-model.
[0192] In some embodiments, the tensor value of each initial tensor in the initial tensor set is set to 0, that is, the tensor value corresponding to each vertex in the sub-model is set to 0.
[0193] In step 1032, the coordinates of each vertex of the sub-model are mapped to the voxel mesh to obtain the target coordinates of each vertex in the voxel mesh.
[0194] In some embodiments, for each vertex in the sub-model, the mean of the coordinates of each dimension of the vertex and the coordinates of the corresponding dimension of the origin of the voxel grid are determined, and the product of the mean of each dimension and the size of the corresponding dimension of the voxel grid is determined to obtain the target coordinates of the vertex in the voxel grid.
[0195] For example, if the coordinates of any vertex in the sub-model are represented as (x″) i ,y″ i , z″ i The origin of the voxel mesh is represented as (1, 1, 1). If the dimensions of the voxel mesh in the horizontal, vertical, and longitudinal dimensions are d respectively... x d y and d z Then the mean values of the coordinates of each dimension of the vertex and the coordinates of the corresponding dimension of the origin of the voxel mesh are respectively: The product of the mean of each dimension and the size of the corresponding dimension of the voxel grid is as follows: make The target coordinates of the vertex in the voxel mesh are (v x v y v z ).
[0196] In step 1033, the initial tensor set is updated based on the target coordinates to obtain the input tensor set.
[0197] In some embodiments, the value of the initialization tensor corresponding to the vertex mapped to the voxel mesh is updated to a preset value. The preset value is used to indicate that the vertex has been mapped to the voxel mesh. The preset value can be any value of tensor that is different from the value of the initialization tensor. The initialization tensor set is updated based on each updated initialization tensor to obtain the input tensor set. The input tensor set includes multiple input tensors, and each updated initialization tensor is used as an input tensor.
[0198] Following the examples from steps 1031 and 1032 above, the coordinates of any vertex in the sub-model are represented as (x″). i ,y″ i , z″ i For example, the initial tensor value of this vertex is 0. Then, when mapping this vertex to the target coordinates (v... x v y v z After that, update the tensor value of the initialization tensor for that vertex to 1. Combine the updated tensor values of the initialization tensors for multiple vertices and input them into the tensor set.
[0199] Here, due to the differences in the number and density of vertices in different sub-models, after updating the tensor values of all vertices mapped to the voxel mesh to 1, the initial tensor sets corresponding to different sub-models also differ, thus enabling the input tensor set to serve as an effective representation of the sub-model.
[0200] In step 1034, the pre-trained voxel transformation model is invoked based on the input tensor set to obtain the voxel dataset of the sub-model.
[0201] For example, voxel transformation models can be 3D convolutional neural networks (3DCNN), voxel generative adversarial networks, voxel autoencoders, and point cloud processing models (PointNet).
[0202] In some embodiments, see Figure 3H , Figure 3H This is the eighth flowchart of the texture rendering method for a 3D model provided in the embodiments of this application. Figure 3G Step 1034 can be achieved through Figure 3H Steps 10341 to 10344 are implemented, and the details are explained below.
[0203] In step 10341, the input tensor set is convolved by the spherical convolution kernel of the pre-trained voxel conversion model to obtain candidate features.
[0204] In some embodiments, for each input tensor in the set of input tensors, sliding sampling is performed on the input tensor based on a spherical convolution kernel to obtain multiple local regions, wherein the size of the local regions is the same as that of the spherical convolution kernel; for each local region, the product of the elements in the local region with the corresponding elements in the spherical convolution kernel is determined, and the sum of the multiple products corresponding to the multiple elements in the local region is determined; candidate features are constructed based on the multiple sums corresponding to the multiple local regions.
[0205] For example, a predefined convolutional kernel is used. The kernel is a fixed-size matrix, which can be an odd number of values, such as 3x3. Each element of the kernel has a weight value. This kernel is slid across the input tensor, covering a local region of the input tensor. The product of each element in that local region and the corresponding element of the spherical convolutional kernel is calculated. The products of multiple elements are summed to obtain the features corresponding to that local region. The features corresponding to multiple local regions are combined into candidate features.
[0206] In this embodiment, a spherical convolution kernel is used to convolve the input tensor set. Since the design of the spherical convolution kernel depends on spherical symmetry, the convolution operation can better capture the features of the sub-model in spherical coordinates.
[0207] In step 10342, the stride and size of the pooling window of the pre-trained voxel conversion model are updated according to the dimension of the candidate features, wherein the dimension of the candidate features is positively correlated with the stride of the pooling window and the dimension of the candidate features is positively correlated with the size of the pooling window.
[0208] For example, the dimensions of a candidate feature include depth (number of feature channels), height, and width. If the dimension of the candidate feature is D, the stride of the pooling window is represented by S, and the size of the pooling window is represented by K, then the relationship between the dimension D of the candidate feature and the stride S of the pooling window can be S = f(b) * D, where f(b) represents a positive number greater than 1 or a proportional function; the relationship between the dimension D of the candidate feature and the size K of the pooling window can be K = f(c) * D, where f(c) represents a positive number greater than 1 or a proportional function.
[0209] In step 10343, the candidate features are pooled according to the stride and size of the updated pooling window to obtain the target features.
[0210] In some embodiments, the pooling window slides across the candidate features with an updated stride. Each slide calculates the pooling feature value of the current pooling window based on the pooling operation (such as taking the maximum or average value) of the element values within the pooling window. A single pooling feature value is generated at the position of each stride, and the pooling feature values corresponding to multiple strides are combined into the target feature.
[0211] Examples of pooling operations include max pooling, average pooling, adaptive pooling, global pooling, bilinear pooling, overlapping pooling, and non-overlapping pooling. See also Figure 5A , Figure 5A This is a schematic diagram illustrating the principle of the pooling operation provided in the embodiments of this application. Figure 5A The left-hand image shows candidate features, each 4x4 in size. If the updated pooling window size is 2x2 with a stride of 2, the candidate features are divided into four equal parts (one part for each background) according to the updated pooling window size and stride. Taking max pooling as an example, the maximum value of each part is selected. For instance, the max pooling value of the first part (the 2x2 window in the upper left corner of the candidate features) is 6, the max pooling value of the second part (the 2x2 window in the upper right corner of the candidate features) is 8, the max pooling value of the third part (the 2x2 window in the lower left corner of the candidate features) is 3, and the max pooling value of the fourth part (the 2x2 window in the lower right corner of the candidate features) is 4. Figure 5AThe features obtained from the right-hand graph (i.e., the features composed of pooling values 6, 8, 3, and 4) are used as the target features.
[0212] As an example of steps 10341 to 10343 above, see Figure 5B , Figure 5B This is a schematic diagram of the convolution and pooling operations provided in the embodiments of this application. The input tensor set is convolved by the spherical convolution kernel of the pre-trained voxel conversion model to obtain candidate features. The stride and size of the pooling window of the pre-trained voxel conversion model are updated according to the dimension of the candidate features. The candidate features are then pooled according to the updated stride and size of the pooling window to obtain the target features.
[0213] In step 10344, feature mapping is performed based on the target features to obtain the voxel dataset of the sub-model.
[0214] Here, the voxel dataset includes multiple voxel data, and each voxel data corresponds to a vertex in the sub-model.
[0215] In some embodiments, see Figure 3I , Figure 3I This is the ninth flowchart of the texture rendering method for a 3D model provided in the embodiments of this application. Figure 3H Step 10334 can be achieved through Figure 3I Steps 10345 to 10348 are implemented, and the details are explained below.
[0216] In step 10345, feature fusion is performed on target features at different scales to obtain fused features.
[0217] In some embodiments, feature tensors of different scales are selected from the target features obtained by pooling operations. These feature tensors are derived from different levels of pooling operations in a pre-trained voxel transformation model, representing different spatial resolutions and levels of abstraction. Feature fusion is then performed on the target features at different scales to obtain fused features.
[0218] For example, feature fusion methods include any of the following: concatenating feature tensors of different scales along the depth (channel) dimension to obtain fused features, thereby increasing the expressive power of the features; applying different weights to different feature tensors and then performing a weighted summation to obtain fused features, where the weights can be dynamically adjusted according to the size of the feature tensors, and the size of the feature tensors is positively correlated with the weights; or using additional convolutional layers to process features of different scales and then merging the processed features to obtain fused features.
[0219] In step 10346, the fused features are upsampled to obtain upsampled features.
[0220] In some embodiments, an upsampling factor, i.e., the magnification factor of the upsampling operation, is determined based on the spatial resolution of the fused features and the desired output resolution. For example, the ratio of the output resolution to the spatial resolution is determined and used as the upsampling magnification factor. The spatial dimensions (width, height, and depth) of the fused features are magnified according to the upsampling operation magnification factor. For newly added spatial locations, the corresponding features are calculated using an interpolation method.
[0221] For example, upsampling methods include nearest neighbor upsampling, bilinear upsampling, and bicubic upsampling. Taking bilinear upsampling as an example, it can obtain the features corresponding to the new spatial location by performing a weighted summation of the features of multiple locations adjacent to the new spatial location.
[0222] Here, the fused features can also be transposed convolutionally to increase the spatial dimension of the fused feature map and obtain upsampled features.
[0223] In step 10347, each element in the upsampled feature is mapped to voxel data in three-dimensional space.
[0224] In some embodiments, for each element in the upsampled features, the corresponding voxel value is calculated according to the mapping strategy and assigned to the corresponding spatial location to obtain the voxel data corresponding to that element.
[0225] For example, the mapping strategy can be any of the following: Nearest Neighbor Mapping: For each element, find the voxel position closest to the element and directly assign the element's feature value to the voxel at that position to obtain the voxel data corresponding to the element; Linear Interpolation Mapping: For each element, calculate the weighted average of the voxel values around that position using a linear interpolation method based on the element's position in 3D space, and then assign the result to the voxel data corresponding to the element; Distance-Weighted Mapping: Assign a weight to each voxel based on the distance between the element and the centers of the surrounding voxels, and then calculate the voxel data corresponding to the element based on these weights; Kernel Function Mapping: Use a kernel function (such as a Gaussian kernel or an Epanechnikov kernel) to calculate the voxel data corresponding to the element.
[0226] In step 10348, the voxel data corresponding to multiple elements are concatenated to obtain the voxel dataset of the sub-model.
[0227] Here, the mapped voxel data are arranged and stitched together according to their corresponding spatial locations to form the voxel dataset of the sub-model. During the stitching process, the boundaries between voxel data can be handled to eliminate any artificial boundary effects introduced by mapping or upsampling.
[0228] This application's embodiments discretize the continuous vertex space by mapping vertices to a voxel mesh, providing an effective spatial indexing mechanism. Converting vertices into voxel data using a pre-trained voxel transformation model improves the accuracy and efficiency of the transformation, reducing the required training data and computational resources. Dynamically adjusting the stride and size of the pooling window based on the dimensionality of candidate features allows the model to better adapt to features at different scales, improving the flexibility of feature extraction. Feature fusion integrates information at different scales, while upsampling increases the resolution of voxel data, contributing to improved spatial representation capabilities of the model. Mapping upsampled features to voxel data and concatenating them provides a directly usable data format for subsequent rendering and processing. The voxel dataset can be used for rapid rendering and interaction, providing an efficient way to process and query 3D spatial data.
[0229] In some embodiments, see Figure 3J , Figure 3J This is a schematic diagram of the tenth step of the texture rendering method for a 3D model provided in this application embodiment. The pre-trained voxel conversion model described above can be executed... Figure 3I The training was completed in steps 201 to 204, and the details are explained below.
[0230] In step 201, tensor samples and real labels are obtained, wherein the real labels represent the real voxel data corresponding to the tensor samples.
[0231] Here, the true category labels can be manually labeled, or the model can be scanned using a 3D scanner, and then computer vision technology can be used to reconstruct the voxel representation of the model from the scanned data to obtain the true voxel data corresponding to the tensor samples.
[0232] In step 202, the initialized voxel transformation model is invoked based on the tensor samples to obtain the predicted labels.
[0233] In some embodiments, the initialization representation randomly assigns values to the parameters of the voxel transformation model, for example, assigning all parameters of the voxel transformation model to 0 or all to 1. The prediction label represents the predicted voxel data corresponding to the tensor sample.
[0234] For example, see Figure 5C , Figure 5C This is a schematic diagram illustrating the training principle of the voxel conversion model provided in this application embodiment. Figure 5CIn this model, based on tensor samples, the convolutional and fully connected layers of the initialized voxel transformation model can be called to obtain the predicted labels.
[0235] In step 203, the loss value is determined based on the real label and the predicted label.
[0236] In some embodiments, the difference between the true label and the predicted label can be determined, and the difference can be substituted into the loss function to obtain the loss value.
[0237] For example, the loss function can be the mean squared error loss function, the cross-entropy loss function, the multi-label classification loss function, and the triplet loss function.
[0238] In step 204, the parameters of the initialized voxel conversion model are updated based on the loss value to obtain the pre-trained voxel conversion model.
[0239] In some embodiments, the loss value is backpropagated to update the parameters of the initialized voxel conversion model. The process of calculating the loss value and updating the parameters is repeated multiple times until the loss value no longer increases or decreases, at which point the iteration process is stopped, and a pre-trained voxel conversion model is formed.
[0240] For example, backpropagation is implemented using the backpropagation algorithm, which calculates the gradient of each neuron from the output layer to the input layer and updates the neuron's weights and biases based on the gradients. Gradient descent is used to continuously update the parameters, thus reducing the loss value. Various gradient descent algorithms can be used, such as batch gradient descent, stochastic gradient descent, adaptive gradient descent, and momentum gradient descent.
[0241] In this embodiment, the pre-trained voxel conversion model can automatically convert input tensors into voxel datasets, improving voxel conversion efficiency and reducing the complexity and time cost of manual computation. The pre-trained model can be trained based on different tensor samples and labels, adapting to various devices and scenarios.
[0242] See also Figure 3A In step 104, multiple voxel datasets are combined into a voxel dataset for the third stereo model.
[0243] In some embodiments, see Figure 3K , Figure 3K This is a schematic diagram of the eleventh step of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3A Step 104 can be achieved through Figure 3K Steps 1041 to 1043 are implemented, and the details are explained below.
[0244] In step 1041, an initial voxel dataset is constructed.
[0245] Here, the spatial range of the third stereo model is determined based on the position in multiple sub-models. An initial voxel dataset is created within this spatial range. The voxel value of each voxel in the initial voxel dataset can be preset, for example, all of them are 1 or 0.
[0246] In step 1042, for each sub-model, the largest voxel data is determined from the following two: the voxel data of each dimension in the voxel dataset corresponding to the sub-model, and the voxel data of the corresponding dimension in the initial voxel dataset; the voxel data of the corresponding dimension in the initial voxel dataset is updated based on the largest voxel data of each dimension to obtain the target voxel dataset.
[0247] In some embodiments, for each sub-model, if the voxel data in the horizontal dimension of the voxel dataset corresponding to the sub-model is greater than the voxel data in the horizontal dimension of the initial voxel dataset, then the voxel data in the horizontal dimension of the voxel dataset corresponding to the sub-model is used to replace the voxel data in the horizontal dimension of the initial voxel dataset; otherwise, the voxel data in the horizontal dimension of the initial voxel dataset is still used. If the voxel data in the vertical dimension of the voxel dataset corresponding to the sub-model is greater than the voxel data in the vertical dimension of the initial voxel dataset, then the voxel data in the vertical dimension of the voxel dataset corresponding to the sub-model is used to replace the voxel data in the vertical dimension of the initial voxel dataset; otherwise, the voxel data in the vertical dimension of the initial voxel dataset is still used. If the voxel data in the vertical dimension of the voxel dataset corresponding to the sub-model is greater than the voxel data in the vertical dimension of the initial voxel dataset, then the voxel data in the vertical dimension of the voxel dataset corresponding to the sub-model is used to replace the voxel data in the vertical dimension of the initial voxel dataset; otherwise, the voxel data in the vertical dimension of the initial voxel dataset is still used. The updated voxel data in the horizontal dimension, vertical dimension, and other dimensions are combined to form the target voxel dataset.
[0248] For example, the voxel dataset T(v) corresponding to the sub-model x v y v z This includes voxel data in the horizontal dimension. x Voxel data in the vertical dimension v y And vertical dimension voxel data z Initial voxel dataset Including voxel data in the horizontal dimension Voxel data in the vertical dimension and vertical dimension voxel data like Then v x As the horizontal dimension of the target voxel dataset, if Then Voxel data as the horizontal dimension of the target voxel dataset; if Then vy As the vertical dimension of the target voxel dataset, if Then Voxel data as the vertical dimension of the target voxel dataset; if Then v z As the vertical dimension of the target voxel dataset, if Then The voxel data represents the vertical dimension of the target voxel dataset. If the voxel dataset T(v) corresponding to the sub-model... x v y v z The voxel data for each dimension in the dataset is greater than the voxel data for the corresponding dimension in the initial voxel dataset, that is... and and The target voxel dataset V is then represented as (v x v y v z ).
[0249] In step 1043, multiple target voxel datasets are combined into a voxel dataset for the third stereo model.
[0250] Here, multiple target voxel datasets are combined sequentially according to the order of their corresponding sub-models to form the voxel dataset of the third stereo model.
[0251] For example, see Figure 4F , Figure 4F This is a schematic diagram illustrating the conversion of a second stereo model into a third stereo model according to an embodiment of this application. Multiple sub-models obtained by segmenting the second stereo model 409 are voxelized to obtain multiple target voxel datasets. The cross-sections of adjacent sub-models are then stitched together according to the position, structure, and connection relationships between the sub-models in the second stereo model to obtain the third stereo model 401.
[0252] See also Figure 3A In step 105, the texture of the third stereo model is rendered based on the voxel data of the surface region of the third stereo model in the voxel dataset of the third stereo model.
[0253] In some embodiments, see Figure 3L , Figure 3L This is a schematic diagram of the twelfth step of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3A Step 105 can be achieved through Figure 3L Steps 1051 to 1053 are implemented, and the details are explained below.
[0254] In step 1051, texture mapping is performed on the voxel data located in the surface region of the third stereo model in the voxel dataset of the third stereo model to obtain the first texture data.
[0255] In some embodiments, see Figure 3M , Figure 3M This is a schematic diagram of the thirteenth step of the texture rendering method for a 3D model provided in the embodiments of this application. Figure 3L Step 1051 can be performed for each voxel data in the voxel data of the surface region of the third solid model. Figure 3M Steps 10511 to 10512 are implemented, and the details are explained below.
[0256] In step 10511, based on the coordinates of the center point of the third stereo model and the scaling factor, the coordinates of the voxel data are normalized to obtain normalized coordinates.
[0257] In some embodiments, the mean value of multiple vertices in the third solid model is calculated in each dimension, and the mean values of the horizontal, vertical, and longitudinal dimensions are combined to form the coordinates of the center point. For each voxel data of the surface in the third solid model, the following processing is performed in each dimension: determining the ratio of the voxel value in that dimension to the size of the voxel mesh in that dimension; determining the difference between the ratio and a fixed value; determining the product of the difference and a scaling factor; determining the sum of the product and the coordinates of the center point in that dimension; and using the sum as the normalized coordinates for that dimension. The normalized coordinates of multiple dimensions are combined to form normalized coordinates.
[0258] For example, assume the coordinates of the center point are C(c x c y c z ), where c x c represents the coordinates of the center point in the horizontal dimension. y c represents the coordinates of the center point in the vertical dimension. z This represents the coordinates of the center point in the vertical dimension. If any voxel data of the surface in the third solid model is represented as... For the horizontal dimension, the voxel value of the horizontal dimension The size d of the voxel mesh in the horizontal dimension x The ratio is Assuming the fixed value is 1 / 2, then the ratio The difference from the fixed value of 1 / 2 is Difference The product with the scaling factor s is The product and the coordinates of the center point of the horizontal dimension, c x The sum of these can be expressed by the following formula:
[0259]
[0260] Where, x″ i c represents the normalized coordinates of the horizontal dimension. x This represents the coordinates of the center point in the horizontal dimension, where 's' represents the scaling factor. d represents the voxel value of any voxel data on the surface of the third solid model in the horizontal dimension. x This indicates the size of the voxel mesh in the horizontal dimension.
[0261] For the vertical dimension, the voxel values of the vertical dimension The size d of the voxel mesh in the vertical dimension y The ratio is Assuming the fixed value is 1 / 2, then the ratio The difference from the fixed value of 1 / 2 is Difference The product with the scaling factor s is The product and the coordinates of the center point of the vertical dimension, c y The sum of these can be expressed by the following formula:
[0262]
[0263] Among them, y″ i c represents the normalized coordinates of the vertical dimension. y This represents the coordinates of the center point in the vertical dimension, where 's' represents the scaling factor. d represents the voxel value of any voxel data on the surface of the third solid model in the vertical dimension. y This indicates the size of the voxel mesh in the vertical dimension.
[0264] For the vertical dimension, the voxel value of the vertical dimension The size d of the voxel mesh in the vertical dimension x The ratio is Assuming the fixed value is 1 / 2, then the ratio The difference from the fixed value of 1 / 2 is Difference The product with the scaling factor s is The product and the coordinates of the center point of the vertical dimension, c z The sum of these can be expressed by the following formula:
[0265]
[0266] Among them, z″ i c represents the normalized coordinates in the vertical dimension. z This represents the coordinates of the center point in the vertical dimension, where 's' represents the scaling factor. d represents the voxel value of any voxel data on the surface of the third solid model in the vertical dimension.z This represents the size of the voxel mesh in the vertical dimension. Normalized coordinates from multiple dimensions are combined into a normalized coordinate (x′). i y′ i , z′ i ).
[0267] In step 10522, the normalized coordinates are dimensionality-reduced and mapped to obtain the first texture data.
[0268] In some embodiments, the normalized coordinates can be reduced in dimension using a dimension reduction mapping algorithm to obtain the first texture data.
[0269] For example, dimensionality reduction algorithms include Principal Component Analysis (PCA), autoencoders, and feature selection. PCA projects data onto principal components to reduce dimensionality; autoencoders use neural networks to learn a low-dimensional representation of the data; and feature selection chooses the most important feature dimensions based on specific criteria. Taking PCA as an example, normalized coordinates are arranged into a matrix where each row represents a data sample and each column represents a feature dimension. The matrix is then centered by subtracting the mean from each feature dimension. The covariance matrix of the centered matrix is then calculated, describing the correlation between features. The eigenvalues and corresponding eigenvectors of the covariance matrix are then solved. Eigenvalues represent the variance of each eigenvector, and eigenvectors represent the orientation of the data in the low-dimensional space. Based on the magnitude of the eigenvalues, eigenvectors with values greater than a threshold are selected. The data dimensions corresponding to these eigenvectors are then used as principal components, with the eigenvectors having the largest eigenvalues capturing the most variability in the data. The product of the eigenvectors and matrices of the selected principal components is determined to map the original high-dimensional data to a low-dimensional space, resulting in the first texture data. In the low-dimensional space, the first texture data represents the main features of the original data.
[0270] In some embodiments, prior to step 1051, the following processing may also be performed: for each voxel data in the voxel dataset of the third stereo model, in response to the voxel value of the voxel data being a first preset value and the voxel value of the adjacent voxel data being a second preset value, the voxel data is used as the voxel data in the voxel dataset of the third stereo model located in the surface region of the third stereo model.
[0271] For example, adjacent voxel data refers to voxel data in the third stereo model that is adjacent to the current voxel data. The first preset value can be 1, and the second preset value can be 0. For each voxel data in the third stereo model, if the voxel value of the voxel data is 1, the voxel data has 4 adjacent voxel data. If any of the 4 adjacent voxel data has a voxel value of 0, then the voxel data is regarded as the voxel data in the surface region of the third stereo model in the voxel dataset.
[0272] See also Figure 3L In step 1052, the first texture data is assigned a texture value to obtain the second texture data.
[0273] In some embodiments, see Figure 3N , Figure 3N This is a schematic diagram of the fourteenth step of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3L Step 1052 can be achieved through Figure 3N Steps 10521 to 10522 are implemented, and the details are explained below.
[0274] In step 10521, the color value of the first texture data in the preset texture image is queried.
[0275] Here, at least one texture image to be rendered on the surface of the third solid model is obtained as a preset texture image, wherein the at least one texture image includes color information for texture mapping. Based on the information in the first texture data (such as texture coordinates or indexes), the corresponding color value is queried in the preset texture image, where each element in the first texture data corresponds to a pixel in the preset texture image.
[0276] In step 10522, the color value is assigned to the first texture data to obtain the second texture data.
[0277] Here, the retrieved color value is assigned to the corresponding element in the first texture data to create the second texture data, which now includes the actual color information for rendering the third stereo model.
[0278] See also Figure 3L In step 1053, the texture of the third stereo model is rendered based on the second texture data.
[0279] In some embodiments, see Figure 3O , Figure 3O This is the fifteenth flowchart of the texture rendering method for a three-dimensional model provided in the embodiments of this application. Figure 3L Step 1053 can be achieved through Figure 3O Steps 10531 to 10533 are implemented, and the details are explained below.
[0280] In step 10531, the texture coordinates corresponding to each vertex in the third 3D model are generated.
[0281] In some embodiments, a corresponding texture mapping type is selected based on the geometric features of the model and the desired texture effect. For each vertex, its corresponding texture coordinates are calculated according to the selected texture mapping type. Specifically, for each vertex, the normals of the faces surrounding the vertex are calculated and averaged to obtain its normal vector, and the three-dimensional coordinates of the vertex are mapped to the texture space based on the normal vector.
[0282] For example, mapping types can include: Planar Mapping, which maps textures to a specified plane of the model; Cylindrical Mapping, which maps textures around a cylindrical model; Spherical Mapping, which maps textures to a spherical model; Cube Mapping, which maps textures to the six faces of a cube; and UV Mapping, which manually or automatically assigns UV coordinates to each vertex of the model.
[0283] In step 10532, the second texture data corresponding to each texture coordinate is queried.
[0284] Here, the corresponding color value in the second texture data is retrieved based on the texture coordinates of each vertex. If the second texture data is organized based on vertex indexes, the second texture data corresponding to each texture coordinate can be obtained through a lookup table or direct access.
[0285] In step 10533, the second texture data is applied to the corresponding texture coordinates.
[0286] In some embodiments, the retrieved texture data (color values) is applied to each vertex to assign a color value to the vertex, or the texture color is blended with the vertex's intrinsic color in the vertex shader. The texture of the third-dimensional model can be rendered using the graphics rendering pipeline. Specifically: vertex and texture data are passed to the graphics pipeline; rendering states are set, including texture units, texture coordinate generation mode, and texture blending mode; the graphics rendering pipeline applies the second texture data of the vertices to the corresponding texture coordinates, thus achieving texture rendering of the third-dimensional model.
[0287] For example, graphics rendering pipelines include the Open Graphics Library (OpenGL), the DirectX programming interface, or the Vulkan graphics application programming interface.
[0288] As an example of step 10533, the CPU submits rendering instructions to the GPU. If the GPU receives the instructions from the CPU, it converts the vertex data in the second texture data into primitives (such as triangles); the primitives are converted into fragments, which are pixels, and each fragment generates corresponding pixel data; each fragment is mapped to texture coordinates for shading and texture processing, including lighting calculations, texture blending, and color blending; the final color value is output to the frame buffer through the fragment shader, where the data in the frame buffer is used to be read and displayed on the screen.
[0289] This application's embodiments identify surface voxels by examining voxel values and adjacent voxel values, enabling precise determination of the geometric position of the model surface. Normalizing the coordinates of the voxel data standardizes the data range, simplifying the texture mapping calculation process. Dimensionality reduction mapping of the normalized coordinates yields first texture data, reducing data dimensionality, computational complexity, and facilitating the extraction of key features. Querying the color values of the first texture data within a preset texture image allows for the utilization of existing texture resources, enhancing the model's visual effect and realism. Querying the second texture data corresponding to each texture coordinate and applying it to the texture coordinates renders a third stereo model with rich detail and texture.
[0290] See here. Figure 3P , Figure 3P This is a schematic diagram of the first overall process of the texture rendering method for a three-dimensional model provided in the embodiments of this application.
[0291] In step 301, the first solid model is translated to the origin of the coordinate system to obtain the fourth solid model.
[0292] In some embodiments, the center point of the first solid model is translated to the origin in the Cartesian coordinate system to obtain the fourth solid model.
[0293] For example, taking a game scene as an example, the first 3D model can be at least one of the following: game props, player characters, non-player characters, and game scenes. For each vertex in the first 3D model, the coordinates of each vertex are obtained. The average of the maximum and minimum values of the horizontal coordinates is used as the horizontal coordinate of the center point of the first 3D model, the average of the maximum and minimum values of the vertical coordinates is used as the vertical coordinate of the center point of the first 3D model, and the average of the maximum and minimum values of the vertical coordinates is used as the vertical coordinate of the center point of the first 3D model, so as to determine the position of the center point of the first 3D model.
[0294] In step 302, the fourth solid model is scaled down to a unit cube to obtain the fifth solid model.
[0295] For example, the side length of the unit cube can be set manually or scaled proportionally to the size of the fourth solid model. For instance, the side length of the unit cube can be set to one centimeter, one decimeter, or one millimeter.
[0296] In step 303, the fifth solid model is transformed into spherical coordinates to obtain the second solid model.
[0297] For an example, see the example in step 1014 above, which will not be repeated here.
[0298] In step 304, the slice radius is determined based on the number of slices to be divided.
[0299] In some embodiments, the number of segments to be divided is determined based on the computing power parameters of the electronic device, wherein the computing power parameters are positively correlated with the number of segments to be divided. The maximum distance between the vertices in the second solid model and the origin of the spherical coordinate system is determined, the ratio of the maximum distance to the number of segments to be divided is determined, an arithmetic sequence with the ratio as the common difference is generated, and multiple elements in the arithmetic sequence are used as slice radii.
[0300] For an example, see the example in step 102 above, which will not be repeated here.
[0301] In step 305, the radial range of the coordinate system is divided into multiple intervals based on the slice radius.
[0302] In some embodiments, the multiple intervals are adjacent to each other, and an interval has a first slice radius as the maximum value of its radial range and a second slice radius as the minimum value of its radial range. The second slice radius is the radius that is second only to the first slice radius among the multiple slice radii.
[0303] For an example, see the example in step 10231 above.
[0304] Following step 305 above, see [link to previous step]. Figure 3Q , Figure 3Q This is a second overall flowchart of the texture rendering method for a 3D model provided in the embodiments of this application.
[0305] In step 306, voxel datasets are extracted from each interval as sub-models.
[0306] In some embodiments, a geometric dataset is extracted from an interval, the geometric dataset including multiple spherical coordinates within the interval.
[0307] For an example, see the example of step 10232 above.
[0308] In step 307, each vertex of the sub-model is mapped to a voxel mesh to obtain the target coordinates.
[0309] In some embodiments, for each vertex in the sub-model, the mean of the coordinates of each dimension of the vertex and the coordinates of the corresponding dimension of the origin of the voxel grid are determined, and the product of the mean of each dimension and the size of the corresponding dimension of the voxel grid is determined to obtain the target coordinates of the vertex in the voxel grid.
[0310] For an example, see the example of step 1032 above.
[0311] In step 308, the sub-model is converted into a voxel dataset based on the target coordinates and combined into a voxel dataset of the third stereo model.
[0312] Here, feature fusion is performed on target features at different scales to obtain fused features; the fused features are upsampled to obtain upsampled features; each element in the upsampled features is mapped to voxel data in three-dimensional space; the voxel data corresponding to multiple elements are concatenated to obtain the voxel dataset of the sub-model.
[0313] In step 309, voxel data located in the surface region of the third stereo model are extracted from the voxel dataset of the third stereo model.
[0314] For example, for each voxel data in the third solid model, in response to the voxel value of the voxel data being a first preset value and the voxel value of the adjacent voxel data being a second preset value, the voxel data is used as the voxel data of the surface in the third solid model.
[0315] In step 310, texture mapping and texture assignment are performed on the voxel data located in the surface region of the third stereo model in the voxel dataset of the third stereo model.
[0316] Here, texture mapping is performed on the voxel data of the surface in the third stereo model to obtain the first texture data; texture assignment is performed on the first texture data to obtain the second texture data; and the texture of the third stereo model is rendered based on the second texture data.
[0317] In step 311, the texture of the third stereo model is rendered based on the texture mapping and the data after texture assignment.
[0318] Here, the retrieved texture data (color values) is applied to each vertex, assigning a color to the vertex, or the texture color is blended with the vertex's intrinsic color in the vertex shader. The graphics rendering pipeline can be used to render the texture of the third-dimensional model. Specifically: vertex and texture data are passed to the graphics pipeline; rendering states are set, including texture units, texture coordinate generation mode, and texture blending mode; the graphics rendering pipeline applies the second texture data of the vertices to the corresponding texture coordinates, thus achieving the texture rendering of the third-dimensional model.
[0319] The following will describe an exemplary application of the embodiments of this application in a game application scenario.
[0320] In game scenarios, for large-scale scene rendering, related technologies often involve reconstructing geometric samples and then manually processing them. These technologies are hampered by the complexity of game models, making rendering difficult and dependent on hardware limitations. This application's embodiment achieves efficient voxelization of complex 3D models by dividing the model (i.e., the second 3D model mentioned above) into multiple slices (i.e., the sub-models mentioned above) and voxelizing these slices. Compared to related model rendering methods, this reduces computational load and optimizes voxelization efficiency. It introduces a self-designed 3D convolutional neural network to process spherical slices, capturing spatial features through convolution and pooling layers. This enables accurate extraction of the model's outer contour (i.e., the voxel data of the surface in the third 3D model mentioned above) and optimization of the voxel model (i.e., the third 3D model mentioned above).
[0321] In practice, the Unreal Engine 4 (UE4) Debug toolbox is used to extract and export game model images in real time, mark game models that fail to render during debug, repair and rebuild the game models that fail to render, and send the repaired and rebuilt game models into the original resources for real-time viewing.
[0322] See Figure 6 , Figure 6 This is an overall technical framework diagram provided in the embodiments of this application. Figure 6 First, the original model to be processed (i.e., the first 3D model mentioned above) is loaded. The Cartesian coordinate system of the original 3D model is converted to a spherical coordinate system. The resulting new 3D model (i.e., the second 3D model mentioned above) is then divided into several slices (i.e., sub-models) with equal radii (i.e., the slice radius mentioned above) and angles (i.e., the azimuth and polar angle mentioned above). Figure 6The second image from the left shows the cross-section of the slices. Different slices have different attributes, including at least one of the following: color, material type, and transparency. Next, a 3D Convolutional Neural Network (CNN) architecture suitable for voxelization is designed. This CNN includes multiple 3D convolutional layers, pooling layers, and activation function layers to extract the spatial features of the model. The transformed new 3D model (i.e., the second stereo model mentioned above) is input into the trained 3D CNN, which outputs a voxel representation (i.e., the third stereo model mentioned above), where each voxel is a cube. Finally, using the voxelized data, voxel adjacency analysis is performed to retain only the boundary voxels, extracting the model's outer contour. The outer contour voxels (i.e., the surface voxel data in the third stereo model mentioned above) are mapped to the texture of the original 3D model, and texture (i.e., the texture used to render the third stereo model mentioned above) is applied to the outer contour voxels to generate the final textured voxel model.
[0323] To convert a generic 3D model into a spherical slice model (i.e., the sub-model mentioned above), first, a generic 3D model needs to be loaded. Assume this model (i.e., the first solid model mentioned above) is denoted by M and contains a series of vertices, edges, and faces. This can be represented using the vertex coordinate set {v... i} represents these vertices, and each vertex can be represented by the following formula:
[0324] v i =(x i y i , z i (9)
[0325] Among them, v i Let x represent the three-dimensional coordinates of any vertex. i The coordinates representing the horizontal dimension, y i The z-coordinate represents the vertical dimension. i Represents the coordinates of the vertical dimension.
[0326] To ensure the model exists within a uniform coordinate system, it is normalized to a unit cube. This normalization process can be accomplished through the following steps:
[0327] First, locate the bounding box of the model: determine the minimum and maximum values of the model on each coordinate axis:
[0328] x min =min i (x i ), x max =max i (x i )
[0329] ymin =min i (y i ), y max =max i (y i )
[0330] z min =min i (z i ), z max =max i (z i )
[0331] Where, x min This represents the minimum value of the model on the x-axis (i.e., the minimum horizontal coordinate of the aforementioned vertex), x max This represents the maximum value of the model on the x-axis (i.e., the maximum horizontal coordinate of the aforementioned vertex), y min This represents the minimum value of the model on the y-axis (i.e., the minimum value of the vertical coordinate mentioned above), y max This represents the maximum value of the model on the y-axis (i.e., the maximum value of the vertical coordinate mentioned above), z min This represents the minimum value of the model on the z-axis (i.e., the minimum value of the vertical coordinate mentioned above), z max This represents the maximum value of the model on the z-axis (i.e., the maximum value of the vertical coordinate mentioned above).
[0332] Then, the center point of the model is calculated, which can be represented by the following formula:
[0333]
[0334] Where c represents the center point of the model, x min This represents the minimum value of the model on the x-axis, x max The x-axis represents the maximum value of the model on the x-axis, and the y-axis represents the maximum value of the model on min This represents the minimum value of the model on the y-axis, y max The z-axis represents the maximum value of the model on the y-axis. min This represents the minimum value of the model on the z-axis, z max This represents the maximum value of the model on the z-axis.
[0335] Secondly, the model is translated to the origin. After translation, the vertices in the model can be represented by the following formula:
[0336] v′ i =v i -c=(x′ i y′ i , z′ i (11)
[0337] Where, v′ i It is the process of translating the model to the origin, where the vertex v in the original model is... i The corresponding new vertex, (x′) i y′ i , z′ i ) is the new vertex v′ i The three-dimensional coordinates of the model are given by c, where c represents the center point of the model.
[0338] Next, the maximum side length s of the model is calculated. That is, by using the minimum and maximum values on each coordinate axis, the maximum sub-side length of the model in each coordinate system is determined. Then, the maximum value is selected from multiple maximum sub-side lengths as the maximum side length, which can be expressed by the following formula:
[0339] s = max(x max -x min y max -y min , z max -z min (12)
[0340] Where s represents the maximum side length, and max is used to select the maximum value among multiple values.
[0341] Finally, the model translated to the origin is scaled down to a unit cube to obtain the scaled model (i.e., the fifth solid model mentioned above), which can be represented by the following formula:
[0342] v″ i ={v′ i} / s=(x″ i ,y″ i , z″ i (13)
[0343] In the scaled model, each vertex v″ i It is by calculating vertex v′ i The vertex v″ is obtained by the ratio of the vertex to the maximum side length s. i The three-dimensional coordinates are (x″) i ,y″ i , z″ i ).
[0344] To convert the model into multiple slice models (i.e., sub-models), the vertices of the model are converted from Cartesian coordinates to spherical coordinates, and the overall shape features of the model are better captured by the slice models.
[0345] Transforming from Cartesian coordinates to spherical coordinates: v″ for each vertex i In spherical coordinates, it can be represented as (r i θ i φi ), r i θ i φ i This can be expressed using the following formula:
[0346]
[0347]
[0348]
[0349] Where, r i Represents vertex v″ i The radial distance in spherical coordinates, θ i φ represents the polar angle. i Indicates the azimuth angle.
[0350] Select an appropriate number N of slice models (i.e., the number of sub-models mentioned above) to divide the model into N slice models. The value of N is determined by the computing power level of the device; different N values apply to devices belonging to different computing power ranges. Each slice model is contained within a radius r, which can be expressed by the following formula:
[0351] r j =j·Δr,Δr=r max / N (17)
[0352] Where j represents the j-th slice model, r j r represents the radial distance of a vertex in the j-th slice model. max Let N represent the maximum radius, N be the number of slice models to be divided, and Δr represent the distance difference between two adjacent slice models, where j = 1, 2, ..., N. Each slice model contains all slice models that satisfy r. j-1 ≤r i <r i The vertices are selected to ensure that the sizes of adjacent slice models do not differ too much, and the sphere radius is smoothed as much as possible according to the mean. Each slice model uniformly contains all vertices within a specific radius range inside the sphere, thereby achieving effective segmentation of the model.
[0353] Each slice model contains a set of vertices, denoted as S. j :S j =(v″ i |r j-1 ≤r i <r j}
[0354] This slicing method differs from the traditional Cartesian coordinate slicing method. By dividing the model into slices in a spherical coordinate system, the global features of the model can be captured better because the spherical coordinate system can reflect the radial symmetry and angular features of the model. Radial symmetry refers to the model being symmetrical about its center point, while angular features include chamfering and rounding. Chamfering makes the edges and corners smoother, and rounding makes the model more in line with the shape of the actual object.
[0355] Through the above steps, a general 3D model is converted into multiple slice models. This not only achieves model normalization and slicing, but also enhances the capture of global features of the model through innovative slicing methods.
[0356] After dividing the model into multiple slice models in spherical coordinates, voxelization is required for these slice models. First, a 3D convolutional neural network architecture suitable for voxelization is designed; see [link to relevant documentation]. Figure 7 , Figure 7 This is a schematic diagram of the architecture of the convolutional neural network provided in the embodiments of this application. The convolutional neural network includes multiple 3D convolutional layers, pooling layers and activation function layers. The convolutional layers use spherical convolutional kernels instead of traditional cubic convolutional kernels to better capture the features of the slice model. The pooling layers use adaptive pooling technology to enable the pooling operation to adapt to the size of different slice models.
[0357] To feed a sliced model into a 3D CNN, the sliced data can be converted into 3D tensors. These tensors can be represented as T. j Where j represents the j-th slice model, and the dimension of each tensor is (d x d y d z ), (d x d y d z ) is the size of the 3D voxel mesh.
[0358] First, obtain the initial 3D tensors (i.e., the set of initial tensors mentioned above): For each vertex v″ i =(x″ i ,y″ i , z″ i In the j-th slice model, map it onto the voxel mesh and obtain its position (v) on the voxel mesh. x v y v z (i.e., the target coordinates mentioned above), where v x v y and v z This can be expressed using the following formula:
[0359]
[0360]
[0361]
[0362] Among them, v x v represents the voxel coordinates of the horizontal dimension. y v represents the voxel coordinates of the vertical dimension. z d represents the voxel coordinates in the vertical dimension. x d represents the scale of the voxel mesh in the horizontal dimension. y d represents the scale of the voxel mesh in the vertical dimension. z The x″ represents the scale of the voxel mesh in the vertical dimension. i This represents the coordinates of a vertex in the horizontal dimension, y″. i The z″ represents the vertical coordinate of a vertex in the slice model. i This represents the coordinates of a vertex in the vertical dimension within the slice model.
[0363] For each location mapped to the voxel grid (v x v y v z ), and the tensor value T at the corresponding position j (v x v y v z Set T to 1, that is, T j (v x v y v z ) = 1.
[0364] The 3DCNN is trained using a large amount of labeled data, enabling it to convert slice models into voxel representations (i.e., the voxel dataset mentioned above). If a slice model fails to be fully converted into voxels, the above steps are repeated until it can be converted into voxels. The training process includes forward propagation, loss calculation, and backpropagation.
[0365] Forward propagation refers to passing the input tensor T... j The output tensor is obtained by sequentially passing it through a 3D convolutional layer, a pooling layer, and an activation function layer. It can be represented as:
[0366] During convolution, a spherical convolution kernel is used. The design of the spherical convolution kernel is based on spherical symmetry, which allows the convolution operation to better capture the features of the slice model. The convolution operation can be expressed by the following formula:
[0367]
[0368] Among them, Conv(T) j (K) represents the convolution operation, and K represents the spherical convolution kernel. It is spherical coordinates, T j Represents a tensor.
[0369] During pooling, adaptive pooling is used to adapt the pooling operation to different spherical slice sizes. The output size of the adaptive pooling layer is fixed, but the size of the pooling window (i.e., the dimensions of the pooling window mentioned above) and the stride are adaptively adjusted according to the input size. The input size is positively correlated with both the pooling window size and the stride; that is, the larger the input tensor, the larger the pooling window and the larger the stride. The pooling operation can be expressed by the following formula:
[0370]
[0371] Where Output(i) represents the pooling operation, r i-1 and r i The pooling window represents the radial boundary, r. i-1 It is the minimum value of the pooling window in the radial direction, r i It is the maximum value of the pooling window in the radial direction.
[0372] Backpropagation refers to calculating the gradient of the loss function L with respect to the network parameters θ and updating the network parameters. Backpropagation can be expressed by the following formula:
[0373]
[0374] Where L represents the loss function, θ represents the output tensor, and θ represents the network parameters.
[0375] To measure the difference between the network output and the target voxel representation, the cross-entropy loss function can be used to calculate the difference. Assume the network output is... The target voxel is represented as T j The cross-entropy loss function can then be expressed by the following formula:
[0376]
[0377] Where L represents the cross-entropy loss function, T j (v x v y v z ) represents the target voxel. For network output.
[0378] Multiple slice models are input into a trained 3DCNN, and the network outputs corresponding voxel representations. In other words, new slice models are input into the network to obtain corresponding voxel representations.
[0379] For all slice models obtained from the segmentation of the entire model, the voxel representations of each slice model (i.e., the voxel datasets of each sub-model mentioned above) are merged into a complete voxel model (i.e., the third stereo model mentioned above). Let the merged voxel model be V, and its dimension be (D). x D y D z ).
[0380] First, obtain the initial voxel model: Then, for each slice model j, its voxel representation is... The final voxel model is obtained by merging it into the initialized voxel model V, which can be represented by the following formula:
[0381]
[0382] Where V is (v x v y v z The final voxel, Vinit(v x v y v z ) indicates (v x v y v z Initialized voxels, This indicates that after 3D convolution calculation (v x v y v z For each dimension, the maximum value between the voxel initialized in the dimension and the voxel calculated by 3D convolution is selected as the final voxel for that dimension.
[0383] During the model rendering process, outer contour voxels (i.e., the surface voxel data in the third 3D model mentioned above) are extracted from the voxelized model output by 3DCNN and then colored. This can be achieved through voxel adjacency analysis. An outer contour voxel is a voxel with at least one empty neighboring voxel. The specific steps of the outer contour extraction algorithm are as follows:
[0384] First, obtain the initial outer contour voxel set.
[0385] Then, for each voxel V(v x v y v z If the voxel has a voxel value of 1 (i.e., the first preset value mentioned above) and at least one adjacent voxel has a value of 0 (i.e., the second preset value mentioned above), then it is marked as an outer contour voxel. The outer contour voxel can be represented by the following formula:
[0386]
[0387] in, Represents the set of adjacent voxels. The representation exists such that for any set of values (i, j, k), the voxel (v) x v y v z The adjacent voxel (v) x +i, v y +j,v z +k) voxel value V(v x +i, v y +j,v z +k) is 0.
[0388] Next, for each outer contour voxel B(v) x v y v z ), transform it into regression-normalized model coordinates (x″). i ,y″ i , z″ i (i.e., the normalized coordinates mentioned above) can be expressed by the following formula:
[0389]
[0390]
[0391]
[0392] Where s is the normalized scaling factor, and D x It is the size of the voxel model in the horizontal dimension, D y It is the size of the voxel model in the vertical dimension, D z It is the dimension of the voxel model in the vertical dimension, (c x c y c z ) represents the center coordinates of the model (i.e., the coordinates of the center point of the third solid model mentioned above), x″ i y″ represents the horizontal coordinate of the normalized model. i The z″ represents the vertical coordinate of the normalized model. i This represents the vertical coordinates of the normalized model.
[0393] Secondly, using the texture coordinate mapping of the original model, the normalized model coordinates (x″) are... i ,y″ i , z″ i Convert to texture coordinates (u) i v i(i.e., the first texture data mentioned above), can be represented by the following formula:
[0394] (u i v i =UVMapping(x″) i ,y″ i , z″ i (30)
[0395] Among them, u i Represents the horizontal coordinate, v i Represents the vertical coordinates, and UVMapping represents the texture mapping operation.
[0396] Finally, textures are applied to the outer contour voxels, ultimately presenting the voxel model as a visual model with color and texture. Obtain the initial texture voxel set C:
[0397] Texture assignment: For each outer contour voxel B(v x v y v z According to texture coordinates (u) i v i Find the corresponding color value in texture image I (i.e., the aforementioned preset texture image) and assign it to the texture voxel set C: [C(v x v y v z )=I(u i v i )).
[0398] The above process maps the color of two-dimensional pixels to three-dimensional voxels, which is based on the corresponding coordinate relationship. Generally, u and v are texture coordinates, and x, y, and z are world coordinates, that is, mapping from uv coordinates to world coordinates. By shading the outer contour voxels and adjusting other parameters of the model, the rendered model is obtained.
[0399] To improve the efficiency and accuracy of texture mapping, at least one of the following strategies can be adopted: block processing, that is, processing the voxel mesh in blocks to reduce the amount of calculation per operation; multi-threaded parallel computing, that is, using multi-threading technology to process multiple voxels at the same time to improve the calculation speed.
[0400] This application adjusts the number of model segments based on the actual performance of the device. High-performance devices can perform finer segmentation, while low-performance devices can reduce the number of segments to avoid overload. An arithmetic sequence of slice radii is generated based on the ratio of the maximum distance to the number of segments, ensuring the uniformity of slice radii and making the segmented sub-models spatially evenly distributed. Segmenting the model according to slice radii allows the model to adapt to different application requirements. The segmented sub-models can be processed independently to facilitate parallel and distributed processing, thereby improving computational efficiency. Different sub-models can correspond to different levels of detail, allowing for hierarchical processing of the model, such as using different levels of detail during rendering. Different computational resources can be allocated according to the complexity of the sub-models, optimizing the overall processing flow. By dividing the radial range of the spherical coordinate system into multiple intervals, different parts of the model can be managed and processed more finely. In scenarios where the model is very complex or requires local optimization, this facilitates localized processing of the model. The geometric dataset within each interval can be processed independently of other intervals to facilitate parallel computation. Multiple processing units can process different geometric datasets simultaneously, thereby accelerating the overall processing speed. Computational resources can be optimized based on the complexity and importance of the geometric dataset for each interval. Important or complex intervals can be allocated more resources to ensure quality and efficiency. During rendering, sub-models located within specific intervals can be selectively rendered based on the viewpoint and clipping plane, which can reduce unnecessary rendering calculations and improve rendering efficiency.
[0401] The following description continues to illustrate the exemplary structure of the texture rendering device 555 for the 3D model provided in the embodiments of this application as a software module. In some embodiments, such as... Figure 2 As shown, the software modules in the texture rendering device 555 of the stereoscopic model stored in the memory 550 may include:
[0402] The model conversion module 5551 is used to convert the first solid model into a second solid model in a spherical coordinate system, wherein the coordinate system used by the first solid model is different from the spherical coordinate system.
[0403] The model segmentation module 5552 is used to segment the second solid model into multiple sub-models.
[0404] The voxel processing module 5553 is used to voxelize multiple sub-models separately to obtain multiple voxel datasets, where one sub-model corresponds to one voxel dataset.
[0405] Voxel combination module 5554 is used to combine multiple voxel datasets into a voxel dataset for a third stereo model.
[0406] The texture rendering module 5555 is used to render the texture of the third stereo model based on the voxel data in the voxel dataset of the third stereo model located in the surface region of the third stereo model.
[0407] In some embodiments, the model conversion module 5551 is further configured to, when the coordinate system used by the first solid model is a Cartesian coordinate system, determine the center point of the first solid model based on the maximum and minimum values of the horizontal coordinates, the maximum and minimum values of the vertical coordinates, and the maximum and minimum values of the vertical coordinates of the vertices in the first solid model; translate the center point of the first solid model to the origin of the Cartesian coordinate system to obtain a fourth solid model; scale the fourth solid model to a unit cube to obtain a fifth solid model; convert the coordinates of each vertex of the fifth solid model to spherical coordinates in a spherical coordinate system, use the points corresponding to the spherical coordinates as vertices of the second solid model, and construct the second solid model based on the vertices of the second solid model.
[0408] In some embodiments, the model conversion module 5551 is further configured to determine the bounding box of the first solid model; determine the maximum side length of the first solid model based on the bounding box; determine the scaling ratio of the fourth solid model based on the maximum side length; and scale the fourth solid model to a unit cube based on the scaling ratio to obtain the fifth solid model.
[0409] In some embodiments, the model segmentation module 5552 is further configured to determine the number of segments to be divided based on the computing power parameters of the electronic device, wherein the computing power parameters are positively correlated with the number of segments to be divided; determine multiple slice radii based on the maximum distance between the vertices in the second solid model and the origin of the spherical coordinate system, and the number of segments to be divided; and segment the second solid model into multiple sub-models based on the multiple slice radii, wherein different slice radii correspond to different sub-models.
[0410] In some embodiments, the model segmentation module 5552 is further configured to determine the ratio of the maximum distance to the number of segments to be divided; generate an arithmetic sequence with the ratio as the common difference, and use multiple elements in the arithmetic sequence as slice radii, wherein the minimum value of the arithmetic sequence is the ratio, and the maximum value of the arithmetic sequence is the product of the ratio and the number of segments to be divided.
[0411] In some embodiments, the model segmentation module 5552 is further configured to segment the radial range of the spherical coordinate system into multiple intervals according to multiple slice radii; extract multiple geometric datasets located in multiple intervals from the second solid model, wherein a geometric dataset is extracted from one interval, and the geometric dataset includes multiple spherical coordinates within the interval; and use the multiple geometric datasets as multiple sub-models.
[0412] In some embodiments, the voxel processing module 5553 is further configured to perform the following processing for each sub-model: obtain an initial tensor set of the sub-model, wherein the initial tensor set includes multiple initial tensors, and one initial tensor corresponds to a vertex in the sub-model; map the coordinates of each vertex of the sub-model to a voxel grid to obtain the target coordinates of each vertex in the voxel grid; update the initial tensor set based on the target coordinates to obtain an input tensor set; and call a pre-trained voxel transformation model based on the input tensor set to obtain the voxel dataset of the sub-model.
[0413] In some embodiments, the voxel processing module 5553 is further configured to convolve the input tensor set using the spherical convolution kernel of the pre-trained voxel conversion model to obtain candidate features; update the stride and size of the pooling window of the pre-trained voxel conversion model according to the dimension of the candidate features, wherein the dimension of the candidate features is positively correlated with the stride of the pooling window and the dimension of the candidate features is positively correlated with the size of the pooling window; pool the candidate features according to the updated stride and size of the pooling window to obtain target features; and perform feature mapping based on the target features to obtain the voxel dataset of the sub-model.
[0414] In some embodiments, the voxel processing module 5553 is further configured to perform feature fusion on target features at different scales to obtain fused features; upsample the fused features to obtain upsampled features; map each element in the upsampled features to voxel data in three-dimensional space; and concatenate the voxel data corresponding to multiple elements to obtain the voxel dataset of the sub-model.
[0415] In some embodiments, the voxel processing module 5553 is further configured to train a pre-trained voxel conversion model by performing the following processes: acquiring tensor samples and ground truth labels, wherein the ground truth labels represent the ground truth voxel data corresponding to the tensor samples; calling the initialized voxel conversion model based on the tensor samples to obtain predicted labels; determining a loss value based on the ground truth labels and predicted labels; and updating the parameters of the initialized voxel conversion model based on the loss value to obtain the pre-trained voxel conversion model.
[0416] In some embodiments, the voxel combination module 5554 is further configured to construct an initial voxel dataset; for each sub-model, determine the largest voxel data among the following two: the voxel data of each dimension in the voxel dataset corresponding to the sub-model, and the voxel data of the corresponding dimension in the initial voxel dataset; update the voxel data of the corresponding dimension in the initial voxel dataset based on the largest voxel data of each dimension to obtain a target voxel dataset; and combine multiple target voxel datasets into a voxel dataset of the third stereo model.
[0417] In some embodiments, the texture rendering module 5555 is further configured to perform texture mapping on the voxel data in the surface region of the third solid model in the voxel dataset of the third solid model to obtain first texture data; assign texture values to the first texture data to obtain second texture data; and render the texture of the third solid model based on the second texture data.
[0418] In some embodiments, the texture rendering module 5555 is further configured to perform the following processing on each voxel data in the voxel data of the surface region of the third solid model: normalize the coordinates of the voxel data based on the coordinates of the center point of the third solid model and the scaling factor to obtain normalized coordinates; and perform dimensionality reduction mapping on the normalized coordinates to obtain the first texture data.
[0419] In some embodiments, the texture rendering module 5555 is further configured to, for each voxel data in the voxel dataset of the third stereo model, in response to the voxel value of the voxel data being a first preset value and the voxel value of the adjacent voxel data being a second preset value, use the voxel data as the voxel data in the voxel dataset of the third stereo model located in the surface region of the third stereo model.
[0420] In some embodiments, the texture rendering module 5555 is further configured to query the color value of the first texture data in a preset texture image; and assign the color value to the first texture data to obtain the second texture data.
[0421] In some embodiments, the texture rendering module 5555 is further configured to generate texture coordinates corresponding to each vertex in the third solid model; query the second texture data corresponding to each texture coordinate; and apply the second texture data to the corresponding texture coordinates.
[0422] This application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the texture rendering method for a stereoscopic model described above in this application.
[0423] This application provides a computer-readable storage medium storing computer-executable instructions or a computer program. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the texture rendering method for a stereoscopic model provided in this application. For example, ... Figure 3A The texture rendering method of the 3D model is shown.
[0424] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.
[0425] In some embodiments, computer-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 may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.
[0426] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts in a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files that store one or more modules, subroutines, or code sections).
[0427] As an example, computer-executable instructions can be deployed to execute on a single electronic device, or on multiple electronic devices located at one location, or on multiple electronic devices distributed across multiple locations and interconnected via a communication network.
[0428] In summary, through the embodiments of this application, the number of model segments is adjusted according to the actual performance of the device. High-performance devices can perform finer segmentation, while low-performance devices can reduce the number of segmentations to avoid overload. Based on the ratio of the maximum distance to the number of segments to be divided, an arithmetic sequence of slice radii is generated, ensuring the uniformity of slice radii and making the segmented sub-models spatially evenly distributed. Segmenting the model according to slice radii allows the model to adapt to different application requirements. The segmented sub-models can be processed independently to facilitate parallel computing and distributed processing, thereby improving computational efficiency. Different sub-models can correspond to different levels of detail, allowing for hierarchical processing of the model, such as using different levels of detail during rendering. Different computing resources can be allocated according to the complexity of the sub-models to optimize the overall processing flow. By dividing the radial range of the spherical coordinate system into multiple intervals, different parts of the model can be managed and processed more finely. In scenarios where the model is very complex or requires local optimization, it helps to perform localized processing of the model. The geometric dataset within each interval can be processed independently of other intervals to facilitate parallel computing. Multiple processing units can process different geometric datasets simultaneously, thereby accelerating the overall processing speed. Computational resources can be optimized based on the complexity and importance of the geometric dataset for each interval. Important or complex intervals can be allocated more resources to ensure quality and efficiency. During rendering, sub-models located within specific intervals can be selectively rendered based on the viewpoint and clipping plane, which can reduce unnecessary rendering calculations and improve rendering efficiency.
[0429] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.
Claims
1. A texture rendering method for a three-dimensional model, characterized in that, The method includes: The first solid model is transformed from the initial coordinate system to the second solid model in the spherical coordinate system, wherein the initial coordinate system is different from the spherical coordinate system; The second 3D model is divided into multiple sub-models; Voxelization is performed on the multiple sub-models to obtain the corresponding multiple voxel datasets; The multiple voxel datasets are combined into a voxel dataset for the third stereo model; Based on the voxel data of the voxel dataset of the third stereo model located in the surface region of the third stereo model, the texture of the third stereo model is rendered.
2. The method according to claim 1, characterized in that, The step of dividing the second 3D model into multiple sub-models includes: The number of sub-models to be divided is determined based on the computing power parameters of the electronic device, wherein the computing power parameters are positively correlated with the number of sub-models to be divided, and the number of sub-models to be divided represents the number of sub-models to be obtained by segmenting the second 3D model. Based on the maximum distance between the vertices in the second 3D model and the origin of the spherical coordinate system, and the number of segments to be divided, determine multiple slice radii; The second 3D model is divided into multiple sub-models according to the multiple slice radii, wherein different slice radii correspond to different sub-models.
3. The method according to claim 2, characterized in that, The step of determining multiple slice radii based on the maximum distance between vertices in the second solid model and the origin of the spherical coordinate system, and the number of slices to be divided, includes: Determine the ratio of the maximum distance to the number of segments to be divided; Generate an arithmetic sequence with the ratio as the common difference, and use multiple elements in the arithmetic sequence as slice radii, wherein the minimum value of the arithmetic sequence is the ratio, and the maximum value of the arithmetic sequence is the product of the ratio and the number to be divided.
4. The method according to claim 2 or 3, characterized in that, The step of dividing the second 3D model into multiple sub-models based on the multiple slice radii includes: The radial range of the spherical coordinate system is divided into multiple intervals based on the multiple slice radii; Multiple geometric datasets located within the multiple intervals are extracted from the second 3D model, wherein one geometric dataset is extracted from one interval, and the geometric dataset includes multiple spherical coordinates within the interval; The multiple geometric datasets are used as multiple sub-models.
5. The method according to any one of claims 1 to 4, characterized in that, The process of voxelizing the multiple sub-models to obtain multiple voxel datasets includes: For each of the sub-models, the following processing is performed: Obtain the initialization tensor set of the sub-model, wherein the initialization tensor set includes multiple initialization tensors, and each initialization tensor corresponds to a vertex in the sub-model; Map the coordinates of each vertex of the sub-model to a voxel mesh to obtain the target coordinates of each vertex in the voxel mesh; The initial tensor set is updated based on the target coordinates to obtain the input tensor set; Based on the input tensor set, a pre-trained voxel transformation model is invoked to obtain the voxel dataset of the sub-model.
6. The method according to claim 5, characterized in that, The process of calling a pre-trained voxel transformation model based on the input tensor set to obtain the voxel dataset of the sub-model includes: Candidate features are obtained by convolving the input tensor set with the spherical convolution kernel of the pre-trained voxel conversion model; The stride and size of the pooling window of the pre-trained voxel conversion model are updated according to the dimension of the candidate features, wherein the dimension of the candidate features is positively correlated with the stride of the pooling window and the dimension of the candidate features is positively correlated with the size of the pooling window. The candidate features are pooled according to the updated stride and size of the pooling window to obtain the target features; Based on the target features, feature mapping is performed to obtain the voxel dataset of the sub-model.
7. The method according to claim 6, characterized in that, Based on the target features, feature mapping is performed to obtain the voxel dataset of the sub-model, including: The target features at different scales are fused to obtain fused features; The fused features are upsampled to obtain upsampled features; Each element in the upsampled feature is mapped to voxel data in three-dimensional space; The voxel data corresponding to the multiple elements are concatenated to obtain the voxel dataset of the sub-model.
8. The method according to claim 5 or 6, characterized in that, The pre-trained voxel conversion model was obtained by training it in the following manner: Obtain tensor samples and ground truth labels, wherein the ground truth labels represent the ground truth voxel data corresponding to the tensor samples; Based on the tensor samples, the initialized voxel conversion model is invoked to obtain the predicted labels; The loss value is determined based on the true label and the predicted label; The parameters of the initialized voxel conversion model are updated based on the loss value to obtain the pre-trained voxel conversion model.
9. The method according to any one of claims 1 to 8, characterized in that, The multiple voxel datasets are combined into a voxel dataset for the third stereo model, including: Construct the initial voxel dataset; For each sub-model, determine the largest voxel data of the following two: the voxel data of each dimension in the voxel dataset corresponding to the sub-model, and the voxel data of the corresponding dimension in the initial voxel dataset; update the voxel data of the corresponding dimension in the initial voxel dataset based on the largest voxel data of each dimension to obtain the target voxel dataset; The multiple target voxel datasets are combined into a voxel dataset for the third stereo model.
10. The method according to any one of claims 1 to 8, characterized in that, The rendering of the texture of the third stereo model, based on the voxel data in the voxel dataset of the third stereo model and the voxel data of the surface region of the third stereo model, includes: Texture mapping is performed on the voxel data located in the surface region of the third stereo model from the voxel dataset of the third stereo model to obtain the first texture data; The first texture data is assigned a texture value to obtain the second texture data; The texture of the third stereo model is rendered based on the second texture data.
11. The method according to claim 10, characterized in that, Before performing texture mapping on the voxel data located in the surface region of the third stereo model in the voxel dataset of the third stereo model to obtain the first texture data, the method further includes: For each voxel data in the voxel dataset of the third stereo model, in response to the voxel value of the voxel data being a first preset value and the voxel value of the adjacent voxel data being a second preset value, the voxel data is taken as the voxel data located in the surface region of the third stereo model in the voxel dataset of the third stereo model.
12. The method according to claim 10 or 11, characterized in that, The step of performing texture mapping on the voxel data located in the surface region of the third stereo model from the voxel dataset of the third stereo model to obtain the first texture data includes: For each voxel in the voxel data located in the surface region of the third stereo model, the following processing is performed: Based on the coordinates of the center point of the third stereo model and the scaling factor, the coordinates of the voxel data are normalized to obtain normalized coordinates. The normalized coordinates are then subjected to dimensionality reduction mapping to obtain the first texture data.
13. The method according to claim 10 or 11, characterized in that, The step of assigning texture values to the first texture data to obtain the second texture data includes: Query the color value of the first texture data in the preset texture image; The color value is assigned to the first texture data to obtain the second texture data.
14. The method according to claim 10 or 11, characterized in that, The process of rendering the texture of the third stereo model based on the second texture data includes: Generate the texture coordinates corresponding to each vertex in the third 3D model; Query the second texture data corresponding to each of the texture coordinates; Apply the second texture data to the corresponding texture coordinates.
15. The method according to any one of claims 1 to 14, characterized in that, When the coordinate system used by the first solid model is the Cartesian coordinate system, the step of converting the first solid model into a second solid model in the spherical coordinate system includes: Based on the maximum and minimum values of the horizontal coordinates, the maximum and minimum values of the vertical coordinates, and the maximum and minimum values of the vertical coordinates of the vertices in the first solid model, the center point of the first solid model is determined. Based on the center point, the first solid model is translated to the origin of the Cartesian coordinate system to obtain the fourth solid model; The fourth solid model is scaled down to a unit cube to obtain the fifth solid model; The coordinates of each vertex of the fifth solid model are converted to spherical coordinates in a spherical coordinate system. The points corresponding to the spherical coordinates are used as vertices of the second solid model, and the second solid model is constructed based on the vertices of the second solid model.
16. The method according to claim 15, characterized in that, The fourth solid model is scaled down to a unit cube to obtain the fifth solid model, which includes: Determine the bounding box of the first 3D model; The maximum side length of the first 3D model is determined based on the bounding box. The scaling ratio of the fourth solid model is determined based on the maximum side length; The fourth solid model is scaled down to a unit cube according to the scaling ratio to obtain the fifth solid model.
17. A texture rendering device for a three-dimensional model, characterized in that, The device includes: The model conversion module is used to convert the first solid model into a second solid model in a spherical coordinate system, wherein the coordinate system used by the first solid model is different from the spherical coordinate system. The model segmentation module is used to segment the second 3D model into multiple sub-models; A voxel processing module is used to voxelize the multiple sub-models respectively to obtain multiple voxel datasets, wherein one sub-model corresponds to one voxel dataset; A voxel combination module is used to combine the multiple voxel datasets into a voxel dataset for a third stereo model. The texture rendering module is used to render the texture of the third stereo model based on the voxel data in the voxel dataset of the third stereo model located in the surface region of the third stereo model.
18. An electronic device, characterized in that, The electronic device includes: Memory is used to store executable instructions or computer programs. A processor, when executing computer-executable instructions or computer programs stored in the memory, implements the texture rendering method of the stereo model according to any one of claims 1 to 16.
19. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the texture rendering method of the stereoscopic model according to any one of claims 1 to 16.
20. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, the texture rendering method of the stereo model according to any one of claims 1 to 16 is implemented.