Comments (21)
In the example below I take the vertices faces from SMPLX and save its mesh to an obj file with vertex texture (vt tag).
import numpy as np import trimesh import trimesh.exchange input_path = '/tmp' output_path = '/tmp' uv_table = np.load(os.path.join(input_path,'uv_table.npy')) mesh = trimesh.Trimesh(vertices,faces,visual=trimesh.visual.TextureVisuals(uv=uv_table) export_obj = trimesh.exchange.export_obj(mesh,include_texture=True) mesh_filename_path = os.path.join(output_path,'out.obj') with open(mesh_filename_path,'w') as file_obj: trimesh.util.write_encoded(file_obj, export_obj)
In a mesh viewer one can add a texture.png file of that should be mapped correctly for most vertices
This is now "trimesh.exchange.obj
" wherever the original commenter wrote "trimesh.exchange
"
from smplx.
In the example below I take the vertices faces from SMPLX and save its mesh to an obj file with vertex texture (vt tag).
import numpy as np
import trimesh
import trimesh.exchange
input_path = '/tmp'
output_path = '/tmp'
uv_table = np.load(os.path.join(input_path,'uv_table.npy'))
mesh = trimesh.Trimesh(vertices,faces,visual=trimesh.visual.TextureVisuals(uv=uv_table)
export_obj = trimesh.exchange.export_obj(mesh,include_texture=True)
mesh_filename_path = os.path.join(output_path,'out.obj')
with open(mesh_filename_path,'w') as file_obj:
trimesh.util.write_encoded(file_obj, export_obj)
In a mesh viewer one can add a texture.png file of that should be mapped correctly for most vertices
from smplx.
@MAOYALI Right now SMPL-X has no texture map. I will update the Readme should one be created.
from smplx.
@fabienbaradel from their project page https://smpl-x.is.tue.mpg.de/
from smplx.
Maybe you need to do it yourself,you may need to use maya or 3dmax to cut UV map your self,the format just like smpl
from smplx.
I was able to plug the uv_map in CalciferZh/SMPL#5 (comment) into smpl 6890 vertices model and it seems to work fine with textures.
My understanding is that the vertices order of SMPL is constant for many different implementation of SMPL.
from smplx.
@ikvision How did you do that? Can you explain me the steps and code changes if there are any?
from smplx.
@ikvision interesting,you mean the uv map that being used by the origin smpl model can be correctly adapted by smplx?
Can you show me some result of your smplx rendering result after add some texture image?
from smplx.
@ikvision I dont know whether your code is wrong or my understanding is ambiguous,may be you mean SMPL but not SMPLX,because the uv table adpated from original smpl model is the dimension of 6890,which is the number of vertices of original smpl model,but SMPLX has 10475 vertices,so when I run your code and take vertics and face from SMPLX, python told me array is out of boundary,which could not being used
from smplx.
@ikvision I dont know whether your code is wrong or my understanding is ambiguous,may be you mean SMPL but not SMPLX,because the uv table adpated from original smpl model is the dimension of 6890,which is the number of vertices of original smpl model,but SMPLX has 10475 vertices,so when I run your code and take vertics and face from SMPLX, python told me array is out of boundary,which could not being used
Indeed I was referring to SMPL model of 6890 used in SMPLX as part of the SPIN project https://github.com/nkolot/SPIN/blob/277892a91e74af004c74457cd294bd102972f9b0/models/smpl.py#L23
from smplx.
Thanks @ikvision that's very interesting. Do you know where I can find image files of texture?
from smplx.
@fabienbaradel a simple vertices texture for SMPL can be found in:
facebookresearch/DensePose#116 (comment)
More diverse textures are part of surreal:
https://github.com/gulvarol/surreal/blob/master/download/files/files_smpl_data.txt
from smplx.
Thanks @ikvision for your answer :)
from smplx.
now smplx support texture map and did have texture coordinate。@fabienbaradel
from smplx.
Nice, @quyanqiu do you know where I can download the corresponding uv_map for SMPLX?
from smplx.
@fabienbaradel from their project page https://smpl-x.is.tue.mpg.de/
I see the following files for the uv map:
1] a .obj file which contains two texture variables: vt (11313, 2)
and ft (20908,3)
.
2] a png file which contains the uv map.
I have a different png file. How do I get the corresponding ft
?
from smplx.
alternatively, given I have a png file with the required texture, how do I add this texture to a mesh and visualize it?
from smplx.
alternatively, given I have a png file with the required texture, how do I add this texture to a mesh and visualize it?
@Shreeshail-Hingane found anything on how to create your own image texture?
from smplx.
@haiderasad If you want to create your own texture file (like this file), see this repo: https://github.com/qzane/textured_smplx (though I have not used it personally)
If you already have a .png texture file and want to add this texture to a mesh, you can use the MPI Mesh library (https://github.com/MPI-IS/mesh). The Mesh
class of this library has a .set_texture_image()
method, to which you can pass the .png texture file as argument, and then use the MeshViewer
class to visualize the mesh.
from smplx.
from smplx.
@haiderasad If you want to create your own texture file (like this file), see this repo: https://github.com/qzane/textured_smplx (though I have not used it personally)
If you already have a .png texture file and want to add this texture to a mesh, you can use the MPI Mesh library (https://github.com/MPI-IS/mesh). The
Mesh
class of this library has a.set_texture_image()
method, to which you can pass the .png texture file as argument, and then use theMeshViewer
class to visualize the mesh.
then do the latter step as mentioned in my answer above.
from smplx.
Related Issues (20)
- How to create and save a smplx mesh with pose? HOT 5
- vertex representation of SMPL
- TensorOutput has no 'v_shaped' HOT 2
- Failed to run demo.py with smplx head bun HOT 1
- torch.cat([global_orient, body_pose, RuntimeError: Tensors must have same number of dimensions: got 2 and 3
- what does the use_pca param means in SMPLH model?
- The definition of the pose dimension in smplh format HOT 1
- 'Struct' object has no attribute 'shapedirs'
- Left or right hand coordinate system ?
- About flame model loading
- rotation of rendering smplx mesh.
- mm,mmmmm HOT 1
- 3D joints/Skeleton plot in 3D space HOT 5
- What's the relationship between SMPL joints and input pose body?
- 'bi,ij->bj', [left_hand_pose,self.left_hand_components]),Tensor dimension matching error
- Different UV tables between smplx_uv.obj and blender-addon HOT 2
- vis_correspondences.py can not be found
- How many joints in SMPL-H model ? HOT 1
- Terms and conditions
- Missing SMPL-X versions of some SMPL-H AMASS data files (for converted datasets) HOT 2
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 smplx.