From: John Stone (johns_at_ks.uiuc.edu)
Date: Thu Sep 19 2019 - 10:35:35 CDT

Walter,
  Up to this point there haven't been many scene file formats that
implement 3-D texture mapping, which is the method that VMD uses
to color all molecular geometry, isosurfaces, and imported meshes
by volumetric properties such as electrostatic potentials. VMD
uses 3-D texture mapping due to its efficient implementation on
GPUs (going back more than a decade) and due to its universality,
since it can be applied to spheres and other non-triangle-mesh
geometric primitives.

If I recall correctly, at present it may be only Tachyon and POV-Ray that
actually support full 3-D texture mapping in their scene file formats.

A workaround for file formats that lack 3-D texturing would be to
add some sort of stopgap fallback code path to the VMD file export
code that would be triggered when 3-D texturing is unavailable.
This stopgap code path would not be able to correctly handle replacement
of 3-D texturing on non-triangle-mesh geometry, but it could be made
to catch the specific case that you're interested in. Rather than
getting a white/gray surface mesh, I could cause VMD to compute
per-vertex colors internally and emit a triangle mesh with vertex
colors assigned as they would have been via 3-D texture mapping.
The resulting mesh still will not look the same as it would in VMD,
as you would be missing the texels in the interior of the
triangles in the mesh (most of the time the potential map and
surface meshes don't have identical grid spacing), but this would
give you "something" rather than "nothing" as it stands for these
kinds of cases currently.

The Wavefront OBJ format is a poor choice in general because it
doesn't support per-vertex colors/materials. You would end up with
a very patchy looking electrostatic surface if you used that format.

The X3D format and a few others DO support per-vertex colors and
are generally better choices for this kind of scene.

To my knowledge the .u3d format used by PDF importers does
not support 3-D texture mapping, but it probably does support
per-vertex colors. So in principle, if I could engineer the workaround
I describe above, it should become possible to emit something in
X3D format that you could then convert to .u3d.

I will see if there's a way to implement the workaround I describe
without having to tear apart the existing back-end renderers. I'm hoping
that it can be done by an on-the-fly conversion step in one of the
top level scene traversal routines in the FileRenderer superclass that
all of the individual exporters derive from.

Best,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Sep 18, 2019 at 09:10:18PM +0000, Walter Rocchia wrote:
> Hi,
>
> I would like to export the mesh of a surface created in VMD and colored
> based on a electrostatic potential. The final aim would be to have a 3D
> model on it (e.g. a .u3d format)
>
> I tried most of the output options provided by VMD, including wavefront
> .obj and .mtl files. When the surface is colored with a colorID, it seems
> to work.
>
> In contrast, when I loaded these files in Meshlab, it seemed that the
> information of the color was missing?
>
>
>
> Is there any way to do it correctly?
>
>
>
> Thank you
>
> Walter
>
>
>
> *********************************************************************
>
> Walter Rocchia, PhD, Head
>
> Computational mOdelling of NanosCalE and bioPhysical sysTems - [1]CONCEPT
> Lab
>
> ISTITUTO ITALIANO DI TECNOLOGIA
>
> Via Melen - 83, B Block, 16152 - Genova, Italy
>
> Phone: +39 010 2897418
>
>
>
> References
>
> Visible links
> 1. https://urldefense.proofpoint.com/v2/url?u=https-3A__concept.iit.it&d=DwMGaQ&c=OCIEmEwdEq_aNlsP4fF3gFqSN-E3mlr2t9JcDdfOZag&r=JBqQLS7jZ5whrB0hXJY8MNYcfDrh8UhlGJ2ANxoi8s0&m=IMSOYQxDteyG_ge_qxjPTnX6-k5PSRM7WnsmiyXyAMI&s=H8w19ltzEsfSzCdd6zsxnB8g8xUhmMkVGiCELWlagcw&e=

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/