Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > by-pkgid > 8c84ab5fe0ecd5f81b4e4e07120af05b > files > 513

povray-3.6.1-8mdv2010.1.i586.rpm


<!--  This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004  -->
<html> 
<head>
  
<!--  NOTE: In order to users to help find information about POV-Ray using  -->
 
<!--  web search engines, we ask you to *not* let them index documentation  -->
 
<!--  mirrors because effectively, when searching, users will get hundreds  -->
 
<!--  of results containing the same information! For this reason, the two  -->
 
<!--  meta tags below disable archiving and indexing of this page by all  -->
 
<!--  search engines that support these meta tags.  -->
 
 <meta content="noarchive" name="robots">
   
 <meta content="noindex" name="robots">
   
 <meta content="no-cache" http-equiv="Pragma">
   
 <meta content="0" http-equiv="expires">
   
<title>2.4.4 File Formats</title>
 <link href="povray35.css" rel="stylesheet" type="text/css"> 
</head>
 <body> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_79.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_79.html">2.4.3 Language related things</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>2.4.4 
   File Formats</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_81.html">2.4.5 Utilities, models, etc.</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_81.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 
<h3><a name="s02_04_04">2.4.4 </a>File Formats</h3>

<h4><a name="s02_04_04_01">2.4.4.1 </a>Saving the image to disk.</h4>

<p>
  <em>&quot;I have rendered an image with POV-Ray, but how do I save it to JPG or GIF or any other image format?&quot;</em> 
 
</p>

<p>
  This is a typical problem of people using the Windows version of the program for first time. 
</p>

<p>
  POV-Ray is a raytracer which has only one purpose: To read a source file describing the scene to raytrace and then 
 calculate it and save it to disk in a supported image format, usually TGA (and optionally PNG, BMP, etc). 
</p>

<p>
  POV-Ray has always had this goal, and still has, and will (desirably) never change. It is mostly command-line 
 oriented. It supports non-essential things, like showing the image while it is rendering. 
</p>

<p>
  A GUI does not change anything. POV-Ray is still POV-Ray, with or without GUI. It takes a source code and 
 calculates the image and saves it to disk. By default it shows the image while it is raytracing it, but that is just a 
 secondary feature, non-essential, irrelevant. It can be turned off and POV-Ray will still make its job. 
</p>

<p>
  So the answer to the question is: The image <strong>is already saved</strong> on disk. 
</p>

<p>
  Usually it is saved in TGA or BMP format (it depends on the settings) with the same name as the source code (so if 
 the source is named <code>CHAIR.POV</code>, the image will be named <code>CHAIR.TGA</code> or <code>CHAIR.BMP</code> 
 or whatever). The location is either the same directory where the <code>.pov</code>-file is or else a common directory 
 for images (which you can set up in the main povray.ini file). 
</p>

<h4><a name="s02_04_04_02">2.4.4.2 </a>Can I convert my POV-Ray scenes to another format?</h4>

<p>
  (Answer by Johannes Hubert) 
</p>

<p>
  For POV-Ray 2.2: Try <a href="http://www.europa.com/~keithr/crossroads" target="new">Crossroads</a> or if you want 
 to convert to Moray MDL files, try <a href="http://www.tb-software.com/" target="new">POV2MDL</a> from Thomas Baier. 
</p>

<p>
  For POV-Ray 3.1 and newer: There is unfortunately not much you can do. There is no real versatile program yet, that 
 can read (and convert) POV-Ray 3.1 scripts (except for POV-Ray itself :-). Your best shots would be: <a href="http://www9.informatik.uni-erlangen.de/~cnvogelg/pov2rib/index.html" target="new">POV2RIB</a> 
 if you want to convert to the RIB format. If you know how to program C++, you can get the ParPov C++ library from the 
 same URL. It is a class-library for reading POV 3.1 scripts and converting them to C++ objects (it also has been used 
 for POV2RIB). 
</p>

