A 3D character real-time facial driving method, device, electronic device and storage medium

Through VAE model training and real-time driving of controller coefficients, the problems of insufficient expressiveness and high threshold for use of real-time facial driving of high-precision 3D face models in the existing technology are solved, and high-quality and low-threshold facial animation driving is realized, supporting Quickly change actors.

CN114898020BActive Publication Date: 2024-10-18WUWU (HANGZHOU) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210589964.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2024-10-18
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

Existing technologies have problems with insufficient expressiveness and high barriers to use in real-time facial driving of high-precision 3D face models. In particular, natural mouth shape changes cannot be achieved when crossing the uncanny valley, and face capture helmets require complex calibration. process and needs to be recalibrated every time an actor is changed.

Method used

Using the variational autoencoder (VAE) model, the controller values ​​are extracted by obtaining the 3D character facial animation files and the actor's facial expression video files, and are trained based on the VAE model to obtain the controller coefficients and transmit them to the rendering software to achieve high performance. Quality facial animation driver. The method includes an encoder and two decoders, which are trained through self-supervised and supervised learning to obtain optimal weight values ​​and controller coefficients for driving 3D virtual images in real time.

Benefits of technology

It realizes a high-precision facial animation driver, lowers the threshold for use, avoids the complex calibration process of face capture helmets, and supports quick actor changes, with a performance of real-time driver with a frame rate greater than 60.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114898020B_ABST
    Figure CN114898020B_ABST
Patent Text Reader

Abstract

The present invention discloses a 3D character real-time facial driving method, device, electronic device and storage medium, including obtaining a character facial animation file and a corresponding actor's facial expression video file; based on the character facial animation file, obtaining a controller value corresponding to each frame of animation; rendering the character facial animation file into a character video file, extracting a corresponding character picture set and an actor facial picture set from the character video file and the actor's facial expression video file; constructing a VAE model; training the VAE model based on the character picture set, the actor facial picture set and the controller value corresponding to the character picture set; after the training is completed, inputting the actor facial picture into the trained VAE model to obtain the coefficient of the controller; transmitting the coefficient of the controller to the rendering software, and the rendering software drives the 3D virtual image in real time to obtain high-quality facial animation. The present invention can obtain high-precision facial animation through the VAE model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of 3D image processing, and in particular to a 3D character real-time face driving method, device, electronic device and storage medium. Background Art

[0002] With the advent of the Metaverse era, there is a huge demand for real-time facial driving of high-precision 3D face models (30,000 to 40,000 model vertices). The current video facial driving solutions: the mobile phone represented by the iPhone X, its problem is that it is not expressive enough, such as the change of mouth shape when speaking, which cannot cross the uncanny valley when used to drive high-precision realistic virtual people; face capture helmets generally have complex 3D characters, and the actor calibration stage has a high threshold for use, and each time the actor is changed, it needs to be recalibrated. Summary of the invention

[0003] In order to solve the above problems existing in the prior art, the present invention provides a 3D character real-time face driving method, device, electronic device and storage medium.

[0004] The present invention discloses a 3D character real-time face driving method, comprising:

[0005] Obtain the 3D character facial animation file and the corresponding actor's facial expression video file;

[0006] Based on the 3D character facial animation file, obtain the controller value corresponding to each frame of animation;

[0007] Rendering the 3D character facial animation file into a 3D character video file, and extracting corresponding 3D character picture sets and actor facial picture sets from the 3D character video file and the actor's facial expression video file;

[0008] Build a VAE model;

[0009] Training the VAE model based on the 3D character picture set, the actor face picture set, and controller values ​​corresponding to the 3D character picture set;

[0010] After the training is completed, the actor's facial image is input into the trained VAE model to obtain the coefficients of the controller;

[0011] The coefficients of the controller are transmitted to rendering software, which drives the 3D avatar in real time to obtain high-quality facial animation.

[0012] Preferably, the VAE model includes an encoder and two decoders;

[0013] The encoder encodes the input pictures in the 3D character picture set and the actor face picture set;

