[Chimera-users] Exporting STL/COLLADA/OBJ with textures

Healey, Joe J.R.J.Healey at warwick.ac.uk
Mon Jun 25 11:23:02 PDT 2018


Hi Tom,


OK, thanks that makes much more sense now. I'm looking to somewhat automate the process of converting between PDBs and conventional modelling formats. With a tool like meshlab, the vertex colours can be copied on to the faces reasonably easily, but I was wondering if there is a way this could be done directly on the XML files in the COLLADAs, so that a second program didn't have to be used.


If you've any other thoughts about the best way to approach this I'd be grateful.


Joe Healey


M.Sc. B.Sc. (Hons) MRSB
PhD Student
MOAC CDT, Senate House
University of Warwick
Coventry
CV47AL
Mob: +44 (0) 7536 042620  |  Email: J.R.J.Healey at warwick.ac.uk

Jointly working in:
Waterfield Lab<http://www2.warwick.ac.uk/fac/med/research/tsm/microinfect/staff/waterfieldlab/> (WMS Microbiology and Infection Unit)
and the Gibson Lab<http://www2.warwick.ac.uk/fac/sci/chemistry/research/gibson/gibsongroup/> (Warwick Chemistry)

Twitter: @JRJHealey<https://twitter.com/JRJHealey>  |  Website: MOAC Page<http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey> | ORCID: orcid.org/0000-0002-9569-6738
________________________________
From: Tom Goddard <goddard at sonic.net>
Sent: 25 June 2018 18:42:06
To: Healey, Joe
Cc: chimera-users at cgl.ucsf.edu BB
Subject: Re: [Chimera-users] Exporting STL/COLLADA/OBJ with textures

Hi Joe,

  As web searches will indicate, OBJ file format does not support vertex colors.  Triangle faces can be colored with a MTL file, but to color each triangle a different color will make immense files.  The materials in the MTL file are usually used to make an entire object a single color.  Chimera does not create or read MTL files.  Chimera does not use triangle coloring, it uses vertex coloring where the color smoothly varies across the triangle.  More commonly 3D formats and generic 3D scene software (e.g. Blender) use textures instead of vertex colors.  Texture coordinates (u,v) are given for each vertex and the color is looked up in a texture image using u,v as the x,y coordinates in the image.  Since Chimera does not use textures it does not have the u,v coordinates for the vertices.  It is not easy to make the texture coordinates because you usually want them to have continuity across the surface.  Without continuity, for instance if you just assign random u,v to lookup a color in an image you run into the problem that the u,v values are interpolated across a triangle which leads to a rainbow of colors as the texture image is interpolated from u1,v1 at one vertex to a far away u2,v2 at another vertex of the same triangle.

  In short you aren’t going to get vertex colors from the OBJ format that does not support vertex colors.  While other formats like Collada support vertex colors, a lot of software just ignores those and only handles texture coloring.

Tom


On Jun 25, 2018, at 4:48 AM, Healey, Joe <J.R.J.Healey at warwick.ac.uk<mailto:J.R.J.Healey at warwick.ac.uk>> wrote:

Hi Elaine,

Ok thank you. DAE do indeed seem to render the colours properly as I can see them in Mac Preview, though seemingly not in other tools as you say.

I don't suppose there is any way for chimera to write the colours out as an MTL file since this seems to be the approach other tools take.

I'm not very familiar with these file formats, but it seems to have something to do with colours being applied on vertices but not faces.

Any more info you have would be appreciated.

Thanks,

Joe

Joe Healey


M.Sc. B.Sc. (Hons) MRSB
PhD Student
MOAC CDT, Senate House
University of Warwick
Coventry
CV47AL
Mob: +44 (0) 7536 042620  |  Email: J.R.J.Healey at warwick.ac.uk<mailto:J.R.J.Healey at warwick.ac.uk>

Jointly working in:
Waterfield Lab<http://www2.warwick.ac.uk/fac/med/research/tsm/microinfect/staff/waterfieldlab/> (WMS Microbiology and Infection Unit)
and the Gibson Lab<http://www2.warwick.ac.uk/fac/sci/chemistry/research/gibson/gibsongroup/> (Warwick Chemistry)

Twitter: @JRJHealey<https://twitter.com/JRJHealey>  |  Website: MOAC Page<http://www2.warwick.ac.uk/fac/sci/moac/people/students/2013/joseph_healey> | ORCID: orcid.org/0000-0002-9569-6738<http://orcid.org/0000-0002-9569-6738>
________________________________
From: Elaine Meng <meng at cgl.ucsf.edu<mailto:meng at cgl.ucsf.edu>>
Sent: 23 June 2018 15:46:57
To: Healey, Joe
Cc: chimera-users at cgl.ucsf.edu<mailto:chimera-users at cgl.ucsf.edu>
Subject: Re: [Chimera-users] Exporting STL/COLLADA/OBJ with textures

Hi Joe,
As per the “export” docs...
<http://www.rbvi.ucsf.edu/chimera/docs/UsersGuide/export.html>

COLLADA export includes colors but many readers do not interpret them correctly.
OBJ export is only single color per surface piece.
STL export does not include colors.
X3D, WebGL, ... are more complete and may include what you want.

I hope this helps,
Elaine
-----
Elaine C. Meng, Ph.D.
UCSF Chimera(X) team
Department of Pharmaceutical Chemistry
University of California, San Francisco

> On Jun 23, 2018, at 6:34 AM, Healey, Joe <J.R.J.Healey at warwick.ac.uk<mailto:J.R.J.Healey at warwick.ac.uk>> wrote:
>
> Hi,
> Is it possible for Chimera to somehow export the textures/colour mappings of the models when saving the scene as a .dea/.obj/.stl?
> At the moment I can export the models, including surfaces (with correct transparency) but I haven't found an option for texturing/colouring?
> Cheers
> Joe

_______________________________________________
Chimera-users mailing list: Chimera-users at cgl.ucsf.edu<mailto:Chimera-users at cgl.ucsf.edu>
Manage subscription: http://plato.cgl.ucsf.edu/mailman/listinfo/chimera-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://plato.cgl.ucsf.edu/pipermail/chimera-users/attachments/20180625/d658460f/attachment.html>


More information about the Chimera-users mailing list