old-www/LDP/LG/issue27/xfpovray.html

301 lines
13 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; Linux 2.0.30 i486) [Netscape]">
<TITLE>Graphics Muse
</TITLE>
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000FA" VLINK="#FA3333" ALINK="#33CC33">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<!-- =============================================================
This Page Designed by Michael J. Hammel.
Permission to use all graphics and other content for private,
non-commerical use is granted provided you give me (or the
original authors/artists) credit for the work.
CD-ROM distributors and commercial ventures interested in
providing the Graphics Muse for a fee must contact me,
Michael J. Hammel (mjhammel@csn.net), for permission.
============================================================= !--><A NAME="musings"></A>
<TABLE>
<TR>
<TD>
<H2>
More...</H2>
<IMG SRC="../gx/hammel/musings.gif" ALT="Musings" HEIGHT=52 WIDTH=247 ALIGN=LEFT>&nbsp;</TD>
</TR>
</TABLE>
&nbsp;
<TABLE>
<TR>
<TD></TD>
</TR>
</TABLE>
<IMG SRC="../gx/hammel/cleardot.gif" ALT="indent" VSPACE=5 HEIGHT=1 WIDTH=1 ALIGN=LEFT>
<TABLE WIDTH="100%" >
<TR>
<TD ALIGN=RIGHT WIDTH="100%"><FONT SIZE=-2>&copy; 1998 <A HREF="mailto:mjhammel@csn.net">Michael
J. Hammel</A>&nbsp;</FONT></TD>
</TR>
<TR>
<TD VALIGN=TOP BGCOLOR="#000000" cellpadding="0" cellspacing="0"><IMG SRC="../gx/hammel/cleardot.gif" ALT="indent" ALIGN=LEFT></TD>
</TR>
</TABLE>
<A NAME="1"></A>
<H2>
XFPovray 1.2.4/1.3.1</H2>
Recently I was commissioned to work on another cover for the Linux Journal.&nbsp;
The cover will be out in a few months and I don't want to say too much
about it right now, but part of what I needed to do for it was create some
3D text.&nbsp; I've been familiar with how to do this for some time, using
any of a number of tools: AC3D, POV-Ray, Font3D, and so forth.&nbsp; I
have found the quickest 3D text can be created using Font3D and POV-Ray.&nbsp;
The results are generally pretty good.&nbsp; I hope to give you some insight
into Font3D and its XForms front end, XFont3D, next month.
<P>After the fonts were created I needed to run POV-Ray.&nbsp; This is
a terrific command line tool for creating 3D images that uses its own language
for defining a 3D scene.&nbsp; The scene file is fed to the rendering engine
using any combination of the many command line options.&nbsp; The only
real problem with POV-Ray is that is has so many options it is easy to
forget which ones use which particular syntax.
<P>Fortunately, <A HREF="mailto:mallozzir@cspar.uah.edu">Robert S. Mallozzi
</A>has written a very useful XForms based front end to the POV-Ray renderer:&nbsp;
<A HREF="http://cspar.uah.edu/~mallozzir/html/xfpovray.html">XFPovray</A>.&nbsp;
The tool, like many for Linux, is available in source.&nbsp; It requires
the <A HREF="http://bragg.phys.uwm.edu/xforms">XForms</A> v0.88 or later
library and will work with <A HREF="http://www.povray.org">POV-Ray 3.0</A>.&nbsp;
I had been running the 1.2.4 version for the work on the cover art, but
while writing this article I found that Robert had released a newer version.&nbsp;
I downloaded that one and had no problems building it.&nbsp; Its just a
matter of editing 2 files (if necessary), and running <B>xmkf; make; make
install.</B>&nbsp; You'll need to be root to run the default install, since
the Imakefile is set up to install in /usr/local/bin.
<BR>&nbsp;
<CENTER><TABLE BORDER=0 COLS=2 WIDTH="450" NOSAVE >
<TR NOSAVE>
<TD ROWSPAN="2" NOSAVE>
<TABLE BORDER=0 COLS=1 WIDTH="100%" NOSAVE >
<TR>
<TD><IMG SRC="./gx/hammel/xfpovray-1.jpg" HSPACE=10 VSPACE=10 HEIGHT=162 WIDTH=311></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 1: XFPovray v1.3.1 interface</B></TD>
</TR>
<TR NOSAVE>
<TD NOSAVE>The interface to 1.3.1 is a little different from the 1.2.4
version, using a smaller footprint for the initial window.&nbsp; The Render
options are also now in a notebook widget.&nbsp; Overall the interface
is more compact.&nbsp;&nbsp;&nbsp; Unfortunately, I found that something
wasn't quite right with my configuration.&nbsp; At times the menus would
not cause window refreshes when the menu was close, leaving bits of the
menus covering other parts of the underlying windows.&nbsp; This may be
a bug in XForms 0.88, but the 1.2.4 version of XFPovray didn't seem to
have this problem.&nbsp; Because of this, I'm going to review the 1.2.4
version, with just a few comparisons made to the 1.3.1 version.&nbsp; The
features of both are very similar and both versions are available on the
XFPovray web site.&nbsp; If you have problems with the 1.3.1 version you
can grab the 1.2.4 version.&nbsp;</TD>
</TR>
</TABLE>
&nbsp;</TD>
<TD NOSAVE><IMG SRC="./gx/hammel/xfpovray-1b.jpg" HSPACE=10 VSPACE=10 HEIGHT=396 WIDTH=279></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 2:&nbsp; XFPovray 1.2.4 interface</B></TD>
</TR>
</TABLE></CENTER>
XFPovray provides the user the ability to run the POV-Ray renderer on existing
scene files and to edit those files.&nbsp; To edit a scene file you need
to first configure the editor of choice.&nbsp; Select the <I>Options->Configure
</I>menu item from the menu bar of the main window.&nbsp; A dialog will
open allowing you to configure the editor you wish to use, along with the
location of the POV-Ray executable, an image viewer and a number of other
general items.&nbsp; After you click on the Accept button you will need
to use the <I>Options->Save State </I>menu option to save the configuration
to XFPovray's configuration file directory.&nbsp; This wil be $HOME/.xfpovray
by default.
<P>Once you've selected an editor you are ready to edit a file.&nbsp; Click
on the Scene File button to open a dialog box.&nbsp; This button sets the
default scene file to be rendered.&nbsp; You should do this first before
trying to edit any of your include files.&nbsp; The dialog box that opens
is a file selection box.&nbsp; This dialog has changed in the 1.3.1 version
to a format that is a little more standard for such dialogs.&nbsp; Figures
3 and 4 show the two versions of the file selection dialog.
<BR>&nbsp;
<TABLE BORDER=0 COLS=2 WIDTH="100%" NOSAVE >
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-3.jpg" HSPACE=10 VSPACE=10 HEIGHT=355 WIDTH=313></TD>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-4.jpg" HSPACE=10 VSPACE=10 HEIGHT=335 WIDTH=362></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 3:&nbsp; File Selection box for XFPovray
1.2.4</B></TD>
<TD ALIGN=CENTER NOSAVE><B>Figure 4:&nbsp; File Selection box for XFPovray
1.3.1</B></TD>
</TR>
</TABLE>
<P>The Scene File button only establishes the file which will be passed
to the renderer.&nbsp; It does't open the editor on that file.&nbsp; To
open the editor you next choose the Edit Scene button.&nbsp; Again, the
File Selection window opens.&nbsp; In the 1.3.1 version the default file
in this dialog is the file you chose with the Scene File button.&nbsp;
In the 1.2.4 version you start in whatever directory you started XFPovray
in originally.&nbsp; You can edit a file by clicking on it or use the dialog
to choose another file.&nbsp; Once you've selected a file the editor will
open into that file and your ready to do your work.
<P>The View Image button will simply launch an image viewer on a particular
image file.&nbsp; The Config File button will display the configuration
file used for POV-Ray (not for XFPovray).&nbsp; The settings for many of
these can be changed from Render Options (buttons in 1.2.4, a notebook
with tabs in 1.3.1), although there doesn't appear to be a way to save
the changes from the interface.&nbsp; If the defaults are not to your liking,
you can always edit the configuration file (xfpovray.ini) by hand.
<P>The rendering options cover a large number of POV-Ray options, but a
few options are not yet supported (see the web page for details on what
isn't supported).&nbsp; Figures 5 and 6 show the Rendering Options windows
for the two versions of XFPovray.&nbsp; Figure 6 was cropped from the main
window to save a little space.&nbsp; The render options in version 1.2.4
are displayed in the space occcupied by the povray banner image.&nbsp;
Figure 7 shows the tabs in the Render Options window for version 1.3.1.&nbsp;
As you can see, there are quite a few options you can configure from these
windows.&nbsp; Keep in mind that version 1.2.4 has the most of the same
options as 1.3.1, except with 1.2.4 you access them from a set of Render
Options buttons in the main window.
<BR>&nbsp;
<BR>&nbsp;
<TABLE BORDER=0 COLS=1 WIDTH="100%" NOSAVE >
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-5.jpg" HSPACE=10 VSPACE=10 HEIGHT=313 WIDTH=414></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 5:&nbsp; Render Options, version 1.2.4</B></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-6.jpg" HSPACE=10 VSPACE=10 HEIGHT=400 WIDTH=428></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 6:&nbsp; Render Options, version 1.3.1</B></TD>
</TR>
</TABLE>
&nbsp;
<P>Figures 7 and 8 show some of the possible templates you can use when
editing a scene file.&nbsp; Templates are examples of the various primitives
and command syntax you will use in a POV-Ray scene file.&nbsp; To use these
templates, you first select the template you want to add to your scene
file (we're assuming the scene file is already opened and currently being
edited).&nbsp; This copies the template to the primary X selection buffer.&nbsp;
This is the same buffer you use when you highlight some text in an xterm
window.&nbsp; To use the copy of the template you first enter insert mode
in your editor and then use the middle mouse button (or both buttons on
a 2 button mouse that is emulating a 3 button mouse) to paste the selection
into your file.&nbsp; Note that when you select the template from the menus
you won't see any sort of confirmation that the template has been placed
in the selection buffer.
<BR>&nbsp;
<BR>&nbsp;
<TABLE BORDER=0 COLS=1 WIDTH="100%" NOSAVE >
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-templates.jpg" HSPACE=10 VSPACE=10 HEIGHT=299 WIDTH=415></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 7:&nbsp; The solid primitive templates</B></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><IMG SRC="./gx/hammel/xfpovray-templates-2.jpg" HSPACE=10 VSPACE=10 HEIGHT=237 WIDTH=415></TD>
</TR>
<TR NOSAVE>
<TD ALIGN=CENTER NOSAVE><B>Figure 8:&nbsp; Camera primitve templates</B></TD>
</TR>
</TABLE>
&nbsp;
<P>Once you've finished editing the file you can render a preview of the
image.&nbsp; Use the <I>Render Options/Output </I>feature to specify the
size of the preview.&nbsp; You can even use the <I>Inc Preview</I> button
to sample the effects provided by the standard include files!&nbsp; The
preview uses the selected texture, color, or whatever on a sphere.&nbsp;
You can specify the direction of lights and the camera position for the
preview as well.&nbsp; This makes selecting the features to add to an objects
texture much simpler and less error prone.&nbsp; Although there is still
a bit of trial an error involved with creating the textures, you can at
least sample some of the effects quickly and easily.
<P>One last thing you should know before trying XFPovray.&nbsp; I&nbsp;mentioned
earlier that I&nbsp;tried both the 1.2.4 and 1.3.1 versions.&nbsp; If you
run the earlier version first, then upgrade to the 1.3.1 version the program
seems to recognize the differences in the configuration files.&nbsp; However,
if you have problems with 1.3.1 and want to fall back to 1.2.4 you will
need to first clean out the files in the $HOME/.xfpovray directory.&nbsp;
The earlier version will get confused by the changes to the config files
that 1.3.1 uses.&nbsp; Its not a real concern, of course, if you don't
try to back track to from the later to the earlier version.
<P>All in all, XFPovray is quite a useful tool.&nbsp; When I&nbsp;was working
on my 3D text I first generated the include files of the text using Font3D/XFont3D.&nbsp;
After that, I was able to work completely from within XFPovray to sample
the images and experiment with minor changes quickly.&nbsp; I never had
to run the POV-Ray executable by hand, which was a real bonus since I never
can remember the correct command line options.&nbsp; If you do much work
with POV-Ray, I think you'll enjoy using XFPovray as your editing/rendering
front end.
<BR>&nbsp;
<TABLE WIDTH="100%" >
<TR>
<TD VALIGN=TOP COLSPAN="4" BGCOLOR="#000000" cellpadding="0" cellspacing="0"><IMG SRC="../gx/hammel/cleardot.gif" ALT="indent" ALIGN=LEFT></TD>
</TR>
</TABLE>
&nbsp;
<TABLE WIDTH="100%" >
<TR>
<TD ALIGN=RIGHT><FONT SIZE=-2>&copy; 1998 by <A HREF="mailto:mjhammel@csn.net">Michael
J. Hammel</A>&nbsp;</FONT></TD>
</TR>
</TABLE>
&nbsp;
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1998, Michael J. Hammel <BR>
Published in Issue 27 of <i>Linux Gazette</i>, April 1998</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./gm.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->