[0014] The decoder performs decoding optimization training on the encoded pictures in the 3D character picture set and the actor face picture set to obtain optimal weight values ​​of the encoder and the decoder;

[0015] Another decoder performs decoding training on the encoded 3D character picture set and the controller value corresponding to the 3D character picture set to obtain the controller coefficient.

[0016] Preferably, the encoder encoding function is:

[0017] Enc(x)=(f z (x), f id (x));

[0018] Where: x is the input image; f z (x) is the encoding of VAE; z is the encoding of expression information in latent space; f id (x) is the encoding of AE; id is the encoding of identity information in the latent space.

[0019] Preferably, the loss function of the decoding optimization training is:

[0020] L=L vae +L rec +L cycle ;

[0021]

[0022]

[0023] Where: x 1 For 3D character pictures; x 2 For the actor's face picture; is the output of the decoder; f z (x); p θ (x|z) is the photo reconstructed by z; p(z) is the prior distribution of z; L dssim For x and The structural similarity error.

[0024] Preferably, another error function of the decoding training is:

[0025]

[0026] Where: y is the controller value vector corresponding to a frame of animation, is the predicted controller value vector.

[0027] Preferably, the 3D character facial animation file is an FBX file, and the controller value corresponding to each frame of animation is read out through the fbx sdk of Autodesk.

[0028] The present invention also provides a 3D character real-time face driving device, comprising:

[0029] An acquisition module is used to acquire 3D character facial animation files and corresponding actor's facial expression video files;

[0030] A reading module, used for obtaining a controller value corresponding to each frame of animation based on the 3D character facial animation file;

[0031] An extraction module, used for rendering the 3D character facial animation file into a 3D character video file, and extracting corresponding 3D character picture sets and actor facial picture sets from the 3D character video file and the actor's facial expression video file;

[0032] Building module for building VAE model;

[0033] A training module, for training the VAE model based on the 3D character picture set, the actor face picture set, and controller values ​​corresponding to the 3D character picture set;

[0034] A calculation module, used for inputting the actor's facial image into the trained VAE model after the training is completed, to obtain the coefficients of the controller;

[0035] The driving module is used to transmit the coefficients of the controller to the rendering software, and the rendering software drives the 3D virtual image in real time to obtain high-quality facial animation.

[0036] The present invention also provides an electronic device, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit executes the above method.

[0037] The present invention also provides a storage medium storing a computer program executable by an electronic device, and when the program runs on the electronic device, the electronic device executes the above method.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] The present invention can obtain high-precision facial animation through the VAE model, and the usage threshold is lower than that of the facial helmet. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Figure 1 It is a schematic diagram of the process structure of the real-time facial driving method of a 3D character of the present invention;

[0041] Figure 2 It is a schematic diagram of the structure of the model in the real-time facial driving method of a 3D character of the present invention. DETAILED DESCRIPTION

[0042] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0043] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0044] Reference Figure 1 The present invention discloses a 3D character real-time face driving method, comprising:

[0045] Obtain the 3D character facial animation file and the corresponding actor's facial expression video file;

[0046] Based on the 3D character facial animation file, get the controller value corresponding to each frame of animation;

[0047] Specifically, the 3D character facial animation file is an FBX file, and the controller name used by the 3D character model and the value of the controller corresponding to each frame of animation are read from FBX through Autodesk's fbx sdk.

[0048] Rendering the 3D character facial animation file into a 3D character video file, and extracting corresponding 3D character picture sets and actor facial picture sets from the 3D character video file and the actor's facial expression video file;

[0049] Specifically, the 3D character video file and the actor's facial expression video file are extracted at a certain frame rate to become a picture set, and each 3D character animation frame-extracted picture corresponds to a controller value.

[0050] Construct a VAE model, such as Figure 2 As shown;