<p>
  3DWin from Thomas Baier (see the URL above) converts from the POB format to a lot of other formats. POB is a 
 special binary POV-Ray format devised by Thomas and is written by a custom-compile version of POV-Ray 3.0 (get the 
 POB-SDK at the same URL): This POV-Ray version reads POV-scripts and outputs POB files, which can then be converted by 
 3DWin. The drawback: Although all objects, textures etc. of the scene are in the POB file, they are not all recognized 
 by 3DWin. Only triangles and meshes of triangles are recognized. Everything else in the scene is lost.... 
</p>

<h4><a name="s02_04_04_03">2.4.4.3 </a>How can I convert my scenes from format X to POV-Ray format?</h4>

<p>
  <a href="http://www.europa.com/~keithr/crossroads" target="new">Crossroads</a> can convert a very limited subset of 
 Povray primitives (spheres and triangles work best). Particularly, it can be used to convert unions of regular (non 
 smooth) triangles to other formats. 
</p>

<p>
  Another option is <a href="http://www.tb-software.com/" target="new">3DWin</a>. 
</p>

<h4><a name="s02_04_04_04">2.4.4.4 </a>How do I import all of my textures I created in 3DS Max into POV-Ray?</h4>

<p>
  As POV-Ray supports UV-mapping, textured objects used by renderers such as 3D-Studio can be used by first 
 converting them with a proper converter. You can find a list of converters and other related software in the <a href="http://www.povray.org/links/3D_Programs/Conversion_Utilities/" target="new"> 
 links collection on our website</a>. 
</p>

<h4><a name="s02_04_04_05">2.4.4.5 </a>How can I avoid artifacts and still get good JPEG compression?</h4>

<p>
  (Answer by Peter J. Holzer) 
</p>

<p>
  First, you have to know a little bit about how a picture is stored in JPEG format. 
</p>

<p>
  Unlike most image formats it does not store RGB values, but YUV values (1 grayscale value and two &quot;color 
 difference&quot; values) just like they are used in a color TV signal. Since the human eye uses mostly the gray values 
 to detect edges, one can usually get away with storing the color information at a lower resolution - an 800x600 JPEG 
 typically has only grayscale information at 800x600, but color information at 400x300. This is called supersampling. 
</p>

<p>
  For each color channel separately, the picture is then divided into little squares and the cosine transform of each 
 square is computed. A neat feature of this transformation is that if you throw away only a few of the values, the 
 quality will degrade very little, but the image will compress a lot better. The percentage of values stored is called 
 the quality. 
</p>

<p>
  Finally, the data is compressed. 
</p>

<p>
  Most programs only let you change the quality setting. This is fine for photos and photorealistic renderings of 
 &quot;natural&quot; scenes. Generally, quality values around 75% give be best compromise between quality and image 
 size. 
</p>

<p>
  However, for images which contain very saturated colors, the lower resolution of the color channels causes visible 
 artifacts which are very similar to those caused by low quality settings. They can be minimized by setting an 
 extremely high quality (close to 100%), but this will dramatically increase the file size, and often the artifacts are 
 still visible. 
</p>

<p>
  A better method is to turn off supersampling. The higher resolution will cause only a modest increase in file size, 
 which is more than offset by the ability to use a lower quality setting. 
</p>

<p>
  The cjpeg command line utility (which should be available for all systems which have a command line, e.g., Linux, 
 MS-DOS, Unix, ...) has an &quot;-sample&quot; to set the sampling factors for all passes. 
</p>

<pre>
        cjpeg -sample 1x1,1x1,1x1 -quality 75 -optimize
</pre>

<p>
  should be good default values which have to be changed only rarely. 
</p>

<h4><a name="s02_04_04_06">2.4.4.6 </a>Why are there no converters from POV to other formats?</h4>

<p>
  <em>&quot;Why are there so many converters from other 3D file formats to POV, but practically no converters from 
 POV to other formats?&quot;</em> 
</p>

<p>
  It is a mistake to think that a POV-Ray file is just the same kind of data file as in most other renderers. 
