Comments (12)
Hi, to get the information you will need some parser for your input format. This part is not so elegant and requires some manual check on the parser results (partially due to the inconsistency of different formats of rigged models). That is why I didn't release code for this.
There are some off-the-shelf parsers that I know:
pycollada https://pycollada.readthedocs.io/en/latest/
open3D 0.11.0 supports fbx gltf http://www.open3d.org/2020/10/15/open3d-0-11-0/
assimp: https://www.assimp.org/
and also shipped parser from Blender and Maya.
In my project, I initially use .dae models (collada). I found no parser can be used for all downloaded models. In the end I use pycollada and Maya to get the information, and check the results manually.
I released a Maya script to parse FBX format, as a reference that you can start from:
#8 (comment)
Note the limitation of this code (only for single geometry component, but you can definitely change that).
from rignet.
sorry but i don't have a ready-to-use parser for any fbx format. Maybe you can search if there is any latest python library that support it. My maya [script](new link) can only preprocess single component. I am not sure how hard it is to modify it for multiple components. Check Line 160 where I take [0] only and you might start from there. Or you can try if some software or library can convert multiple-component mesh to single-component one.
Thanks for the reply, I ended up using Maya to combine all components into a single component.
from rignet.
Thank you very much. I tried with .blv or other mocap formats in ascii but got confused. I'll tell you if I make up any other method for this task.
(By the way, I tried something similar to this but on 2d images and then sending coordinates to blender to edit the rigged skeleton automatically), but what you did here is quite impressive.
from rignet.
@zhan-xu Hi! I have tried your fbx parser with fbx models downloaded elsewhere. It seems that the texture or vertex color information is lost during the parsing process. Is there any way to restore this information or parse from fbx using mayapy? Also, how can I save obj, riginfo along with texture back into fbx? Can you offer some tutorials / blogs / links about this? Thanks !!!!!
from rignet.
Hi. My fbx parser if a very preliminary one and has many limitations. For your question, I think you need cmds.polyEditUV to get vertex UV, and cmds.polyColorPerVertex to get vertex color. In function record_obj, write the UV and color according to OBJ format.
Another possibility is instead of using record_obj, try something like:
cmds.select(geo_list[0]) # select a mesh.
cmds.file(output_filename, force=True, op="groups=0;ptgroups=0;materials=0;smoothing=0;normals=1", typ="OBJexport", pr=True, es=True) # save the selected mesh to OBJ file
There are several options you can choose for parameter "op". You need to figure out which flag to use to save vertex color and uv.
To reassemble rig_info and obj back to fbx, you can use RigNet/maya_save_fbx.py with mayapy. Still, i didn't consider color and texture here, but if your obj file already has that information, I assume they will be loaded when you open the OBJ.
from rignet.
Thanks for your quick and detailed reply!!!
I will try that!
Wish you all the best
from rignet.
Hi. My fbx parser if a very preliminary one and has many limitations. For your question, I think you need cmds.polyEditUV to get vertex UV, and cmds.polyColorPerVertex to get vertex color. In function record_obj, write the UV and color according to OBJ format.
Another possibility is instead of using record_obj, try something like:
cmds.select(geo_list[0]) # select a mesh. cmds.file(output_filename, force=True, op="groups=0;ptgroups=0;materials=0;smoothing=0;normals=1", typ="OBJexport", pr=True, es=True) # save the selected mesh to OBJ file
There are several options you can choose for parameter "op". You need to figure out which flag to use to save vertex color and uv.
To reassemble rig_info and obj back to fbx, you can use RigNet/maya_save_fbx.py with mayapy. Still, i didn't consider color and texture here, but if your obj file already has that information, I assume they will be loaded when you open the OBJ.
I was able to use
cmds.file(output_filename, force=True, op="groups=0;ptgroups=0;materials=1;smoothing=0;normals=1", typ="OBJexport", pr=True, es=True) # save the selected mesh to OBJ file
to save the material into .mtl file and load the obj.
But when I tried to get vertex color by
for geo in geoList:
vtxIndexList = cmds.getAttr(geo + ".vrts", multiIndices=True)
for i in vtxIndexList:
print(cmds.polyColorPerVertex(geo + ".vtx[" + str(i) + "]", query=True, rgb=True))
# print(i)
# print(cmds.polyEditUV)
pos = cmds.xform( geo + ".vtx[" + str(i) + "]", query=True, translation=True, worldSpace=True )
in record_obj
function, it saied RuntimeError: No components were found to query.
can you give some idea about this bug? I tried to use cmds.select
to select the object or vertex but failed. Also , it worked well in edit
mode but failed in query
mode
from rignet.
Hi, I just tried by myself and had the same problem.
I think the first thing is to make sure whether the color comes from vertex color or texture. If they come from texture, you will need to query UV.
Take a look at the this https://gamedev.stackexchange.com/a/66270
Seems Maya is not able to export OBJ with vertex color. Not quite sure about this though.
from rignet.
@zhan-xu Got it! Thanks!!!
from rignet.
Hi, to get the information you will need some parser for your input format. This part is not so elegant and requires some manual check on the parser results (partially due to the inconsistency of different formats of rigged models). That is why I didn't release code for this.
There are some off-the-shelf parsers that I know: pycollada https://pycollada.readthedocs.io/en/latest/ open3D 0.11.0 supports fbx gltf http://www.open3d.org/2020/10/15/open3d-0-11-0/ assimp: https://www.assimp.org/ and also shipped parser from Blender and Maya.
In my project, I initially use .dae models (collada). I found no parser can be used for all downloaded models. In the end I use pycollada and Maya to get the information, and check the results manually.
I released a Maya script to parse FBX format, as a reference that you can start from: #8 (comment) Note the limitation of this code (only for single geometry component, but you can definitely change that).
Hi, Could you please elaborate more on how to process meshes with multiple components? Thanks!
from rignet.
sorry but i don't have a ready-to-use parser for any fbx format. Maybe you can search if there is any latest python library that support it. My maya [script](new link) can only preprocess single component. I am not sure how hard it is to modify it for multiple components. Check Line 160 where I take [0] only and you might start from there. Or you can try if some software or library can convert multiple-component mesh to single-component one.
from rignet.
Hi @sunshineatnoon, Can you please share your script for converting parsing .fbx files (that handles all the present components)?
Thanks!
from rignet.
Related Issues (20)
- Is it possible to process asymmetrical model? HOT 5
- OSError problem HOT 2
- run_joint_pretrain issue on macos
- How to reduce/eliminate the "randomness" of the predicted skeleton? HOT 4
- Is it possible to run without any cuda because I haven't cuda in my machine HOT 1
- Is it possible to generating fixed joints with certain topology? HOT 3
- 可以提供colab版吗?
- Running RigNet in python3.9 and get Aborted HOT 11
- the issue on Dataset Directory variable (DATASET_DIR) for training
- Imcomplete skeleton
- The link of the dataset has been removed. HOT 3
- Data licensing HOT 1
- Code to compute metrics is missing HOT 5
- Can we do rig on custom SMPL ?
- Bad skinning/weights issue HOT 3
- Running `quick_start.py` Error HOT 1
- Compared to NeuroSkinning, regarding the skin of clothing parts
- std::bad_alloc Error
- Why normalize? HOT 1
- trained_models not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rignet.