[0051] Specifically, the model includes an encoder and two decoders, and both the encoder and the decoder are multi-layer convolutional neural networks, and gradient descent is used to update the model weights during training. The VAE model includes an encoder and two decoders; the encoder encodes the input 3D character picture set and the pictures in the actor face picture set; a decoder 1 performs decoding optimization training on the pictures in the encoded 3D character picture set and the actor face picture set to obtain the optimal weight values ​​of the encoder and decoder; the parameters of the encoder are fixed, the decoder 1 and the id part are discarded, and the other decoder 2 performs decoding training on the encoded 3D character picture set and the controller values ​​corresponding to the 3D character picture set to obtain the controller coefficients. The encoder encodes the input picture into the latent space, Enc(x)=(f z (x), f id (x)), x represents the input image, the entire Enc represents the encoder, and f z (x) = z is a typical VAE encoding; f id (x) = id is a typical AE code. z (x) and f id (x) Except for the last layer, the structure and weights of the previous layers of the encoder are shared. Where z is the encoding of the expression information in the latent space, and id is the encoding of the identity information in the latent space.

[0052] Training the VAE model based on the 3D character image set, the actor face image set, and the controller values ​​corresponding to the 3D character image set;

[0053] Specifically, during training, there is no need to match each frame of the 3D character image with the actor's face image one by one. The training is divided into two stages. The first stage is a self-supervised learning, which learns the optimal weight values ​​of the encoder and decoder 1 by reconstructing the input photos. The loss function of the first stage model includes:

[0054] L=L vae +L rec +L cycle ;

[0055] L vae ELBO loss for VAE:

[0056]

[0057] in, That is, f z (x), represents the input image x, and obtains the VAE encoding z; p θ (x|z) represents the reconstruction of the photo through z, corresponding to decoder 1; p(z) is the prior distribution of z. The first term represents the expected value of the likelihood of x, and the second term is called KL divergence, which is equivalent to a regularization term, so that can get as close to p(z) as possible.

[0058] L rec The error between the reconstructed image and the original image:

[0059]

[0060] in, is the output of the decoder, L dssim For x and The first error focuses on the consistency of each pixel, and the second focuses on the structural similarity of the two photos.

[0061] L cycle is the cycle consistency error:

[0062]

[0063] Among them, x 1 For 3D character pictures; x 2 is the actor's facial image; the first item indicates that x 1 The latent space expression encoding f of the picture z (x 1 ) and x 2 The identity code f id (x 2 ) After the splicing, the picture obtained by the decoder Dec should be the same as f after passing through the encoder z (x 1 ) as close as possible; the second term is similarly just from x 2 Get the expression code f z (x 2 ), x 1 Get the identity code f id (x 1 ).

[0064] The second stage of training is a supervised learning, and the data is the 3D character image and the corresponding controller value. The 3D character image is input into the encoder, and the output implicit code z is input into the decoder 2 to obtain the controller value predicted by the model. The error function is

[0065]

[0066] Among them, y is the controller value vector corresponding to a frame of animation, is the predicted controller value vector.

[0067] Furthermore, in order to ensure the robustness of the model, the training data, namely the 3D character images and the actor's face images, are processed. The processing includes but is not limited to rotation, flipping, cropping, adding noise, changing brightness, chroma, contrast, saturation, simulating lighting, distortion, etc., which can improve the robustness of the model.

[0068] That is, in the first stage, VAE is trained, and the actor's face pictures and 3D character pictures are input into the model, and the optimal weight values ​​of the encoder and decoder are obtained through the optimal loss function. In order to prevent the expression information encoded in z from overflowing into id, during the training process, the ids obtained from the same actor photos in a batch are randomly shuffled before entering the encoder, and the ids obtained from the same character photos in a batch are randomly shuffled before entering the encoder. During training, z and id are re-parameterized before being spliced.

[0069] The second stage trains the controller decoding module. The encoder parameters are fixed, decoder 1 and the ID part are discarded, and the encoder output is connected to decoder 2 for training. That is, the input 3D character image and the corresponding controller value are supervised for training, and the controller parameters are used as the output label value. By optimizing L reg The loss function is used to obtain the optimal weight value of the controller decoder. After training, the VAE model only needs the encoder and decoder 2.

