VRML with STRUVIR
Last modified September, 1996 - Armel
Le Bail
Content
Generalities, Rendering, Perspective, Colors
VRML produced by STRUVIR is compatible with VRML 1.0 specifications, identified
by the first line in .wrl files :
#VRML V1.0 ascii
Rendering
Two VRML files are produced by STRUVIR, however three rendering possibilities
are available :
po.wrl with a
polyhedral rendering :
wi.wrl with a
wireframe rendering :
Showing po.wrl
through the wireframe VRML Viewer option gives a different picture :
TOP
Perspective
About perspective, no VRML viewer allows to change it by a button like
the 'lamp' button allows to modify the light. Unfortunately, the default
perspective is not always adequate.
Default view of a supraconductor
as prepared by STRUVIR on the left and with perspective modified by editing
the .wrl file on the right :
The secret is that the following lines have been added (see the VRML
1.0 specification), compare ybapo.wrl and ybapo2.wrl
:
PerspectiveCamera {
position 0 10 120
heightAngle 0.2
}
TOP
Colors
You may play with colors at two independent levels for the HPGL/PS outputs
and VRML/POVray outputs.
For VRML/POVray, twenty colors are available. The choice depends on
the atom name order in the datafile.
The following example has 3 different atom-types CO (Co), S and O. They
will be attributed colors number 1, 2 and 3 respectively accorfing to a
predefined list given below. If polyhedra (octahedra,
tetrahedra or 'bizarre') are recognized around CO, they will be drawn with
color attributed to CO (not the color attributed to O).
TITL CoSO4 H2O C2/C
CELL 6.963 7.580 7.470 90. 116.30 90.
SPGR C 2/C
FORM 4
VIEW 0 1 0
XYZR -0.25 2.25 -0.25 2.25 -0.25 2.25
OCTA 90 20 2.05 0.25
TETR 109. 20. 1.5 0.2
PARA 1 1 1 1 1 1 1 2.6
END
CO 1 0.25 0.25 0.0 Color 1 (first atom-type)
S 1 0.0 0.093 0.25 Color 2 (second atom-type)
O 1 0.203 -.017 0.362 Color 3 (third atom-type)
O 2 0.021 0.196 0.104 Color 3 (third atom-type)
O 3 0.0 0.615 0.25 Color 3 (third atom-type)
Changing colors is possible by changing the atoms order. For instance if
you want SO4 tetrahedra drawn with color 4, and CoO6 octahedra with color
5, this is possible by :
OA 1 0.203 -.017 0.362 Color 1
OB 2 0.021 0.196 0.104 Color 2
OC 3 0.0 0.615 0.25 Color 3
S 1 0.0 0.093 0.25 Color 4
CO 1 0.25 0.25 0.0 Color 5
Compare the STRUVIR po.wrl
results from files cso4h.dat and cso4h2.dat,
here as viewed by VRweb :
It will be difficult, but not impossible to play with more than 5 colors
with this example.
And the 20 colors (care no more) are :
R G B
1 Blue sky 0.0 1.0 1.0
2 Green light 0.5 1.5 0.0
3 Red pyrope 1.0 0.1 0.5
4 Yellow 1.0 1.0 0.0
5 Blue grey 0.6 0.6 1.0
6 Orange 1.0 0.6 0.0
7 Purple 0.5 0.0 0.5
8 Brown 0.5 0.3 0.0
9 Blue-green-dark 0.0 0.5 0.5
10 Red 1.0 0.0 0.0
11 Green 0.0 1.0 0.0
12 Blue 0.0 0.0 1.0
13 Pink 1.0 0.0 1.0
14 Red dark 0.5 0.0 0.0
15 Green dark 0.0 0.5 0.0
16 Blue night 0.0 0.0 0.5
17 Red wine 0.5 0.05 0.25
18 White 1.0 1.0 1.0
19 Grey 0.5 0.5 0.5
20 Black 0.0 0.0 0.0
Colors for the HPGL output are those defined by the COLO
instruction.
TOP
Choosing a VRML Viewer
Due to the non-optimization of the VRML produced by STRUVIR, only a few
VRML viewers are recommended here. Essentially, these viewers should enable
two-sided polygon lighting. If not, polyhedra may appear as not fully facetted
with parts shown in wireframe and the rendering will change according to
the orientation. Note that VRML vewers can be standalone (VRweb...) or
plugged in a browser (Live3D...). A browser like Netscape 3.0 standard
includes yet Live3D. To Microsoft Internet Explorer 3.0, you may add the
MS VRML add-in, however IE 3.0 works with Live3D too. On another hand,
Netscape 3.0 and IE 3.0 can be configured to call VRweb when a .wrl file
is loaded. See the VRML repository browsers/viewers
list.
In spite of clear specifications in VRML
1.0, viewers really do not show the same result on your screen. Try
your own VRML viewer on the test file below, look
inside the source file to understand the test and compare with the following
results where two views rotated 180° are shown :
Netscape 3.0 with Live3D (entry
view on the left and rotated 180° along y on the right) :
VRweb, automatic mode
VRweb, enabling double-sided
polygons :
VRweb, enabling single-sided
mode :
GLView :
A STRUVIR
VRML file viewed by VRweb, double-sided (left) and single-sided (right)
Live3D working with Microsoft
Explorer 3.0 (left)
compared to Live3D working
with Netscape 3.0 (right) :
A difference no visible above is that MS IE 3.0 + Live3D works really
much faster than Netscape 3.0 + Live3D !
GLview running standalone on
the po.wrl file prepared by STRUVIR from abw.dat :
Other VRML viewers results with STRUVIR files (but note that in case
of poor results, the fault is not due to the viewer but is due to STRUVIR
doing bad VRML, or is due to me not having well understood the viewer commands)
:
-
The Microsoft VRML add-in will show single sided polygons without any option
for enabling double-sided polygons.
-
Cosmo Player from SGI will show absolutely nothing.
-
.....
Conclusion : Live3D, VRweb or GLView
(possibly others) will do the job either called by Netscape 3.0 or Microsoft
IE 3.0 or running standalone (at least for VRweb and GLview).
TOP
Saving 2D Views
All of the above pictures are 2D views saved as .gif files from screen
copies at 640x480 monitor resolution. Under Windows 95, screen copy is
really easy. The Microsofr Quickres software is useful for a quick change
in the resolution:
Of course if you need quality, select your maximum screen resolution.
Then push the 'screen copy' keyboard button. The next step depends on which
graphics software you possess.
Generally I save the final views in 1280x1024 resolution. Then I paste
the result into LView 3.1 or Paint Shop Pro in order to cut useless parts
of the screen copy and to add text, axes, labels and so on. Eventually
I insert the .gif or .jpg resulting file into MS WORD 6.0 or 7.0 to scale
and print a final figure for publication (see one example
as gif file). It is possible also to paste directly the screen copy
into MS WORD.
QUALITY
Viewer saving possibilities.
Few viewers offer intrinsic file saving of the 2D projections :
-
GLView 2.09
has a 'render to files' option. The drawings may be saved as bitmaps (.bmp)
with up to 2048x2048 resolution, 16M colors. To give an idea, a test made
to save a .bmp in such a way with 2000x1600x16M colors led to a 9Mo file.
The file reduced to 3Mo passing to 256 colors, 340Ko as a .gif. Try it
(commercial, demo downloadable) if you have a big PC.
Screen Capture. In VRML, you depends
on the viewer possibilities. The best would be that viewers allow saving
vectorized drawings but to my knowledge none has this option up to now.
You may instead use the STRUPLO/STRUVIR HPGL or Postscript options with
which at least a thousand figures were published in solid state chemistry
literature. But these drawings are wireframe only. You may try the POV-Ray
option. However using POV-Ray requires some expertize, but high quality
results should be obtained as big .tga files.
Now, the quality of the results by screen copy will also depend a lot
on your viewer rendering options. The 1280x1024 resolution is sufficient
(a minimum) in my opinion but if you have access to 1600x1200 the result
may be really nicer. I have attached a zipped file (abw.zip)
containing abw.gif and abw.doc (a MS WORD 7 file).
They were prepared as following (each step is important, operating system
Windows 95):
-
The po.wrl file is the result of the STRUVIR application to the abw.dat
file in the package.
-
It was loaded by Netscape 3.0 + Live3D at 1280x1024 resolution (note that
if you load the file at 800x600 and then change to 1280x1024 by QUICKRES,
you should reload the file... ).
-
It was zoomed (removing toolbars to get more place)
-
The option 'flat shading' was selected and the light was augmented to make
a picture more pale then the screen copy was made. Using 'smooth shading'
may lead to undesirable texture effects at the printing stage.
-
It was loaded into LView3.1 by the paste option. Then the contrast was
enhanced by 10%. This eliminates the grey background. The useless edges
were cutted. Then the abw.gif file was saved.
-
It was loaded into WORD 7, inside a box and printed, saved as abw.doc.
If you look at abw.doc (I hope you have WORD 7 or the possibility to import
MS WORD .doc files - try WORPAD) with 800x600 resolution, of course the
printed file will be better than what you will see on the screen.
So, try to print it directly on a laser printer (black and white or color)
or a color inkjet with high quality paper (and try to do it yourself from
the beginning with abw.dat to see if you obtain a similar result). This
is what I call 'just sufficient for publication' and some publishers seem
to agree. Of course this opinion is highly subjective (and also the perspective
is exaggerated and should be modified as explained above in the tutorial).
You should be able to obtain much better results in 1600x1200 (as an
example, look at a polymorph A of zeolite drawing
with STRUVIR by G. L. Price). Care
to the viewer you choose and to all the steps in manipulating the files.
Using another viewer like VRweb or GLview (...), the results may be different.
Best wishes, hope this helps. If yes, give me some feedback, a fortiori
if you find a better way.
TOP
HOME