Markerless Facial motion capture for 3d studio max

0 votes

Hello friends, with this Python script in the attachments, you can capture facial movements without using
markers and transfer these movements to 3ds Max. To do this,

-install the Python program and load the modules used at the beginning of the program below with the "import" statement like opencv , mediapipe and tkinter.
You can download python program from :

https://www.python.org/downloads/

and then you can easily install these modules from the cmd prompt by entering "pip install" commands.

-Then, copy this script into python editor, then run the program below. First, you will be prompted to open a video containing facial performance.

-Then the program will ask you for a scale; you can bypass this question by entering 1. Next, answer the question about detailed or simple analysis by typing 'd' or 'b'.

-Then the analysis will begin.

In a short time, the analysis will be completed, and you will see 3ds Max scripts generated in the same folder as this script. In 3ds Max, you only need to run the first script, named "data_external_0." The other scripts will be automatically executed in sequence, and you will see the animation of facial movement points on the screen. If you can't see it on the screen, you can use the "zoom" command. Also, if the video lighting is good, the shaking will be greatly reduced. Otherwise, you may see some shaking. I hope that this shaking will decrease to a minimum in the coming times with some improvement in the mediapipe module I used in the program. If the general size of the point objects does not match the 3D face model, you can restart the program and enter the scale factor you calculated by measuring in 3ds Max in response to the scale question asked at the beginning of the program to match them. If you calculate the scale factor correctly, you can easily match the 3D model with the points in the second run.

Finally, you can use these point motions to drive your facial rig/bones/skin controllers in 3ds max.

You can capture the hand and body with the modifications in the script, especially for the landmark numbers, but you have to use the correct landmark numbers. You can find them in the related websites of the mediapipe modul.

Enjoy

--------------------------------------------------------------------------------------

Additional Info: 

NOTE
"If the script becomes lengthy depending on the video length, there is an issue with the script not functioning in 3ds Max. Therefore, I had to divide the script into specific lengths. As mentioned above, it is sufficient to run only the first script named 'data_external_0' that I specified. The others will run automatically.

Other Software Required: 
Python and related modules
AttachmentSize
markerless_facial_mocap.txt3.88 KB