(I'm moving this discussion with Bob onto jmol-developers in case 
others want to give their opinion)

Background:

I'm trying to add some features to the VRML exporter. Even I being a 
novice in VRML, I've found that a few things can be done easily 
enough.
Translucency is already in, for atoms, bonds and isosurfaces which 
are the only items currently supported by the exporter.

My next aim: labels, maybe other texts (echo, measure).
For this, I have identified two potential targets in 
_VrmlExporter.java:
   drawString() 
   plotText()

Apparently, the first should be the one called to render labels, but 
right now it's the second that gets called.
One problem with plotText (but maybe too with drawString) is that it 
takes screen coordinates (pixels), as it thinks of rendering a 
snapshot of the Jmol screen (e.g. for POV-Ray it works so). That is 
not good for VRML, since the labels are shown far away from the atoms 
and the model (which are coded in angstroms).
The way I see it, the VRML exporter needs to clone the objects, not 
the image, so that the model can be rotated in the vrml viewer.

Now to the point:


El 14 Jan 2009 a las 10:37, Robert Hanson escribió:

> Well, Angel, I'm looking forward to seeing how you handle this! My
> concern with POV-Ray was that the result was as close as possible to
> an exact rendering, so that's why I needed to rasterize the fonts in
> Jmol and send out pixels.

Yes, POV-Ray is basically an image. VRML is a 3D world, and has a 
tool to specify text using the string, the font style, size and 
color. So we should NOT be rasterizing them for vrml, but just using 
the tool.


> You mention thinking about fonts later, but I recommend thinking about
> them right now. Here are some starting points. Get these design
> decisions as much as possible answered now, and we can see how to make
> Jmol do what you want to do.

Right now, I have a hard-coded font style and I am checking how to 
have the label text located at its proper place (That's what I meant 
by leaving fonts for later on). Then I want to substitute the 
hardcoded style for the one Jmol dictates, as far as possible.

 
> To what extent does the font in Jmol need to match the font in VRML?

Not much, I think. Font face (serif/sans/fixed)  looks easy to match. 
Font color too. Font size is not, since vrml text is sized in 
angstroms, not pixels. But we could go for a hardcoded size as a 
decent solution (I have 0.5 angstroms right now).


> Is it important that the font stays visible to the reader in VRML, or
> does it rotate with the structure? -- so does VRML support that sort
> of thing, or when you rotate the structure, the fonts rotate with it?

Yes, by default it tilts and rotates, a very ugly effect imho, to the 
extent of becoming invisible from certain angles (since the text 
object has zero thickness). But I have already found the solution for 
that: the font can be given a flat color, no shininess or lighting 
effects, and remain front-viewed all the time while the model is 
rotated.

 
> How do you want to handle the offsets, which are in 2D pixels, not XYZ
> coordinates?

I guess you mean labelOffset. I'd go for a fixed offset (+0.2A in X 
and Y looks good for ball&stick, though of course high spacefill 
settings will obscure the label). Something else would be difficult, 
if at all possible. There is always the choice to edit the resulting 
vrml file (those that are REALLY interested in vrml will have an 
editor, I guess; chaging a parameter for an existing obejct seems 
easy enough even in plain-text editor; not so identifying wich sphere 
is the atom I'm interested in and adding a text label close to it 
from scratch).

The idea is that when some atoms are labeled, we can get some sort of 
label for them in the vrml, even if not precisely identical in all 
features.


> Once we understand the design constraints, we can make Jmol fit the design.
> 
> Bob
> 
> 
> On Wed, Jan 14, 2009 at 5:00 AM, Angel Herráez <[email protected]> wrote:
> > Thanks, Bob
> >
> >> Yes, drawString is the method.
> >
> >> and in the VRML exporter I see:
> >>
> >>   public void plotText(int x, int y, int z, int argb,
> >>                        String text, Font3D font3d) {
> >>   }
> >
> > When I put the code here it DOES get called by labels.
> > However, the x y z seem to be in screen coordinates (pixels), which is not 
> > good for vrml. I'd
> > need system coordinates, as in atom-spheres.
> 
> That's a problem.


As an alternative, could we have each label report in Java to which 
atom it is attached? Then I think we could make the vrml text 
positioned relative to the vrml atom, rather than to the label 
position in Jmol. Even to associate the text object to the sphere 
object (which looks rather neat design-wise, and then the coordinates 
of the text are relative).


> >> Text3D.plot does the pixelation. You would instead write some
> >> VRML-specific method of plotting the text.
> >
> > Yes, we don't want pixels here, just the xyz coordinates and the text 
> > string (I'll try to take
> > care of fonts later).
> 
> that's the issue. Focus on that now. It has to be perfect. :)

As I said, I see position and color as the key issues. The font style 
may be approximate.



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to