POV-Ray : Newsgroups : povray.text.tutorials : How to create .df3 files : Re: How to create .df3 files Server Time
17 May 2024 13:08:07 EDT (-0400)
  Re: How to create .df3 files  
From: Peter Popov
Date: 3 Sep 1998 10:13:25
Message: <35ee95f5.0@news.povray.org>
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


Post a reply to this message

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