[0070] After the training is completed, the actor's facial image is input into the trained VAE model to obtain the coefficients of the controller;

[0071] The controller's coefficients are transmitted to the rendering software, which drives the 3D avatar in real time to obtain high-quality facial animation.

[0072] Specifically, when in use, the actor's facial video stream is obtained from the camera, each frame of the actor's facial image is extracted, and input to the 3D character model. The result obtained from decoder 2 is input to the 3D rendering engine as the controller coefficient to render the animation. The whole process has high performance. If the camera frame rate is high enough under GPU graphics card acceleration, the whole process can reach a frame rate greater than 60. Rendering software includes but is not limited to UE and Maya.

[0073] In this embodiment, the facial expression video file of an actor may be of the same actor or multiple actors.

[0074] Example

[0075] Download the realistic human face from Metahuman creator from Quixel Bridge and import it into Maya and UE as a 3D character.

[0076] Prepare a performance script, including common facial expressions, Chinese pronunciations, and Chinese sentences. Actor A performs according to the performance script and records a frontal face video with a frame rate of 30 frames, which serves as a reference template for subsequent actors' performances.

[0077] In Maya, Metahuman controller was used to K out a sequence frame animation based on actor A’s performance video, totaling about 8 minutes. The animation was exported as an FBX file and saved. At the same time, the animation was rendered into a video file in Maya, including videos of the front and side face angles, with a frame rate of 30 frames.

[0078] Actor A or other actor B performs according to the performance script, recording the front and side face videos with a frame rate of 30 frames;

[0079] Use fbx sdk to read the controller coefficients of each frame in the FBX animation file, with a dimension of 169; extract photos from the 3D character video and the video of actor A or other actor B, align the faces of each photo, and crop out 256x256 images;

[0080] Build a VAE model, the encoder contains multiple layers of convolution blocks, decoder 1 contains multiple layers of deconvolution blocks, and decoder 2 is a multi-layer MLP;

[0081] The obtained images are used to train the VAE model, and the coefficients of the controller are obtained after the training is completed;

[0082] Start the model client, actor A or other actor B faces the camera, reads the camera video stream, inputs each frame of the actor image into the model, and transmits the controller coefficients to the UE through livelink; thus, the Metahuman3D character in the UE is driven in real time to perform facial animation, and the effect exceeds that of the iPhoneX.

[0083] The present invention also provides a 3D character real-time face driving device, comprising:

[0084] An acquisition module is used to acquire 3D character facial animation files and corresponding actor's facial expression video files;

[0085] The reading module is used to obtain the controller value corresponding to each frame of animation based on the 3D character facial animation file;

[0086] An extraction module, used for rendering the 3D character facial animation file into a 3D character video file, and extracting the corresponding 3D character picture set and actor facial picture set from the 3D character video file and the actor's facial expression video file;

[0087] Building module for building VAE model;

[0088] A training module, for training the VAE model based on a 3D character image set, an actor face image set, and controller values ​​corresponding to the 3D character image set;

[0089] The calculation module is used to input the actor's facial image into the trained VAE model after training is completed to obtain the coefficients of the controller;

[0090] The driver module is used to transmit the coefficients of the controller to the rendering software, and the rendering software drives the 3D virtual image in real time to obtain high-quality facial animation.

[0091] The present invention also provides an electronic device, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit executes the above method.

[0092] The present invention also provides a storage medium storing a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device executes the above method.

