3D material rendering method, device, equipment and storage medium
By generating high-precision 3D renderings through generative adversarial neural networks, the accuracy and efficiency issues of rendering complex models in traditional rendering methods are solved, and efficient 3D material rendering is achieved.
Patent Information
- Application Number
- CN202210178211.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-25
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-02-25
AI Technical Summary
Traditional rendering methods have difficulty rendering complex models in real-time and have poor accuracy, while offline rendering takes too long and cannot efficiently generate high-quality 3D materials.
A generative adversarial neural network is used to obtain the original information of the 3D material to generate an intermediate rendering image, which is then input into the generator of the generative adversarial neural network to generate a high-precision 3D rendering image.
The accuracy of rendering effects is improved and the amount of calculation is reduced, thereby improving the rendering efficiency of 3D materials.
Smart Images

Figure CN114549722B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of image rendering technology, and more particularly to a method, apparatus, device, and storage medium for rendering 3D materials. Background Art
[0002] Traditional rendering methods are mainly divided into real-time rendering and offline rendering. Real-time rendering is generally used in games, video props, and other areas that emphasize interactivity, while offline rendering is generally used in fields such as film and television and CG that require high-quality images.
[0003] Real-time rendering is limited by performance, making it difficult to render complex models and materials, and the rendering accuracy is poor. In contrast, offline rendering can render very realistic and complex effects through ray tracing, but it consumes a lot of time. Summary of the Invention
[0004] The embodiments of the present disclosure provide a 3D material rendering method, apparatus, device, and storage medium, which can not only improve the accuracy of the rendering effect, but also reduce the amount of rendering calculations, thereby improving the rendering efficiency of the 3D material.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for rendering 3D material, including:
[0006] Obtaining first original 3D information of the 3D material to be rendered;
[0007] generating an intermediate rendering image according to the first original 3D information;
[0008] The intermediate rendering image is input into a generator set to generate a generative adversarial neural network to obtain a 3D rendering image.
[0009] In a second aspect, an embodiment of the present disclosure further provides a 3D material rendering device, including:
[0010] First original 3D information acquisition information, used to acquire first original 3D information of a 3D material to be rendered;
[0011] an intermediate rendering image generating module, configured to generate an intermediate rendering image according to the first original 3D information;
[0012] The 3D rendering image acquisition module is used to input the intermediate rendering image into a generator set to generate an adversarial neural network to obtain a 3D rendering image.
[0013] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0014] one or more processing devices;
[0015] a storage device for storing one or more programs;
[0016] When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the 3D material rendering method as described in the embodiment of the present disclosure.
[0017] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the method for rendering 3D materials as described in the embodiment of the present disclosure.
[0018] The embodiments of the present disclosure disclose a rendering method, apparatus, device and storage medium for 3D materials. The first original 3D information of the 3D material to be rendered is obtained; an intermediate rendering image is generated based on the first original 3D information; the intermediate rendering image is input into a generator that is set to generate a generative adversarial neural network to obtain a 3D rendering image. The rendering method of 3D materials provided by the embodiments of the present disclosure inputs the intermediate rendering image generated by the first original 3D information into a generator that is set to generate a generative adversarial neural network to obtain a final rendering image, which can not only improve the accuracy of the rendering effect, but also reduce the amount of rendering calculations, thereby improving the rendering efficiency of the 3D material. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1 is a flowchart of a method for rendering 3D material in an embodiment of the present disclosure;
[0020] Figure 2 is a schematic diagram of a grid structure of a generator in an embodiment of the present disclosure;
[0021] Figure 3 is an example diagram of a training setting generative adversarial neural network in an embodiment of the present disclosure;
[0022] Figure 4 It is a structural diagram of a 3D material rendering device in an embodiment of the present disclosure;
[0023] Figure 5 It is a structural diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0024] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0025] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0026] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0027] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0028] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0029] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0030] Figure 1 This is a flowchart of a method for rendering 3D material provided in an embodiment of the present disclosure. This embodiment is applicable to the situation where a 3D rendering image is generated based on 3D material. The method can be executed by a rendering device for 3D material. The device can be composed of hardware and / or software and can generally be integrated into a device with a 3D material rendering function, which can be an electronic device such as a server, mobile terminal or server cluster.
[0031] like Figure 1 As shown, the method specifically includes the following steps:
[0032] S110: Obtain first original 3D information of a 3D material to be rendered.
[0033] The 3D material can be any 3D object material to be rendered, such as 3D characters, 3D animals, and 3D plants in a 3D movie or 3D game. In this embodiment, when producing a 3D image, a technician needs to build a 3D object material model to obtain the first original 3D information of the 3D material to be rendered.
[0034] The first original 3D information may include: vertex coordinates, normal information, camera parameters, surface tiling map and / or lighting parameters.
[0035] Among them, vertex coordinates can be the three-dimensional coordinates of the points on the surface of the 3D material. Normal information can be the normal vector corresponding to each vertex. Camera parameters include camera intrinsic parameters and camera extrinsic parameters. Camera intrinsic parameters include information such as focal length, and camera extrinsic parameters include camera position information and camera attitude information. Surface tile maps can be understood as UV maps. Lighting parameters can be light source parameters, including: light source position, light intensity, i.e., light color, and other information; or lighting parameters can be represented by vectors of set dimensions.
[0036] S120: Generate an intermediate rendering image according to the first original 3D information.
[0037] Among them, the intermediate rendering image can be understood as a 3D image with lower accuracy than the final 3D rendering image, which can be a rasterized image. Its function is to set the generative adversarial neural network to learn to generate a 3D rendering image with higher accuracy. It can include at least one of the following: a white film map, a normal map, a depth map or a coarse hair map.
[0038] Specifically, the intermediate rendering image may be generated based on the first original 3D information by: generating the intermediate rendering image based on at least one item in the first original 3D information. In this embodiment, the generation of the intermediate rendering image may be implemented using an existing open-source algorithm, which is not limited herein. In this embodiment, generating the intermediate rendering image based on at least one item in the first original 3D information can improve the efficiency of generating the intermediate rendering image.
[0039] S130: Input the intermediate rendering image into a generator set to generate a generative adversarial neural network to obtain a 3D rendering image.
[0040] The generative adversarial neural network may be a network that has been trained for stylization. For example, stylization may be for rendering foam, hair, sequins, or animals. The generative adversarial neural network is a pixel-to-pixel pix2pix generative adversarial neural network, including a generator and a discriminator.
[0041] In this embodiment, the network layers in the generator are connected using a U-shaped jump structure. For example, Figure 2 is a schematic diagram of the grid structure of the generator in this embodiment, such as Figure 2 As shown in the figure, the first and last layers of the network are connected by skip connections, the second and second-to-last layers of the grid are connected by skip connections, and so on, forming a U-shaped skip structure. The use of a U-shaped skip structure can preserve necessary information without being changed, which can improve the accuracy of network recognition.
[0042] In this embodiment, the training method of the adversarial neural network is set as follows: obtaining the second original 3D information of the 3D material sample to be rendered; generating an intermediate rendering image sample and a corresponding rendering image sample based on the second original 3D information; and performing alternating iterative training on the generator and the discriminator based on the intermediate rendering image sample and the corresponding rendering image sample.
[0043] The second original 3D information may include vertex coordinates, normal information, camera parameters, surface tiling maps, and lighting parameters. The intermediate rendering sample may include a white film map, a normal map, a depth map, or a coarse hair map. The intermediate rendering sample is obtained by coarsely rendering the second original 3D information using existing rendering methods. The rendering sample is obtained based on the second original 3D information using an existing offline high-precision rendering algorithm. The generated rendering sample matches the intermediate rendering sample.
[0044] The alternating iterative training of the generator and discriminator can be understood as first training the discriminator, then training the generator based on the trained discriminator, then training the discriminator based on the trained generator, and so on, until the training completion condition is met. In this embodiment, alternating iterative training of the generator and discriminator based on intermediate rendering samples and corresponding rendering samples can improve the accuracy of the renderings generated by the generator.
[0045] In this embodiment, the method of alternately iteratively training the generator and the discriminator based on the intermediate rendering image samples and the corresponding rendering image samples can be: inputting the intermediate rendering image samples into the generator and outputting the generated image; forming the generated image and the intermediate rendering image samples into a negative sample pair, and forming the rendering image samples and the intermediate rendering image samples into a positive sample pair; inputting the positive sample pair into the discriminator to obtain a first discrimination result; inputting the negative sample pair into the discriminator to obtain a second discrimination result; determining a first loss function based on the first discrimination result and the second discrimination result; and alternately iteratively training the generator and the discriminator based on the first loss function.
[0046] The first discrimination result and the second discrimination result can be values between 0 and 1, which are used to represent the matching degree between the sample pairs. For a positive sample pair, the true discrimination result is 0, and for a negative sample pair, the true discrimination result is 1.
[0047] Specifically, the method of determining the first loss function based on the first discrimination result and the second discrimination result can be: calculating the first difference between the first discrimination result and the true discrimination result corresponding to the positive sample pair, calculating the second difference between the second discrimination result and the true discrimination result corresponding to the negative sample pair, taking the logarithm of the first difference and the second difference respectively, and accumulating them to obtain the first loss function. The calculation formula of the first loss function can be expressed as: L1 = ∑[logD(x,y)]+∑[log(1-D(x,G(x)))], where x represents the intermediate rendering image sample, y represents the rendering image sample, D(x,y) represents the first discrimination result obtained by inputting the intermediate rendering image sample x and the rendering image sample y into the discriminator D, G(x) represents the generated image obtained by inputting the intermediate rendering image sample x into the generator G, and D(x,G(x)) represents the second discrimination result obtained by inputting the intermediate rendering image sample x and the generated image G(x) into the discriminator D. Exemplarily, Figure 3 This is an example diagram of the training setting generation adversarial neural network in this embodiment, such as Figure 3 As shown, the intermediate rendering image sample is input into the generator G to obtain the generated image, and then the generated image and the intermediate rendering image sample are paired and input into the discriminator D to obtain the second discrimination result. The intermediate rendering image sample and the rendering image sample are paired and input into the discriminator D to obtain the first discrimination result. Finally, the first loss function determined based on the first discrimination result and the second discrimination result is alternately iterated and trained on the generator and the discriminator.
[0048] Specifically, all intermediate rendering samples are input into the generative adversarial network to obtain a first loss function, which is then used to reversely transfer the first loss function to adjust the parameters of the discriminator; based on the adjusted discriminator, all intermediate rendering samples are input into the generative adversarial network to obtain an updated first loss function, which is then used to reversely transfer the updated first loss function to adjust the parameters of the generator; based on the adjusted generator, all intermediate rendering samples are input into the generative adversarial network to obtain an updated first loss function, which is then used to reversely transfer the updated first loss function to adjust the parameters of the generator. The generator and discriminator are trained alternately and iteratively in this way until the training termination condition is met. In this embodiment, alternating and iterative training of the generator and the discriminator based on the first loss function can improve the accuracy of the rendering generated by the generator.
[0049] Optionally, after obtaining the first loss function based on the first discrimination result and the second discrimination result, it also includes: determining the second loss function based on the generated image and the rendered image samples; linearly superimposing the first loss function and the second loss function to obtain the target loss function; performing alternating iterative training on the generator and the discriminator based on the first loss function, including: performing alternating iterative training on the generator and the discriminator based on the target loss function.
[0050] The second loss function can be determined by the difference between the generated image and the rendered image sample. The calculation formula of the second loss function can be expressed as: L2 = ∑||yG(x)||1, where y represents the rendered image sample and G(x) represents the generated image obtained by inputting the intermediate rendered image sample x into the generator G. The calculation formula of the target loss function can be expressed as: L = L1 + λL2, where λ is the weight coefficient.
[0051] Specifically, all intermediate rendering samples are input into the generative adversarial network to obtain the target loss function, which is then transferred back through the target loss function to adjust the parameters of the discriminator; based on the adjusted discriminator, all intermediate rendering samples are input into the generative adversarial network to obtain the updated target loss function, which is then transferred back through the updated target loss function to adjust the parameters of the generator; based on the adjusted generator, all intermediate rendering samples are input into the generative adversarial network to obtain the updated target loss function, which is then transferred back through the updated target loss function to adjust the parameters of the generator. The generator and discriminator are trained alternately and iteratively in this way until the training termination condition is met. In this embodiment, the generator and discriminator are trained alternately and iteratively based on the target loss function to constrain the deviation between the generated image and the rendered image, thereby improving the accuracy of the generator.
[0052] Optionally, the discriminator in this embodiment uses a block discriminator called PatchGAN. PatchGAN performs block discrimination on the input sample pair, outputs sub-discrimination results for each block, and finally averages the sub-discrimination results to obtain the final discrimination result for the sample pair. Using a block discriminator can improve the accuracy of the discriminator.
[0053] Specifically, by inputting the intermediate rendering image into the generator of the trained generative adversarial neural network, a 3D rendering image of the corresponding style can be output.
[0054] The technical solution of the disclosed embodiment obtains first original 3D information of a 3D material to be rendered; generates an intermediate rendering image based on the first original 3D information; and inputs the intermediate rendering image into a generator configured to generate a generative adversarial neural network to obtain a 3D rendering image. The rendering method of 3D material provided by the disclosed embodiment inputs the intermediate rendering image generated from the first original 3D information into a configured to generate a generative adversarial neural network to obtain a rendering image. This method not only improves the accuracy of the rendering effect but also reduces the computational complexity of the rendering, thereby improving the rendering efficiency of the 3D material.
[0055] Figure 4 This is a schematic diagram of the structure of a 3D material rendering device provided by an embodiment of the present disclosure. Figure 4 As shown, the device includes:
[0056] First original 3D information acquisition information 210, used to acquire first original 3D information of the 3D material to be rendered;
[0057] An intermediate rendering image generating module 220 is configured to generate an intermediate rendering image based on the first original 3D information;
[0058] The 3D rendering image acquisition module 230 is used to input the intermediate rendering image into the generator set to generate the adversarial neural network to obtain the 3D rendering image.
[0059] Optionally, the first original 3D information includes: vertex coordinates, normal information, camera parameters, surface tiling map and / or lighting parameters.
[0060] Optionally, the intermediate rendering image generation module 220 is further configured to:
[0061] An intermediate rendering image is generated according to at least one item of the first original 3D information; wherein the intermediate rendering image includes at least one of the following: a white film map, a normal map, a depth map, and a coarse hair map.
[0062] Optionally, the generative adversarial neural network is set to a pixel-to-pixel pix2pix generative adversarial neural network, including a generator and a discriminator; and further includes setting an adversarial neural network training module for:
[0063] Obtaining second original 3D information of the 3D material sample to be rendered;
[0064] generating an intermediate rendering sample and a corresponding rendering sample based on the second original 3D information;
[0065] The generator and discriminator are trained alternately and iteratively based on the intermediate rendering samples and the corresponding rendering samples.
[0066] Setting up adversarial neural network training modules is also used for:
[0067] Input the intermediate rendering image sample into the generator and output the generated image;
[0068] The generated image and the intermediate rendered image samples are combined into a negative sample pair, and the rendered image sample and the intermediate rendered image sample are combined into a positive sample pair;
[0069] Input the positive sample pair into the discriminator to obtain the first discrimination result; input the negative sample pair into the discriminator to obtain the second discrimination result;
[0070] Determine a first loss function based on the first discrimination result and the second discrimination result;
[0071] The generator and discriminator are trained alternately and iteratively based on the first loss function.
[0072] Set up an adversarial neural network training module for:
[0073] Determine a second loss function based on the generated image and the rendered image samples;
[0074] Linearly superimpose the first loss function and the second loss function to obtain the target loss function;
[0075] The generator and discriminator are trained alternately and iteratively based on the first loss function, including:
[0076] The generator and discriminator are trained alternately and iteratively based on the target loss function.
[0077] Optionally, the network layers in the generator are connected using a U-shaped skip structure; the discriminator uses a patch discriminator PatchGAN.
[0078] The above device can execute the methods provided by all the above embodiments of the present disclosure, and has the corresponding functional modules and beneficial effects of executing the above methods. For technical details not fully described in this embodiment, please refer to the methods provided by all the above embodiments of the present disclosure.
[0079] Reference below Figure 5 , which shows a schematic structural diagram of an electronic device 300 suitable for implementing the embodiments of the present disclosure. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (e.g., vehicle-mounted navigation terminals), etc., fixed terminals such as digital TVs, desktop computers, etc., or various forms of servers, such as independent servers or server clusters. Figure 5 The electronic device shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0080] like Figure 5 As shown, the electronic device 300 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory device (ROM) 302 or a program loaded from a storage device 305 into a random access memory device (RAM) 303. Various programs and data required for the operation of the electronic device 300 are also stored in the RAM 303. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.
[0081] Typically, the following devices may be connected to the I / O interface 305: an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 307 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309. The communication device 309 may allow the electronic device 300 to communicate with other devices wirelessly or by wire to exchange data. Figure 5 The electronic device 300 is shown with various devices, but it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed instead.
[0082] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing a word recommendation method. In such an embodiment, the computer program can be downloaded and installed from a network via the communication device 309, or installed from the storage device 305, or installed from the ROM 302. When the computer program is executed by the processing device 301, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0083] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0084] In some embodiments, the client and server can communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0085] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0086] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains first original 3D information of a 3D material to be rendered; generates an intermediate rendering image based on the first original 3D information; and inputs the intermediate rendering image into a generator set to generate an adversarial neural network to obtain a 3D rendering image.
[0087] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0088] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0089] The units involved in the embodiments described in this disclosure may be implemented in software or hardware, wherein the name of a unit does not necessarily limit the unit itself.
[0090] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0091] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0092] According to one or more embodiments of the present disclosure, a method for rendering 3D material is disclosed, including:
[0093] Obtaining first original 3D information of the 3D material to be rendered;
[0094] generating an intermediate rendering image according to the first original 3D information;
[0095] The intermediate rendering image is input into a generator set to generate a generative adversarial neural network to obtain a 3D rendering image.
[0096] Furthermore, the first original 3D information includes: vertex coordinates, normal information, camera parameters, surface tiling map and / or lighting parameters.
[0097] Furthermore, generating an intermediate rendering image according to the first original 3D information includes:
[0098] An intermediate rendering image is generated according to at least one item of the first original 3D information; wherein the intermediate rendering image includes at least one of the following: a white film map, a normal map, a depth map, and a coarse hair map.
[0099] Furthermore, the generative adversarial neural network is set to be a pixel-to-pixel pix2pix generative adversarial neural network, including a generator and a discriminator; the training method of the set adversarial neural network is:
[0100] Obtaining second original 3D information of the 3D material sample to be rendered;
[0101] generating an intermediate rendering sample and a corresponding rendering sample based on the second original 3D information;
[0102] The generator and the discriminator are alternately and iteratively trained based on the intermediate rendering image samples and the corresponding rendering image samples.
[0103] Furthermore, the generator and the discriminator are alternately and iteratively trained based on the intermediate rendering image samples and the corresponding rendering image samples, including:
[0104] Input the intermediate rendering image sample into the generator and output the generated image;
[0105] The generated image and the intermediate rendered image sample form a negative sample pair, and the rendered image sample and the intermediate rendered image sample form a positive sample pair;
[0106] Input the positive sample pair into the discriminator to obtain a first discrimination result; input the negative sample pair into the discriminator to obtain a second discrimination result;
[0107] Determining a first loss function based on the first discrimination result and the second discrimination result;
[0108] The generator and the discriminator are alternately and iteratively trained based on the first loss function.
[0109] Furthermore, after obtaining a first loss function based on the first discrimination result and the second discrimination result, the method further includes:
[0110] Determine a second loss function based on the generated image and the rendered image sample;
[0111] Linearly superimposing the first loss function and the second loss function to obtain a target loss function;
[0112] The generator and the discriminator are alternately and iteratively trained based on the first loss function, comprising:
[0113] The generator and the discriminator are alternately and iteratively trained based on the target loss function.
[0114] Furthermore, the network layers in the generator are connected using a U-shaped jump structure; and the discriminator adopts a block discriminator PatchGAN.
[0115] Note that the above are only preferred embodiments of the present disclosure and the technical principles used. Those skilled in the art will understand that the present disclosure is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present disclosure. Therefore, although the present disclosure has been described in more detail through the above embodiments, the present disclosure is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present disclosure, and the scope of the present disclosure is determined by the scope of the appended claims.
Claims
1. A method for rendering 3D material, characterized in that: include: Obtaining first original 3D information of the 3D material to be rendered; generating an intermediate rendering image according to the first original 3D information; Inputting the intermediate rendering image into a generator configured to generate a generative adversarial neural network to obtain a 3D rendering image; The step of generating an intermediate rendering image according to the first original 3D information includes: generating an intermediate rendering image based on at least one item of the first original 3D information; wherein the intermediate rendering image is a 3D image with lower precision than the first 3D rendering image; and the intermediate rendering image includes at least one of the following: a white film image, a normal map, a depth map, and a coarse hair map; The set generative adversarial neural network is a stylized trained network, which is a pixel-to-pixel pix2pix generative adversarial neural network, including a generator and a discriminator; the network layers in the generator are connected using a U-shaped jump structure; the discriminator uses a patch discriminator PatchGAN; The training method of setting the generative adversarial neural network is: Obtaining second original 3D information of the 3D material sample to be rendered; generating an intermediate rendering sample and a corresponding rendering sample based on the second original 3D information; the intermediate rendering sample is obtained by performing rough rendering on the second original 3D information, and the rendering sample is obtained by using an offline high-precision rendering algorithm based on the second original 3D information; The generator and the discriminator are alternately and iteratively trained based on the intermediate rendering image samples and the corresponding rendering image samples.
2. The method according to claim 1, characterized in that The first original 3D information includes: vertex coordinates, normal information, camera parameters, surface tiling map and / or lighting parameters.
3. The method according to claim 1, characterized in that The generator and the discriminator are alternately and iteratively trained based on the intermediate rendering image samples and the corresponding rendering image samples, comprising: Input the intermediate rendering image sample into the generator and output the generated image; The generated image and the intermediate rendered image sample form a negative sample pair, and the rendered image sample and the intermediate rendered image sample form a positive sample pair; Input the positive sample pair into the discriminator to obtain a first discrimination result; input the negative sample pair into the discriminator to obtain a second discrimination result; Determining a first loss function based on the first discrimination result and the second discrimination result; The generator and the discriminator are alternately and iteratively trained based on the first loss function.
4. The method according to claim 3, characterized in that After obtaining a first loss function based on the first discrimination result and the second discrimination result, the method further includes: Determine a second loss function based on the generated image and the rendered image sample; Linearly superimposing the first loss function and the second loss function to obtain a target loss function; The generator and the discriminator are alternately and iteratively trained based on the first loss function, comprising: The generator and the discriminator are alternately and iteratively trained based on the target loss function.
5. A 3D material rendering device, characterized in that: include: First original 3D information acquisition information, used to acquire first original 3D information of a 3D material to be rendered; an intermediate rendering image generating module, configured to generate an intermediate rendering image according to the first original 3D information; A 3D rendering acquisition module, configured to input the intermediate rendering into a generator configured to generate a generative adversarial neural network to obtain a 3D rendering; The intermediate rendering image generation module is further configured to: generating an intermediate rendering image based on at least one item of the first original 3D information; wherein the intermediate rendering image is a 3D image with lower precision than the first 3D rendering image; and the intermediate rendering image includes at least one of the following: a white film image, a normal map, a depth map, and a coarse hair map; The set generative adversarial neural network is a stylized trained network, which is a pixel-to-pixel pix2pix generative adversarial neural network, including a generator and a discriminator; the network layers in the generator are connected using a U-shaped jump structure; the discriminator uses a patch discriminator PatchGAN; The training method of setting the generative adversarial neural network is: Obtaining second original 3D information of the 3D material sample to be rendered; generating an intermediate rendering sample and a corresponding rendering sample based on the second original 3D information; the intermediate rendering sample is obtained by performing rough rendering on the second original 3D information, and the rendering sample is obtained by using an offline high-precision rendering algorithm based on the second original 3D information; The generator and the discriminator are alternately and iteratively trained based on the intermediate rendering image samples and the corresponding rendering image samples.
6. An electronic device, characterized in that: The electronic device comprises: one or more processing devices; a storage device for storing one or more programs; When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the 3D material rendering method according to any one of claims 1 to 4.
7. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the method for rendering 3D materials as claimed in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Face relighting method and device based on deep learning
CN107909640A
Method and device for generating vehicle appearance part identification sample, medium and server
CN113256778A