POV-Ray : Newsgroups : povray.text.tutorials : How to create .df3 files : Re: How to create .df3 files Server Time
17 May 2024 12:12:13 EDT (-0400)
  Re: How to create .df3 files  
From: PoD
Date: 3 Sep 1998 14:15:31
Message: <35EECE97.136A@merlin.net.au>
Peter Popov wrote:
> 
> Following myself here with a somewhat important note: by default, in POV +y
> is up  (no "z is up" war, please, here's not the place), and in paint
> programs +y is down, so you'll have to flip the image vertically before
> saving it.
> 
> Here's another way to do df3 files, this time using POV and a graphic
> conversion utility.
> 
> For this example I'll again assume a left-handed coordinate system since
> that's what the df3 file uses. If you use a right-handed one you'll have to
> do the transformations yourself.
> 
> The idea is that you place some objects in the unit cube and render and
> animation that slices into the cube in the positive z direction. I'll do a
> blobby example here but you can use just about anything. Remember, keep
> everything in grayscale, because the df3 format uses only one byte for each
> voxel density.
> 
> Here's file df3make.pov
> 
> // -------------------- code ---------------------
> 
> #include "colors.inc"
> #default { finish { ambient 1 } }
> intersection
> {
>   blob
>   { threshold 0.425
>     sphere { <0.45,0.5,0.5>, 0.5, 0.475 }
>     sphere { <0.2,0.7,0.3>, 0.3, 0.4 }
>     sphere { <0.6,0.3,0.7>, 0.2, 0.35 }
>   }
> 
>   plane { -z, -clock+0.00001 }
>   plane { z, clock+0.00001 }
>   texture
>   { pigment { White }
>     finish { ambient 1 }
>   }
> }
> 
> camera { location <0.5,0.5,-2> up y right x look_at <0.5,0.5,0> angle 30
> orthographic }
> 
> // -------------------- end code --------------------
> 
> I render this with the +kff49 +w50 +h50 option to make a 50x50x50 df3. The
> +w option determines the x size of the df3, +h is y and +kff is z. Use
> whatever resolution suits you but do not touch camera settings to correct
> aspect ratio. Remember that the density_file is fit into the unit cube?
> 
> OK, so what you've got now are 50 files calles df3mak00.tga, df3mak01.tga
> ... df3mak49.tga. Pass them to a batch process of a graphic conversion
> utility that can convert them to grayscale, flip them vertically and save
> them as raw. I use Photoshop actions, DOS loop features, or a program my
> brother made called "for_each". Then you make the header in a separate
> 6-bytes file using the method I suggested, a binary editor, a program you
> made or whatever can come up with (maybe even POV 3.1's file functions).
> Glue the files in the appropriate order (header first, then the files sorted
> by name) and your df3 is ready.
> 
> This method is easier than the first one since you can actually model your
> df3 in POV. I hope this selps and I am looking forward for posted pictures!
> 
> Peter

Funny that this thread should appear just now, I was going to post a
little proggy that assembles a series of TGA files into a df3 yesterday
but couldn't get into this news sever.

This program reads a series of 24bit uncompressed TGAs and makes a df3
file. Note it doesn't do any checking at the moment but if you use POV
to make the TGAs then they will be legal ;)
The EXE is Win32 console but the source is there, it should work in DOS,
not sure about other OSs.
I'd forgotten about the upside down coords but then my converter is too
dumb to do anything about that anyway :)

Cheers, PoD.


Post a reply to this message


Attachments:
Download 'tga2df3.exe.dat' (49 KB) Download 'us-ascii' (3 KB)

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