Three-dimensional model rendering method, device, equipment and storage medium
By acquiring the material information of the 3D model and rendering it in units of raster, the problem of low efficiency in rendering multiple sub-models with different materials in the 3D model is solved, and efficient 3D model rendering is achieved.
Patent Information
- Application Number
- CN202210291953.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2026-11-20
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In existing technologies, when a 3D model contains sub-models with different materials, multiple pipeline renderings are required, resulting in low rendering efficiency.
By acquiring the material information of each triangular primitive in the 3D model, model parameters are generated, and rendering is performed using a raster as the basic unit, taking into account the influence of different materials to improve rendering efficiency.
It enables one-time rendering of parts with different materials in a 3D model, improving rendering efficiency.
Smart Images

Figure CN116843811B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a three-dimensional model rendering method, apparatus, device and storage medium. Background Technology
[0002] Currently, pipeline rendering can render 3D models into 2D images.
[0003] In related technologies, since a 3D model contains sub-models with different materials, when rendering the model, each sub-model is rendered using a different rendering pipeline, and then the rendering results of each sub-model are stitched together to form a 2D image corresponding to the 3D model.
[0004] However, in the aforementioned related technologies, a single pipeline rendering can only render a sub-model of a single material. When the 3D model includes sub-models of different materials, multiple pipeline renderings are required to complete the rendering of the 3D model, resulting in low rendering efficiency. Summary of the Invention
[0005] This application provides a method, apparatus, device, and storage medium for rendering three-dimensional models, which can improve the rendering efficiency of three-dimensional models. The technical solution is as follows.
[0006] According to one aspect of the embodiments of this application, a three-dimensional model rendering method is provided, the method comprising the following steps:
[0007] Obtain the material information of each triangular primitive in the 3D model, where at least two of the triangular primitives have different material information;
[0008] Based on the material information of the triangular primitives, model parameters of the 3D model are generated; wherein, the model parameters include the rendering parameters of each grid in the 3D model;
[0009] Using the grid as the basic unit, the three-dimensional model is rendered based on the rendering parameters of each grid to generate a two-dimensional image of the three-dimensional model.
[0010] According to one aspect of the embodiments of this application, a three-dimensional model rendering apparatus is provided, the apparatus comprising the following modules:
[0011] The material acquisition module is used to acquire the material information of each triangular primitive in the 3D model, and at least two of the triangular primitives have different material information.
[0012] The parameter generation module is used to generate model parameters of the three-dimensional model based on the material information of the triangular primitives; wherein, the model parameters include the rendering parameters of each grid in the three-dimensional model;
[0013] The image rendering module is used to render the three-dimensional model based on the rendering parameters of each of the grids, using the grids as the basic unit, to generate a two-dimensional image of the three-dimensional model.
[0014] According to one aspect of the embodiments of this application, the present application provides a computer device, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the above-described three-dimensional model rendering method, or to implement the above-described response text generation model training method.
[0015] According to one aspect of the embodiments of this application, the embodiments of this application provide a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the above-described three-dimensional model rendering method, or to implement the above-described training method for the response text generation model.
[0016] According to one aspect of the embodiments of this application, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned three-dimensional model rendering method or implement the aforementioned training method for the response text generation model.
[0017] The technical solution provided in this application can bring the following beneficial effects:
[0018] The 3D model is rendered using rendering parameters for each grid, which are obtained based on the material information of the triangle primitives. In other words, the rendering process is performed on a grid-by-grid basis, taking into account the impact of different materials on the rendering process. Material information is used as part of the generation basis for rendering parameters, so that parts of the 3D model containing different materials can be rendered at once, thus improving the rendering efficiency of the 3D model. Attached Figure Description
[0019] Figure 1 This is a schematic diagram of a three-dimensional model rendering system provided in one embodiment of this application;
[0020] Figure 2 An exemplary schematic diagram of a 3D model rendering system is shown;
[0021] Figure 3This is a flowchart of a three-dimensional model rendering method provided in one embodiment of this application;
[0022] Figure 4 An exemplary schematic diagram of a texture sampling method is shown;
[0023] Figure 5 This is a flowchart of a three-dimensional model rendering method provided in another embodiment of this application;
[0024] Figure 6 An exemplary diagram illustrating the effect of iterative training of a rendering model is shown.
[0025] Figure 7 This is a block diagram of a three-dimensional model rendering apparatus provided in one embodiment of this application;
[0026] Figure 8 This is a structural block diagram of a computer device provided in one embodiment of this application. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0028] Please refer to Figure 1 This diagram illustrates a model rendering system provided in one embodiment of the present application. The model rendering system may include a terminal 10 and a server 20.
[0029] Terminal 10 can be an electronic device such as a mobile phone, tablet computer, game console, e-book reader, multimedia playback device, wearable device, PC (Personal Computer), intelligent voice interaction device, smart home appliance, vehicle terminal, and aircraft, etc., and this application embodiment is not limited thereto. Optionally, terminal 10 includes an application client. This application can be any application with model rendering capabilities, such as a modeling application, game application, video application, etc. Optionally, the above application can be an application that requires downloading and installation, or it can be an application that can be used instantly; this application embodiment is not limited thereto.
[0030] Server 20 provides background services to terminal 10. Server 20 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center. Optionally, server 20 can be a background server for the client of the aforementioned application. In an exemplary embodiment, server 20 provides background services to multiple terminals 10.
[0031] The terminal 10 and the server 20 transmit data via a network.
[0032] Optionally, in this embodiment, the server 20 is used to render the three-dimensional model provided by the terminal 10 to generate a two-dimensional image. For example, as shown... Figure 2 As shown, the user constructs a 3D model through terminal 10 and configures corresponding parameters for the 3D model. These configuration parameters include attribute parameters and processing parameters for the 3D model. The attribute parameters indicate the 3D model's properties, such as material data, color data, depth data, texture data, and vertex data. The processing parameters indicate the processing method for the 3D model during rendering, such as the shader configuration data used during rendering. Then, after obtaining the aforementioned 3D model and its configuration parameters, server 20 renders the 3D model based on these configuration parameters. Figure 2 As shown, server 20 performs spatial transformation processing on the vertex data in the configuration parameters, converting the vertex data from model space to world space, and then from world space to clip space. Subsequently, it performs primitive assembly and rasterization on the spatially transformed vertex data to obtain the triangular primitives of the 3D model, as well as the multiple grids included in the triangular primitives. Then, server 20 performs interpolation processing on each grid, inserting the material index tensor (material parameters and configuration parameters) into each grid, and inserting color data, depth data, and texture data into each grid to generate rendering parameters for each grid. Further, server 20 renders based on the rendering parameters of each grid, using the grid as the basic unit, to generate an initial image of the 3D model, and corrects this initial image to generate a 2D image of the 3D model, such as tone mapping, gamma correction, and anti-aliasing correction. Optionally, after obtaining the above 2D image, terminal 10 displays the 2D image to the user.
[0033] One point that needs to be clarified is that the above Figure 2 The description is merely exemplary and explanatory. In exemplary embodiments, the functions of terminal 10 and server 20 can be flexibly set and adjusted, and the embodiments of this application do not limit this; exemplary, terminal 10 through the above Figure 2 The process described above is used for image rendering, and server 20 only provides data storage services for terminal 10.
[0034] Please refer to Figure 3 The diagram illustrates a flowchart of a three-dimensional model rendering method provided in one embodiment of this application. This method can be applied to... Figure 1The server 20 and / or terminal 10 of the model rendering system shown can be clients of applications in the server 20 and / or terminal 10 (hereinafter collectively referred to as "computer devices"), where the execution entity for each step may be a client of an application in the server 20 and / or terminal 10. The method may include at least one of the following steps (301-303):
[0035] Step 301: Obtain the material information of each triangular primitive in the 3D model.
[0036] Optionally, in this embodiment, the aforementioned three-dimensional model refers to a model composed of multiple sub-models. For example, if the three-dimensional model is a virtual object model, the sub-models corresponding to the three-dimensional model may include: a face model, a torso model, a clothing model, etc.
[0037] A triangle primitive refers to the smallest unit of a 3D model. In this embodiment, the computer device obtains the material information of each triangle primitive in the 3D model before rendering it. It should be noted that, in this embodiment, since different sub-models may have different materials, at least two triangle primitives may have different material information.
[0038] Optionally, the aforementioned material information is obtained through the configuration parameters of the 3D model, which are the parameters configured when the 3D model is created.
[0039] In one possible implementation, the configuration parameters are configured on a sub-model basis. Optionally, when the computer device obtains the material information of a triangle primitive, it obtains the configuration parameters of the sub-model to which the triangle primitive belongs, and then obtains the material information of the triangle primitive from the configuration parameters.
[0040] In another possible implementation, the configuration parameters are configured on a per-triangle basis. Optionally, when obtaining the material information of a triangle, the computer device directly obtains the material information of the triangle based on its configuration parameters.
[0041] Optionally, in this embodiment, the configuration parameters further include processing parameters. These processing parameters indicate the processing method for the 3D model during rendering, such as the shader configuration data used during rendering.
[0042] Step 302: Generate model parameters for the 3D model based on the material information of the triangular primitives.
[0043] In this embodiment of the application, after obtaining the material information of the aforementioned triangular primitives, the computer device generates model parameters for the three-dimensional model based on the material information of the triangular primitives. These model parameters include the rendering parameters of each grid cell in the three-dimensional model.
[0044] The aforementioned grid refers to the minimum rendering range of the 3D model. Optionally, a triangular primitive includes multiple grids. Optionally, after acquiring the aforementioned triangular primitive, the computer device determines the grids contained in the triangular primitive, and then generates rendering parameters for each grid in the triangular primitive based on the material information of the triangular primitive.
[0045] Optionally, the rendering parameters of the aforementioned raster include first rendering parameters and second rendering parameters. For the same triangular primitive, the first rendering parameters refer to the general rendering parameters for all rasters, while the second rendering parameters refer to the non-general rendering parameters for all rasters. For example, the first rendering parameters include material parameters, processing parameters, etc., and the second rendering parameters include color parameters, texture parameters, depth parameters, etc. Optionally, in this embodiment, when the computer device obtains the rendering parameters of the raster, it determines the first rendering parameters of the raster based on the configuration parameters of the triangular primitive, and determines the second rendering parameters of the non-vertex rasters based on the positional relationship between vertex rasters and non-vertex rasters in the triangular primitive, according to the second rendering parameters of the vertex rasters. Optionally, the aforementioned second rendering parameters may also be referred to as "other rendering parameters".
[0046] Step 303: Using a grid as the basic unit, render the 3D model based on the rendering parameters of each grid to generate a 2D image of the 3D model.
[0047] In this embodiment of the application, after obtaining the above-mentioned model parameters, the computer device renders the three-dimensional model based on the rendering parameters of each grid, using the grid as the basic unit, to generate a two-dimensional image of the three-dimensional model.
[0048] In an exemplary embodiment, step 303 above includes at least one of the following steps:
[0049] 1. Using a raster as the basic unit, render the 3D model based on the rendering parameters of each raster to generate the initial image of the 3D model;
[0050] In this embodiment of the application, after obtaining the above-mentioned model parameters, the computer device renders the model based on the rendering parameters of the grid, using the grid as the basic unit, to obtain the rendering result of the grid, and then the initial image of the three-dimensional model is composed of the rendering results of multiple grids.
[0051] Optionally, the rendering parameters mentioned above include, but are not limited to, at least one of the following: material parameters, color parameters, depth parameters, and texture parameters. Optionally, during rendering, the raster is rendered using the material parameters in the raster's rendering data; the raster is rendered using the color parameters in the raster's rendering data; the raster is rendered using the depth parameters in the raster's rendering data; and the raster is rendered using the texture parameters in the raster's rendering data. For example, such as... Figure 4 As shown, during texture rendering, the texture map corresponding to the raster is sampled from the texture map 41 based on the texture parameters for rendering.
[0052] Optionally, in the embodiments of this application, when rendering with a grid as the basic unit, the rendering can be performed row by row or column by column according to the grid order, or the central part can be rendered first and then the edge part. The embodiments of this application do not limit this.
[0053] 2. Correct the initial image of the 3D model to generate a 2D image of the 3D model.
[0054] In this embodiment of the application, after acquiring the initial image, the computer device corrects the initial image to improve the rendering effect of the two-dimensional image, thereby generating a two-dimensional image of the three-dimensional model. Exemplarily, the correction methods for the initial image include, but are not limited to, at least one of the following: tone mapping, gamma correction, and anti-aliasing correction.
[0055] In summary, the technical solution provided in this application renders the 3D model using the rendering parameters of each grid, and the rendering parameters of the grid are obtained based on the material information of the triangle primitives. That is, during the rendering process, rendering is performed on a grid-by-grid basis, taking into account the influence of different materials on the rendering process, and using material information as part of the generation basis for rendering parameters, so that the parts of the 3D model containing different materials can be rendered at once, thereby improving the rendering efficiency of the 3D model.
[0056] Below, taking the aforementioned first rendering parameter, including the material parameter, as an example, we will introduce how to obtain the rendering parameters.
[0057] In an exemplary embodiment, step 302 above includes at least one of the following steps:
[0058] 1. Perform rasterization on the 3D model to obtain at least one grid in the 3D model, as well as the centroid coordinate system of each triangular primitive in the 3D model.
[0059] In this embodiment of the application, before obtaining the above-mentioned rendering parameters, the computer device performs rasterization processing on the three-dimensional model to obtain at least one grid in the three-dimensional model and the centroid coordinate system of each triangular primitive in the three-dimensional model.
[0060] Optionally, when performing rasterization on a 3D model, the computer device acquires the first vertex data of the 3D model, performs a first spatial transformation on the first vertex data to obtain second vertex data, then performs a second spatial transformation on the second vertex data to obtain third vertex data. Next, depth information is removed from the third vertex data to obtain fourth vertex data. Based on the fourth vertex data, the contour image of the 3D model in screen space is determined, and the contour image is rasterized to obtain at least one grid in the 3D model. The first vertex data indicates the vertex information of the 3D model in the model coordinate system, the second vertex data indicates the vertex information of the 3D model in the world coordinate system, the third vertex data indicates the vertex information of the 3D model in the clipping coordinate system, and the fourth vertex data indicates the vertex information of the 3D model in the screen coordinate system.
[0061] It should be noted that, in this embodiment of the application, since the above-mentioned three-dimensional model is composed of multiple sub-models, when obtaining the above-mentioned first vertex data, the computer device obtains multiple sub-models of the three-dimensional model, and then merges the vertex data of the multiple sub-models to obtain the first vertex data of the three-dimensional model.
[0062] It should also be noted that when multiple sub-models are merged to generate a 3D model, the merging of skeletal data and skin data is also included.
[0063] 2. Based on the position of the grid and the position of the triangle primitive, insert material information into the grid to generate the grid's material parameters.
[0064] In this embodiment of the application, after acquiring the grid, the computer device inserts material information into the grid based on the grid position and the position of the triangle primitives to generate the grid's material parameters.
[0065] Optionally, during interpolation, the computer device determines the triangular primitive to which the grid belongs, and then inserts the material information of the triangular primitive into the grid to generate the grid's material parameters.
[0066] 3. Based on the centroid coordinate system of the triangle primitive and other rendering parameters of the vertex raster of the triangle primitive, generate other rendering parameters for the non-vertex raster.
[0067] In this embodiment of the application, after obtaining the aforementioned centroid coordinate system, the computer device generates other rendering parameters for the non-vertex raster based on the centroid coordinate system of the triangle primitive and other rendering parameters of the vertex raster of the triangle primitive. These other rendering parameters are the aforementioned second rendering parameters.
[0068] Optionally, in this embodiment, the computer device acquires other rendering parameters of the vertex grid of the triangular primitive, and then determines the transformation function of the triangular primitive based on the positional relationship of the vertex grid in the barycentric coordinate system. Then, based on the positional relationship between the non-vertex grid and the vertex grid, the transformation function is used to process the other rendering parameters of the vertex grid to generate other rendering parameters of the non-vertex grid. The aforementioned transformation function is used to indicate the variation pattern of other rendering parameters in different grids; optionally, the transformation function is a linear transformation function.
[0069] It should be noted that, in this embodiment, the rendering parameters of the raster include the raster's material parameters and other rendering parameters. For example, these other rendering parameters include, but are not limited to, at least one of the following: color parameters, depth parameters, and texture parameters.
[0070] In summary, the technical solution provided in this application generates material parameters for the raster by inserting material information of a triangle image into the raster. In the subsequent rendering process, the material of the raster can be rendered based on these material parameters. That is, in the rendering process of the 3D model, different materials can be rendered through raster rendering, thereby improving rendering efficiency.
[0071] Optionally, in this embodiment, the two-dimensional image of the aforementioned three-dimensional model can also be used in the training process of the rendering model. Please refer to... Figure 5 It illustrates a flowchart of a three-dimensional model rendering method provided in another embodiment of this application. This method can be applied to... Figure 1 The server 20 and / or terminal 10 of the model rendering system shown can be clients of applications in the server 20 and / or terminal 10 (hereinafter collectively referred to as "computer devices"), where the execution entity for each step may be a client of an application in the server 20 and / or terminal 10. The method may include at least one of the following steps (501-505):
[0072] Step 501: Obtain the material information of each triangular primitive in the 3D model.
[0073] Step 502: Generate model parameters for the 3D model based on the material information of the triangular primitives.
[0074] Step 503: Using a grid as the basic unit, render the 3D model based on the rendering parameters of each grid to generate a 2D image of the 3D model.
[0075] Steps 501-503 above and Figure 3 Steps 301-303 in the embodiment are the same; see details below. Figure 3 Examples are not described in detail here.
[0076] Step 504: Using the configuration parameters of the 3D model, the output image of the rendering model is obtained.
[0077] In this embodiment, a rendering model is used to obtain the output image of the rendering model based on the configuration parameters of the 3D model. The rendering model is a deep learning model.
[0078] Optionally, the above configuration parameters include attribute parameters and processing parameters of the 3D model. The attribute parameters are used to indicate the attributes of the 3D model, such as material data, color data, depth data, texture data, and vertex data.
[0079] Step 505: Train the rendering model based on the output image and the two-dimensional image.
[0080] In this embodiment of the application, after acquiring the output image, the computer device uses the two-dimensional image as the label image and trains the rendering model based on the output image and the two-dimensional image.
[0081] Optionally, during the training process of the training model, the computer device extracts the model data of the output image from the output image, obtains the model data of the two-dimensional image from the two-dimensional image, and then determines the loss of the rendering model based on the model data of the output image and the model data of the two-dimensional image, and adjusts the parameters of the rendering model according to the loss.
[0082] Additionally, see the reference image. Figure 6 During the training process, the rendering model is trained through multiple iterations of reverse rendering.
[0083] In summary, the technical solution provided in this application embodiment trains the rendering model using two-dimensional images, enabling the trained rendering model to render two-dimensional images using the configuration parameters of the three-dimensional model, thereby improving image rendering efficiency.
[0084] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0085] Please refer to Figure 7This diagram illustrates a block diagram of a three-dimensional model rendering apparatus according to an embodiment of this application. The apparatus has the function of implementing the aforementioned three-dimensional model rendering method; this function can be implemented in hardware or by hardware executing corresponding software. The apparatus can be a computer device or can be installed within a computer device. The apparatus 700 may include:
[0086] The material acquisition module 710 is used to acquire the material information of each triangular primitive in the 3D model, wherein at least two of the triangular primitives have different material information.
[0087] The parameter generation module 720 is used to generate model parameters of the three-dimensional model based on the material information of the triangular primitives; wherein, the model parameters include the rendering parameters of each grid in the three-dimensional model;
[0088] The image rendering module 730 is used to render the three-dimensional model based on the rendering parameters of each of the grids, using the grids as the basic units, to generate a two-dimensional image of the three-dimensional model.
[0089] In an exemplary embodiment, the parameter generation module 720 is used to:
[0090] The three-dimensional model is rasterized to obtain at least one grid in the three-dimensional model and the centroid coordinate system of each triangular primitive in the three-dimensional model.
[0091] Based on the position of the grid and the position of the triangle primitive, material information is inserted into the grid to generate the material parameters of the grid;
[0092] Based on the centroid coordinate system of the triangular primitive and other rendering parameters of the vertex raster of the triangular primitive, other rendering parameters of the non-vertex raster are generated.
[0093] The rendering parameters of the raster include the material parameters of the raster and other rendering parameters of the raster.
[0094] In an exemplary embodiment, the parameter generation module 720 is used to:
[0095] Based on the positional relationship of the vertex grids of the triangular primitive in the centroid coordinate system, the variation function of the triangular primitive is determined; wherein, the variation function is used to indicate the variation pattern of other rendering parameters in different grids;
[0096] Based on the positional relationship between the non-vertex grid and the vertex grid, the transformation function is used to process other rendering parameters of the vertex grid to generate other rendering parameters of the non-vertex grid.
[0097] In an exemplary embodiment, the other rendering parameters include at least one of the following: color parameters, depth parameters, and texture parameters.
[0098] In an exemplary embodiment, the parameter generation module 720 is used to:
[0099] Obtain the first vertex data of the three-dimensional model, wherein the first vertex data is used to indicate the vertex information of the three-dimensional model in the model coordinate system;
[0100] The first vertex data is subjected to a first spatial transformation to obtain second vertex data, which is used to indicate the vertex information of the three-dimensional model in the world coordinate system.
[0101] The second vertex data is subjected to a second spatial transformation to obtain the third vertex data, which is used to indicate the vertex information of the three-dimensional model in the clipping coordinate system;
[0102] Depth information is removed from the third vertex data to obtain the fourth vertex data, which is used to indicate the vertex information of the three-dimensional model in the screen coordinate system.
[0103] Based on the fourth vertex data, the contour image of the three-dimensional model in screen space is determined;
[0104] The contour image is rasterized to obtain at least one grid in the three-dimensional model.
[0105] In an exemplary embodiment, the parameter generation module 720 is used to:
[0106] Obtain multiple sub-models of the 3D model;
[0107] The vertex data of the multiple sub-models are merged to obtain the first vertex data of the three-dimensional model.
[0108] In an exemplary embodiment, the image rendering module 730 is configured to:
[0109] Using the grid as the basic unit, the three-dimensional model is rendered based on the rendering parameters of each grid to generate an initial image of the three-dimensional model;
[0110] The initial image of the three-dimensional model is corrected to generate a two-dimensional image of the three-dimensional model.
[0111] In an exemplary embodiment, the image rendering module 730 is configured to:
[0112] Based on the material parameters in the rendering data of the raster, perform material rendering on the raster;
[0113] The grid is rendered with color based on the color parameters in the grid's rendering data;
[0114] Based on the depth parameters in the rendering data of the raster, the raster is rendered with depth.
[0115] The raster is texture rendered based on the texture parameters in the raster's rendering data.
[0116] In an exemplary embodiment, the device 700 is used for:
[0117] The output image of the rendering model is obtained by using the configuration parameters of the 3D model.
[0118] The rendering model is trained based on the output image and the two-dimensional image.
[0119] In an exemplary embodiment, the device 700 is used for:
[0120] Extract the model data of the output image from the output image;
[0121] Obtain the model data of the two-dimensional image;
[0122] Based on the model data of the output image and the model data of the two-dimensional image, the loss of the rendering model is determined;
[0123] The parameters of the rendering model are adjusted based on the loss.
[0124] In summary, the technical solution provided in this application renders the 3D model using the rendering parameters of each grid, and the rendering parameters of the grid are obtained based on the material information of the triangle primitives. That is, during the rendering process, rendering is performed on a grid-by-grid basis, taking into account the influence of different materials on the rendering process, and using material information as part of the generation basis for rendering parameters, so that the parts of the 3D model containing different materials can be rendered at once, thereby improving the rendering efficiency of the 3D model.
[0125] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above functional modules when implementing its functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0126] Please refer to Figure 8This diagram illustrates the structural block diagram of a computer device provided in one embodiment of this application. This computer device can be used to implement the functions of the aforementioned 3D model rendering method or the training method for a response text generation model. Specifically:
[0127] Computer device 800 includes a central processing unit (CPU) 801, a system memory 804 including random access memory (RAM) 802 and read-only memory (ROM) 803, and a system bus 805 connecting the system memory 804 and the CPU 801. Computer device 800 also includes a basic input / output system (I / O system) 806 that facilitates information transfer between various devices within the computer, and a mass storage device 807 for storing the operating system 813, application programs 814, and other program modules 815.
[0128] The basic input / output system 806 includes a display 808 for displaying information and an input device 809 for user input, such as a mouse or keyboard. Both the display 808 and the input device 809 are connected to the central processing unit 801 via an input / output controller 810 connected to the system bus 805. The basic input / output system 806 may also include the input / output controller 810 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 810 also provides output to a display screen, printer, or other types of output devices.
[0129] Mass storage device 807 is connected to central processing unit 801 via a mass storage controller (not shown) connected to system bus 805. Mass storage device 807 and its associated computer-readable media provide non-volatile storage for computer device 800. That is, mass storage device 807 may include computer-readable media (not shown) such as hard disk or CD-ROM (CompactDisc Read-Only Memory) drive.
[0130] Without loss of generality, computer-readable media can include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage devices, CD-ROM, DVD (Digital Video Disc) or other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 804 and mass storage device 807 described above can be collectively referred to as memory.
[0131] According to various embodiments of this application, the computer device 800 can also be connected to a remote computer on a network, such as the Internet, for operation. That is, the computer device 800 can be connected to a network 812 via a network interface unit 811 connected to the system bus 805, or the network interface unit 811 can be used to connect to other types of networks or remote computer systems (not shown).
[0132] The memory also includes a computer program stored in the memory and configured to be executed by one or more processors to implement the above-described three-dimensional model rendering method.
[0133] In an exemplary embodiment, a computer-readable storage medium is also provided, the storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set, when executed by a processor, implements the above-described three-dimensional model rendering method.
[0134] Optionally, the computer-readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or optical disc, etc. The random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0135] In an exemplary embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the described three-dimensional model rendering method or the described response text generation model training method.
[0136] It should be understood that "multiple" as used herein refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. Furthermore, the step numbers described herein are merely illustrative of one possible execution order. In some other embodiments, the steps may not be executed in numerical order, such as two steps with different numbers being executed simultaneously, or two steps with different numbers being executed in the reverse order of the illustration. This application does not limit this.
[0137] The above description is merely an exemplary embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for rendering a three-dimensional model, characterized in that, The method includes: Obtain the material information of each triangular primitive in the 3D model, where at least two of the triangular primitives have different material information; The three-dimensional model is rasterized to obtain at least one grid in the three-dimensional model and the centroid coordinate system of each triangular primitive in the three-dimensional model. Based on the position of the grid and the position of the triangle primitive, material information is inserted into the grid to generate the material parameters of the grid; Based on the centroid coordinate system of the triangular primitive and other rendering parameters of the vertex raster of the triangular primitive, other rendering parameters of the non-vertex raster are generated. Using the grid as the basic unit, the three-dimensional model is rendered based on the rendering parameters of each grid to generate a two-dimensional image of the three-dimensional model; wherein, the rendering parameters of the grid include the material parameters of the grid and other rendering parameters of the grid.
2. The method according to claim 1, characterized in that, The other rendering parameters for generating the non-vertex raster based on the centroid coordinate system of the triangular primitive and other rendering parameters of the vertex raster of the triangular primitive include: Based on the positional relationship of the vertex grids of the triangular primitive in the centroid coordinate system, the variation function of the triangular primitive is determined; wherein, the variation function is used to indicate the variation pattern of other rendering parameters in different grids; Based on the positional relationship between the non-vertex grid and the vertex grid, the transformation function is used to process other rendering parameters of the vertex grid to generate other rendering parameters of the non-vertex grid.
3. The method according to claim 1, characterized in that, The other rendering parameters include at least one of the following: color parameters, depth parameters, and texture parameters.
4. The method according to claim 1, characterized in that, The step of rasterizing the 3D model to obtain at least one raster in the 3D model includes: Obtain the first vertex data of the three-dimensional model, wherein the first vertex data is used to indicate the vertex information of the three-dimensional model in the model coordinate system; The first vertex data is subjected to a first spatial transformation to obtain second vertex data, which is used to indicate the vertex information of the three-dimensional model in the world coordinate system. The second vertex data is subjected to a second spatial transformation to obtain the third vertex data, which is used to indicate the vertex information of the three-dimensional model in the clipping coordinate system; Depth information is removed from the third vertex data to obtain the fourth vertex data, which is used to indicate the vertex information of the three-dimensional model in the screen coordinate system. Based on the fourth vertex data, the contour image of the three-dimensional model in screen space is determined; The contour image is rasterized to obtain at least one grid in the three-dimensional model.
5. The method according to claim 4, characterized in that, The process of obtaining the first vertex data of the 3D model includes: Obtain multiple sub-models of the 3D model; The vertex data of the multiple sub-models are merged to obtain the first vertex data of the three-dimensional model.
6. The method according to claim 1, characterized in that, The rendering of the 3D model, using the grid as the basic unit and based on the rendering parameters of each grid, includes: Using the grid as the basic unit, the three-dimensional model is rendered based on the rendering parameters of each grid to generate an initial image of the three-dimensional model; The initial image of the three-dimensional model is corrected to generate a two-dimensional image of the three-dimensional model.
7. The method according to claim 6, characterized in that, The step of rendering the 3D model based on the rendering parameters of each of the grids, using the grid as the basic unit, to generate an initial image of the 3D model includes: Based on the material parameters in the rendering data of the raster, perform material rendering on the raster; The grid is rendered with color based on the color parameters in the grid's rendering data; Based on the depth parameters in the rendering data of the raster, the raster is rendered with depth. The raster is texture rendered based on the texture parameters in the raster's rendering data.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: The output image of the rendering model is obtained by using the configuration parameters of the 3D model. The rendering model is trained based on the output image and the two-dimensional image.
9. The method according to claim 8, characterized in that, The step of training the rendering model based on the output image and the two-dimensional image includes: Extract the model data of the output image from the output image; Obtain the model data of the two-dimensional image; Based on the model data of the output image and the model data of the two-dimensional image, the loss of the rendering model is determined; The parameters of the rendering model are adjusted based on the loss.
10. A three-dimensional model rendering device, characterized in that, The device includes: The material acquisition module is used to acquire the material information of each triangular primitive in the 3D model, and at least two of the triangular primitives have different material information. The parameter generation module is used to perform rasterization processing on the three-dimensional model to obtain at least one grid in the three-dimensional model and the centroid coordinate system of each triangular primitive in the three-dimensional model. The parameter generation module is also used to insert material information into the grid based on the position of the grid and the position of the triangle primitive, and generate the material parameters of the grid. The parameter generation module is also used to generate other rendering parameters for non-vertex grids based on the centroid coordinate system of the triangular primitive and other rendering parameters of the vertex grid of the triangular primitive. The image rendering module is used to render the three-dimensional model based on the rendering parameters of each grid, using the grid as the basic unit, to generate a two-dimensional image of the three-dimensional model; wherein, the rendering parameters of the grid include the material parameters of the grid and other rendering parameters of the grid.
11. The apparatus according to claim 10, characterized in that, The parameter generation module is also used for: Based on the positional relationship of the vertex grids of the triangular primitive in the centroid coordinate system, the variation function of the triangular primitive is determined; wherein, the variation function is used to indicate the variation pattern of other rendering parameters in different grids; Based on the positional relationship between the non-vertex grid and the vertex grid, the transformation function is used to process other rendering parameters of the vertex grid to generate other rendering parameters of the non-vertex grid.
12. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one program, which is loaded and executed by the processor to implement the three-dimensional model rendering method as described in any one of claims 1 to 9.
13. A computer-readable storage medium, characterized in that, The storage medium stores at least one program segment, which is loaded and executed by a processor to implement the three-dimensional model rendering method as described in any one of claims 1 to 9.
14. A computer program product, characterized in that, The computer program product includes computer instructions that are loaded and executed by a processor to implement the three-dimensional model rendering method as described in any one of claims 1 to 9.
Citation Information
Patent Citations
Method and system for implementing clamped z value interpolation in a raster stage of a graphics pipeline
US8432394B1
Systems and methods for generating splat-based differentiable two-dimensional renderings
WO2022046113A1
