Giter Site home page Giter Site logo

Comments (21)

neonb88 avatar neonb88 commented on August 17, 2024 3

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.

ikvision avatar ikvision commented on August 17, 2024 2

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.

vchoutas avatar vchoutas commented on August 17, 2024 2

@MAOYALI Right now SMPL-X has no texture map. I will update the Readme should one be created.

from smplx.

quyanqiu avatar quyanqiu commented on August 17, 2024 2

@fabienbaradel from their project page https://smpl-x.is.tue.mpg.de/

from smplx.

quyanqiu avatar quyanqiu commented on August 17, 2024

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.

ikvision avatar ikvision commented on August 17, 2024

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.

AIdeveloper-oz avatar AIdeveloper-oz commented on August 17, 2024

@ikvision How did you do that? Can you explain me the steps and code changes if there are any?

from smplx.

quyanqiu avatar quyanqiu commented on August 17, 2024

@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.

quyanqiu avatar quyanqiu commented on August 17, 2024

@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 avatar ikvision commented on August 17, 2024

@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.

fabienbaradel avatar fabienbaradel commented on August 17, 2024

Thanks @ikvision that's very interesting. Do you know where I can find image files of texture?

from smplx.

ikvision avatar ikvision commented on August 17, 2024

@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.

fabienbaradel avatar fabienbaradel commented on August 17, 2024

Thanks @ikvision for your answer :)

from smplx.

quyanqiu avatar quyanqiu commented on August 17, 2024

now smplx support texture map and did have texture coordinate。@fabienbaradel

from smplx.

fabienbaradel avatar fabienbaradel commented on August 17, 2024

Nice, @quyanqiu do you know where I can download the corresponding uv_map for SMPLX?

from smplx.

hshreeshail avatar hshreeshail commented on August 17, 2024

@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.

hshreeshail avatar hshreeshail commented on August 17, 2024

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.

haiderasad avatar haiderasad commented on August 17, 2024

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.

hshreeshail avatar hshreeshail commented on August 17, 2024

@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.

haiderasad avatar haiderasad commented on August 17, 2024

from smplx.

hshreeshail avatar hshreeshail commented on August 17, 2024

@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.

then do the latter step as mentioned in my answer above.

from smplx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.