[0093] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A 3D character real-time facial driving method, characterized in that: include: Obtain the 3D character facial animation file and the corresponding actor's facial expression video file; Based on the 3D character facial animation file, obtain the controller value corresponding to each frame of animation; Rendering the 3D character facial animation file into a 3D character video file, and extracting corresponding 3D character picture sets and actor facial picture sets from the 3D character video file and the actor's facial expression video file; Build a VAE model; Training the VAE model based on the 3D character picture set, the actor face picture set, and controller values ​​corresponding to the 3D character picture set; After the training is completed, the 3D character image and the actor's facial image are input into the trained VAE model to obtain the coefficients of the controller; The coefficients of the controller are transmitted to rendering software, and the rendering software drives the 3D avatar in real time to obtain high-quality facial animation; Wherein, the VAE model includes an encoder and two decoders; The encoder encodes the input pictures in the 3D character picture set and the actor face picture set; The decoder performs decoding optimization training on the encoded pictures in the 3D character picture set and the actor face picture set to obtain optimal weight values ​​of the encoder and the decoder; Another decoder performs decoding training on the encoded 3D character picture set and the controller value corresponding to the 3D character picture set to obtain the controller coefficient; The encoder encoding function is: Enc(x)=(f z (x),f id (x)); Where: x is the input image; f z (x) is the encoding of VAE; z is the encoding of expression information in latent space; f id (x) is the encoding of VAE; id is the encoding of identity information in the latent space; The loss function of the decoding optimization training is: L=L vae +L rec +L cycle ; L cycle =||f z (x1)-f z (Dec(f z (x1),f id (x2)))||2+||f z (x2)-f z (Dec(f z (x2),f id (x1)))||2; Where: x1 is the 3D character image; x2 is the actor's face image; is the output of the decoder; f z (x); p θ (x|z) is the photo reconstructed by z; p(z) is the prior distribution of z; L dssim For x and The structural similarity error of The error function of the decoding training is: Where: y is the controller value vector corresponding to a frame of animation, is the predicted controller value vector.

2. The 3D character real-time facial driving method according to claim 1, characterized in that: The 3D character facial animation file is an FBX file, and the controller value corresponding to each frame of animation is read through Autodesk's fbx sdk.

3. A 3D character real-time facial driving device, characterized in that: include: An acquisition module is used to acquire 3D character facial animation files and corresponding actor's facial expression video files; A reading module, used for obtaining a controller value corresponding to each frame of animation based on the 3D character facial animation file; An extraction module, used for rendering the 3D character facial animation file into a 3D character video file, and extracting corresponding 3D character picture sets and actor facial picture sets from the 3D character video file and the actor's facial expression video file; Building module for building VAE model; A training module, for training the VAE model based on the 3D character picture set, the actor face picture set, and controller values ​​corresponding to the 3D character picture set; A calculation module, for inputting the 3D character image and the actor's facial image into the trained VAE model after the training is completed, to obtain the coefficients of the controller; A driving module, used to transmit the coefficients of the controller to the rendering software, and the rendering software drives the 3D avatar in real time to obtain high-quality facial animation; Wherein, the VAE model includes an encoder and two decoders; The encoder encodes the input pictures in the 3D character picture set and the actor face picture set; The decoder performs decoding optimization training on the encoded pictures in the 3D character picture set and the actor face picture set to obtain optimal weight values ​​of the encoder and the decoder; Another decoder performs decoding training on the encoded 3D character picture set and the controller value corresponding to the 3D character picture set to obtain the controller coefficient; The encoder encoding function is: Enc(x)=(f z (x),f id (x)); Where: x is the input image; f z (x) is the encoding of VAE; z is the encoding of expression information in latent space; f id (x) is the encoding of VAE; id is the encoding of identity information in the latent space; The loss function of the decoding optimization training is: L=L vae +L rec +L cycle ; L cycle =||f z (x1)-f z (Dec(f z (x1),f id (x2)))||2+||f z (x2)-f z (Dec(f z (x2),f id (x1)))||2; Where: x1 is the 3D character image; x2 is the actor's face image; is the output of the decoder; f z (x); p θ (x|z) is the photo reconstructed by z; p(z) is the prior distribution of z; L dssim For x and The structural similarity error of The error function of the decoding training is: Where: y is the controller value vector corresponding to a frame of animation, is the predicted controller value vector.

4. An electronic device, characterized in that: The method comprises at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the program is executed by the processing unit, the processing unit executes the method according to any one of claims 1 to 2.

5. A storage medium, characterized in that: It stores a computer program executable by an electronic device. When the program runs on the electronic device, the electronic device executes the method described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • 3D character facial expression animation real-time generation method based on deep learning

    CN112700524A