</p>

<p>
  The file format of most renderers is just a data file containing numerical values (vertex coordinates, triangle 
 indices, textures, uv-coordinates, NURBS data...) describing the scene. They usually are very little more than just 
 numerical data containers. 
</p>

<p>
  However, POV-Ray files are much more than just data files. POV-Ray files are actually source code of the POV-Ray 
 scripting language. The POV-Ray scripting language is by many means a full programming language (it is Turing-strong). 
 It contains many features typical to programming languages and non-typical to data files (such as variables, loops, 
 mathematical functions, macros, etc). It has many features to describe things in a much more abstract way than just 
 plain numbers. 
</p>

<p>
  This is why converting a POV-file to a data file readable by other renderers is so difficult. The converter program 
 would actually have to &quot;execute&quot;, that is, interpret the scripting language (in the exact same way as a 
 BASIC or Perl source code is interpreted). Making a scripting language interpreter is a much more laborious job than 
 just converting numerical data from one format to another. 
</p>

<p>
  There is also another problem: POV-Ray describes most of its objects as mathematical entities while most of other 
 renderers just handle triangles (or NURBS or similar easily tesselable primitives). A converter would have to make 
 some tesselation in order to convert most POV-Ray primitives to other formats. This can be a quite laborious job for a 
 converter to make (it would have to practically implement an almost fully-qualified POV-Ray renderer). 
</p>

<p>
  This is why making a full-featured converter from any POV-file to any other format is an almost impossible task. 
</p>

<h4><a name="s02_04_04_07">2.4.4.7 </a>Why are triangle meshes in ASCII format?</h4>

<p>
  <em>&quot;Why are triangle meshes in ASCII format? They are huge! A binary format would be a lot smaller. If 
 POV-Ray can read binary images, why can it not read binary mesh data?&quot;</em> 
</p>

<p>
  It is not as simple as you may think. 
</p>

<p>
  You cannot compare binary mesh data with image files. Yes, images are binary data, but there is one big difference: 
 Image files use <strong>integer</strong> numbers (usually bytes, in some cases 16-bit integers), which can be easily 
 read in any system. 
</p>

<p>
  However, meshes use <strong>floating point</strong> numbers. 
</p>

<p>
  It might come as a bit of surprise that it is far from easy to represent them in binary format so that they can be 
 read in every possible system. 
</p>

<p>
  It is very important to keep in mind that POV-Ray is intended to be a very portable program, which should be 
 compilable in virtually any system with a decent C compiler. This is not just mumbo-jumbo; POV-Ray IS used in a wide 
 variety of operating systems and computer architectures, including Windows, MacOS, Linux, (Sparc) Solaris, Digital 
 Unix and so on. 
</p>

<p>
  The internal representation of floating point numbers may differ in number of bits and bits reserved for each part 
 of the number inside the data type in different systems. There is also the infamous big-endian/low-endian problem 
 (that is, although the floating point numbers were identical in two different systems, they may be written in 
 different byte-order when writing to a file). 
</p>

<p>
  If you try to make carelessly a patch which reads and writes floating point numbers in binary format, you will 
 probably quickly find that your patch only works in a certain architecture only (eg. PC) and not others. 
</p>

<p>
  In order to store floating point numbers so that they can be read in any system, you have to store them in an 
 universal format. ASCII is as good as any other. 
</p>

<p>
  However, you are not completely out of luck when dealing with compressing mesh data. <a href="http://www.geocities.com/ccolefax/pcm.html" target="new">This 
 has been done before</a>. 
</p>

<p>
  Since version 3.5, POV-Ray supports a new type of mesh (called mesh2) which stores the mesh data in a more compact 
 format (similar to the one used in the PCM format described in the abovementioned link, but with a bit more 'syntax' 
 around it). 
</p>
 <br> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_79.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_79.html">2.4.3 Language related things</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong>2.4.4 File Formats</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_81.html">2.4.5 Utilities, models, etc.</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_81.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 </body> </html>