|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> Try this
> http://darren.s3.amazonaws.com/MakeDF3.zip
> About 6.5 meg with the test data in it.
> The big test file was made with makebigtest.tcl, which should be clear to
> any programmer even if they don't know Tcl.
>
> --
> Darren New, San Diego CA, USA (PST)
> There's no CD like OCD, there's no CD I knoooow!
Darren; thanks, I downloaded the package and checked it out a few minutes ago.
Have NOT tried to render out of it yet... just looked at the DF3s (and was
puzzled); I think that there are minor errors, resulting in the wrong file size
for DF3s.
To review; the six byte header in a DF3 file is of the form XX xx YY yy ZZ zz.
NOTE that this is "1-base"... a 10x10x10, 8 bit (one byte per voxel) DF3 will
have the header (in hex):
00 0A 00 0A 00 0A (... or 0 10 0 10 0 10 in base 10).
A 100x100x100 8 bit DF3 header would be (in hex):
00 64 00 64 00 64
From the standard POVray distribution, check out "spiral.df3" (an 8 bit DF3, one
byte per voxel. Used by the "galaxy.pov" media example). The header is:
00 32 00 32 00 05 (in base 10, thats 0 50 0 50 0 5)
.... which is 50x50x5.
If you add it up; 50x50x5 = 12,500. Add 6 bytes for the header, = 12506. And
indeed spiral.df3 is 12,506 bytes long.
When converting XYZ coordinates into an offset for the DF3 file to set data for
a voxel, then it is ZERO-base... rather than 1-base as in the header. If you
have a 50x50x50 8 bit DF3, the header would be 00 32 00 32 00 32. BUT when
calculating coordinates-to-voxel-offset, you need to count it as 0 to 49, not 1
to 50. If an input text file then *assumes* 1 to 50, you have to subtract 1 from
each coordinate before calculating the offset. Otherwise, maybe the text file
assumes zero-to-max, so then you don't have to worry about it.
In your ZIP file, test-position.df3 has the header : 00 62 00 62 00 62
(98*98*98). Okay, 98*98*98 = 941,192. Add 6 bytes for the header = 941198. BUT
test-position.df3 is 950901 bytes long.
bigtest.df3 has a header of 00 81 00 63 00 9F, or 129x99x159. 129*99*159 =
2,030,589; so this is obviously NOT an 8 bit DF3, it looks like a 32 bit
4-byte-per-voxel DF3. Multiply 2,030,589 x 2, for a 16 bit file size. Multiply
it by 2 again for a 32 bit file size. Thats 8,122,356. Add 6 bytes for the
header, = 8,122,362. BUT bigtest.df3 is 8,173,966 bytes long.
I haven't looked at the source(s)...(yet)... but probably this has to do with
calculating the headers, probably NOT using 1-MaxDim in the headers; instead
0-MaxDim-1 was used. OR it is some other error that is occuring when
calculating coords... too many bytes are being written to the DF3s.
bigtest.df3 is 51,604 bytes too long. test-position.df3 is 9703 bytes too long.
.... hope that helps track it down...
Post a reply to this message
|
![](/i/fill.gif) |