yanchxx / MoPA

An Blender addon uses ROMP to extract human's 3D poses from image, video or webcam and drive your own 3D character.
MIT License
242 stars 49 forks source link

How to run .fbx file to control the charater #1

Closed CheungBH closed 2 years ago

CheungBH commented 2 years ago

Hello. I have successfully run the demo of ROMP, which exported .fbx file. And currently I want to use the .fbx to control the character. Can you provide steps for the video demo? I can only see the camera one

CheungBH commented 2 years ago

I have followed your instructions that activate add-ons in the blender and successfully ran the webcam demo of ROMP. However, I find that there's nothing in the blender even when I pressed Ctrl+E.

Screenshot 2021-12-14 at 16 28 23

Are there anything I missed?

yanchxx commented 2 years ago

The steps for camera and video versions are exactly the same, as the local server sends the poses and translations into Blender. The difference is where the local server gets the poses and translations from.

Be sure to place your own 3D character in Blender and the character's skeleton is exactly the same as the SMPL skeleton. If you just want to show the effect, open up the beta.blend I placed in blender folder, which includes a 3D character downloaded from Mixamo with the same skeleton as SMPL, which is the 3D character I showed in the Demo. If you don't have a perfectly matched 3D character, pressing Ctrl+E will definitely not respond, or will report some errors. This work is not perfect, so it is troublesome to use, I wrote in the readme as detailed as possible and gave some files for reference, I hope you can run successfully!

camera和video版本的步骤是完全一致的,都是本地服务端将poses和translation发送到blender中,区别在于本地服务端从何处获取poses和translation。

blender中一定要放置你自己的3D人物,并且该人物的骨架与SMPL骨架完全一致。如果只是为了展示一下效果,可以打开我放置在blender文件夹中的beta.blend,其中包括了一个从mixamo中下载的3D人物,该人物的骨架正好与SMPL一致,也正是我Demo展示的3D人物。如果没有完全匹配的3D人物,按Ctrl+E肯定是没反应的,或者会报一些错误。

这项工作很不完善,所以使用起来比较麻烦,我在readme中尽可能写的详尽了并给了一些文件作为参考,希望你能运行成功!

CheungBH commented 2 years ago

我在blender里面打开了你的beta.blend文件,发现里面是个没有颜色的人(但形象是出来了,应该就是和SMPL一致的)

Screenshot 2021-12-17 at 18 58 56

我的camera demo也跑通了。不过我按control+E的时候依然没有反应,动画人物还是没有动(camera那边一直在跑)。请问这个问题要怎么解决啊。 我blender里面的real time mocap开起来了,sh webcam.sh也在另外一个terminal里面跑着。

Screenshot 2021-12-17 at 19 05 53
yanchxx commented 2 years ago

颜色得点右上角那四个并列小图标的第三个或第四个,你可以稍微去学一下我在resource里面放的blender教程,学一下第零章 天赋篇就行,很快的。 如果要用webcam的话,貌似是webcam_blender.sh那个脚本吧,不是webcam.sh。 你可以先尝试一下video的版本,用ROMP输出一个npz的文件,然后把字段调好了,用我放在src的那个server.py传输一下数据到blender中。 不过我晚点稍微更新一下步骤吧,或者录个视频,到时候你再试试。

yanchxx commented 2 years ago

对了,ctrl+E要把鼠标放在3d人物所在的那个界面再按,这样至少会报个错吧 image 至少有个connection error

CheungBH commented 2 years ago

谢谢! 我尝试了一下输出npz文件,不过我在跑server.py的时候,发现整个程序停在了 https://github.com/yanch2116/CharacterDriven-BlenderAddon/blob/261d502d9a0baaee10a978eb95e3ef1738ac46b4/src/server.py#L44 这一句上,debug的时候也下不去。 想知道这是怎么回事呢

yanchxx commented 2 years ago

我在demo文件夹里面放了那个demo1.npy,你可以直接把server.py中的getData函数中的path换成你本地的demo1.npy的文件路径,然后测试一下。 sock, addr = s.accept()这句只有当客户端发来了请求后才能够继续往下运行,你运行了server.py之后再去blender中在3d人物的界面按下ctrl+E,这样应该就会继续往下运行了。 可以看一下https://www.liaoxuefeng.com/wiki/1016959663602400/1017787560490144 这个教程。

CheungBH commented 2 years ago

我在demo文件夹里面放了那个demo1.npy,你可以直接把server.py中的getData函数中的path换成你本地的demo1.npy的文件路径,然后测试一下。 sock, addr = s.accept()这句只有当客户端发来了请求后才能够继续往下运行,你运行了server.py之后再去blender中在3d人物的界面按下ctrl+E,这样应该就会继续往下运行了。 可以看一下https://www.liaoxuefeng.com/wiki/1016959663602400/1017787560490144 这个教程。

谢谢,明白了。但是我打开了你的.blend文件,结果还是没上色,人物本身也没跑起来。 我看了看开blender的终端,里面显示好像少了个文件 /home/Downloads/white.mp4。是不是少了个什么文件啊

