POV-Ray : Newsgroups : povray.general : 3.71 patch for binary "mesh3" format : Re: 3.71 patch for binary "mesh3" format Server Time
25 Apr 2024 08:09:45 EDT (-0400)
  Re: 3.71 patch for binary "mesh3" format  
From: Bald Eagle
Date: 23 Aug 2017 07:55:00
Message: <web.599d6ce7e553792dc437ac910@news.povray.org>
I also found this link to be an interesting commentary on POV-Ray and binary
mesh formats:

http://wiki.povray.org/content/Knowledgebase:Files_and_formats#Topic_6

"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 couldn't it read binary
mesh data?
It's not as simple as you may think.
You can't compare binary mesh data with image files. Yes, images are binary
data, but there is one big difference: Image files use integer numbers (usually
bytes, in some cases 16-bit integers), which can be easily read in any system.
However, meshes use floating point numbers.
It might come as a bit of surprise that it's far from easy to represent them in
binary format so that they can be read in every possible system.
It's 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.
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's 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).
If you try to make carelessly a patch which reads and writes floating point
numbers in binary format, you'll probably quickly find that your patch only
works in a certain architecture only (eg. PC) and not others.
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.
However, you are not completely out of luck when dealing with compressing mesh
data. This has been done before. For example check:
http://povrayinclude.wytraven.com/pcm.html
[LINK IS BROKEN - BW]
POV-Ray 3.5 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)."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.