Screenshot 2021-12-20 at 14 52 58
yanchxx commented 2 years ago

image 我从命令行打开这个文件,没有显示你那些内容,不过那个white.mp4是我之前作为背景的一个视频,应该没啥影响。 image 颜色的话,你点了那个小图标吗,点了才有颜色。 image 右下角这里表示当前帧,开始帧和结束帧,我打开看了一下初始是在400多帧,400多帧的地方是没动画的,可能与这个有关?你得把当前帧调到第一帧去。貌似我这个人物已经绑定了demo中的动作了,你可以用自己的poses序列覆盖掉的。

yanchxx commented 2 years ago

image 这个确实会有提示,但是没啥影响,就是渲染的时候做背景的视频文件不存在,在compositing里面可以设置一下视频的路径,在readme中也有说。 把小图标点到第四个之后,texture加载了就没这个提示了。

CheungBH commented 2 years ago

image 我从命令行打开这个文件,没有显示你那些内容,不过那个white.mp4是我之前作为背景的一个视频,应该没啥影响。 image 颜色的话,你点了那个小图标吗,点了才有颜色。 image 右下角这里表示当前帧,开始帧和结束帧,我打开看了一下初始是在400多帧,400多帧的地方是没动画的,可能与这个有关?你得把当前帧调到第一帧去。貌似我这个人物已经绑定了demo中的动作了,你可以用自己的poses序列覆盖掉的。

太感谢了!texture出来了人物也跑起来! 现在就差最头疼的一件事,Ctrl+E怎么都没反应。。 我想知道如果要驱动卡通任务跑起来,我应该导入的是Alpha.fbx还是Beta.blend啊(虽然我都试了Ctrl+E都不行) 还有就是”用自己的poses序列覆盖掉“,这个“覆盖”是个什么操作啊 感激🙏

yanchxx commented 2 years ago

打开Βeta.blend就行,这个文件中我设置好了灯光和摄像机,实际上你打开的时候进入的那个scripting界面就是我的脚本,你不需要自己去安装脚本的,直接点击上面的运行按钮,看到左下角那个run_script()提示就行。 image 脚本运行成功之后,再点击layout进入3D view视图。 image

yanchxx commented 2 years ago

打开终端,运行server.py。 image 再回到blender中按下Ctrl+E,此时终端会提示正在传输的帧的id。 image 传输的同时,blender中的3D人物就会跟着动了,并且在传输完成后,你把当前帧调到第1帧,然后按下中间的播放,就能看到3D人物的动画了。 image

yanchxx commented 2 years ago

在Blender中,你要想记录动画,就得在关键帧上面保存当前画面的信息,每一帧保存一个动作,这样连着播放就像是动画了。 我不知道你用这个的目的是什么,应该是自己有一段3D姿态估计出来的动作序列,然后想传输到这个小人中,看看效果吧。 所以之后你应该会传输自己的数据,然后在每一帧上进行保存。我说的覆盖就是指你传输自己的数据到3d小人中,然后保存到关键帧上,并且把之前我的动作数据覆盖掉。 还是强烈建议去学一下blender教程第零章,一个小时就把基础的blender操作和动画知识讲的差不多了。如果你想搞清楚3D人物是如何被驱动的,看blender动画骨骼篇。 看这两章内容,大约花费两三个小时,但是基础的知识就差不多都知道了,不涉及到3D建模的知识。

CheungBH commented 2 years ago

打开Βeta.blend就行,这个文件中我设置好了灯光和摄像机,实际上你打开的时候进入的那个scripting界面就是我的脚本,你不需要自己去安装脚本的,直接点击上面的运行按钮,看到左下角那个run_script()提示就行。 image 脚本运行成功之后,再点击layout进入3D view视图。 image

感谢!是这个run我之前一直没点,所以没反应。现在python那边能够收到blender发回去的信号了。 不过我也遇上了那个key "Pelvis" not found'的问题。我看到是要active Armature,不过我发现我好像没能像你的demo那样选中

Screenshot 2021-12-27 at 22 46 56

怎么点都是这个样子

Screenshot 2021-12-27 at 22 45 23

我自己也不清楚active了没有,感觉这样是没active是吧?

yanchxx commented 2 years ago

按Shift就能多选了

CheungBH commented 2 years ago

太感谢了! 跑起来了!

Screenshot 2021-12-31 at 17 10 29

不过我遇到很奇怪的事情,就是第一帧总会出现Pelvis not found,然后我得重启blender并且没有重新连接才能成功跑起来,后面的帧都没事。 所以我的步骤是:打开blender->运行server.py->打开beta.blend->Ctrl+E(Pelvis not found)->不保存并重新打开beta.blend-> Ctrl+E(跑起来)。 有时候如果重启了blender导致重新连接了,也会Pelvis not found

Screenshot 2021-12-31 at 17 36 46

知道这个是怎么回事嘛

yanchxx commented 2 years ago

太感谢了! 跑起来了! Screenshot 2021-12-31 at 17 10 29 不过我遇到很奇怪的事情,就是第一帧总会出现Pelvis not found,然后我得重启blender并且没有重新连接才能成功跑起来,后面的帧都没事。 所以我的步骤是:打开blender->运行server.py->打开beta.blend->Ctrl+E(Pelvis not found)->不保存并重新打开beta.blend-> Ctrl+E(跑起来)。 有时候如果重启了blender导致重新连接了,也会Pelvis not found Screenshot 2021-12-31 at 17 36 46 知道这个是怎么回事嘛

把这个bug修复了,而且不需要再选中Armature了,重新下载一下文件试试看吧~

CheungBH commented 2 years ago

感谢!现在Pelvis not found的问题解决了!按下了Ctrl+E数据已经可以源源不断传输过来了。不过现在是blender里面的人没反应。。 我用的是你最新那个beta.blend文件,跑的是最新的代码。 情况是,我在传输的过程中,整个blender是处于卡死的状态,人没有在移动,然后什么按键也按不了;传输完成后,scripting左下角显示的是bpy.context.space_data.shading.type = "RENDERED"(应该是接收过来了?),

Screenshot 2022-01-02 at 10 36 38

然后我无论按下播放键还是拖动进度条,画面人物都保持着原始状态。

Screenshot 2022-01-02 at 10 39 15

这是。。还少了哪个步骤嘛

yanchxx commented 2 years ago

不知道为啥你的3D人物进入了edit模式,你选中一下Armature然后点击左上角,进入object模式就行了 image

yanchxx commented 2 years ago

你每次重新打开文件运行都会这样吗?还是只是不小心点到了Edit Mode?

CheungBH commented 2 years ago

没有诶...我一直是object mode喔... 这是运行到一半的情况,数据在传输,显示也是object mode,但是人保持原姿势...

Screenshot 2022-01-02 at 22 11 06
yanchxx commented 2 years ago

虽然不知道为啥,但是你这个确实是进入了Edit Mode,只有Edit Mode才会这样。 你是一打开blend文件就这样,还是运行插件之后才会这样?

CheungBH commented 2 years ago

好像是一打开就这样了。我的完整操作:

  1. 打开blender,导入beta.blend
  2. 按下scripting的开始按钮
  3. 开terminal,运行代码至wait for connetion
  4. blender切换到layout,按出颜色并且按下人物
  5. Ctrl+E 然后后面就是这样了。python那边一直在发信息,但是blender里显示着的是object mode,然后毫无反应。。 Screenshot 2022-01-03 at 01 19 17
yanchxx commented 2 years ago

你重新下载个最新的文件试试看,我往里面放了个背景图,没道理会这样呀,我一打开就是正常的object模式 你试试看选中Armature,然后点Edit Mode,然后再点回Object Mode

CheungBH commented 2 years ago

还是一样... 我的操作都在这里了 https://drive.google.com/file/d/1PrPEViU6YtaMKOZ1pomS_pVpjqXV1TLv/view?usp=sharing 是不是漏了哪一步啊..

yanchxx commented 2 years ago

还是一样... 我的操作都在这里了 https://drive.google.com/file/d/1PrPEViU6YtaMKOZ1pomS_pVpjqXV1TLv/view?usp=sharing 是不是漏了哪一步啊..

你不要open最近的文件,你重新下载一下我整个repo,然后再打开beta.blend,最新的那个应该是有背景的

CheungBH commented 2 years ago

还是一样... 我的操作都在这里了 https://drive.google.com/file/d/1PrPEViU6YtaMKOZ1pomS_pVpjqXV1TLv/view?usp=sharing 是不是漏了哪一步啊..

你不要open最近的文件,你重新下载一下我整个repo,然后再打开beta.blend,最新的那个应该是有背景的

唔,可是我开的就是最新的那个了就是这样...因为我录屏之前反复尝试过,所以才在open recent里面..

yanchxx commented 2 years ago

还是一样... 我的操作都在这里了 https://drive.google.com/file/d/1PrPEViU6YtaMKOZ1pomS_pVpjqXV1TLv/view?usp=sharing 是不是漏了哪一步啊..

你不要open最近的文件,你重新下载一下我整个repo,然后再打开beta.blend,最新的那个应该是有背景的

唔,可是我开的就是最新的那个了就是这样...因为我录屏之前反复尝试过,所以才在open recent里面..

按我的理解肯定是blend文件哪里出了bug,既然打开就是这样的,还没到运行插件这一步

yanchxx commented 2 years ago

@CheungBH 今天又有个人出现了同样的状况,后来我发现我的Blender是3.0,然后我去下载了2.93的测试了一下,果然人物卡在那里一动不动,不知道为啥。后来我重新导入了一下模型,又上传了,你试试看可以正常运行了吗

CheungBH commented 2 years ago

就是这个原因!跑通了,太感谢了!