POV-Ray : Newsgroups : povray.general : density files Server Time
2 Nov 2024 02:16:56 EDT (-0400)
  density files (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Steven Jones
Subject: density files
Date: 20 Mar 2000 16:51:15
Message: <38d69d53@news.povray.org>
How are density (.df3) files made?  This seems like an intriguing feature,
yet the documentation is scarce on this matter.


Post a reply to this message

From: Ken
Subject: Re: density files
Date: 20 Mar 2000 16:59:32
Message: <38D69FA7.2B49D687@pacbell.net>
Steven Jones wrote:
> 
> How are density (.df3) files made?  This seems like an intriguing feature,
> yet the documentation is scarce on this matter.

One way is to use a utility made for this purpose. Look in
povray.binaries.utilities for tga2df3.exe which will convert
a series of tga images files to a .df3 density file.

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Peter Popov
Subject: Re: density files
Date: 20 Mar 2000 21:13:48
Message: <6NnWOIvcpW1kmZeZVAcWeShKa9WC@4ax.com>
On Tue, 21 Mar 2000 08:51:11 +1100, "Steven Jones" <ste### [at] tsncc>
wrote:

>How are density (.df3) files made?  This seems like an intriguing feature,
>yet the documentation is scarce on this matter.

Like Ken mentioned, PoD's utility is one way to make them. I know at
least one more but believe me, you don't want to hear it :) I remember
answering this question a few times but I am too tired to skim through
my outbox right now (4:11 am). If you haven't figured it out by
yourself (the docs say enough actually, but yes, they are cryptic) by
the time I log on again, I'll post a brief explanation.


Peter Popov
pet### [at] usanet
ICQ: 15002700


Post a reply to this message

From: Pabs
Subject: Re: density files
Date: 20 Mar 2000 23:02:10
Message: <38D6F447.4F072217@hotmail.com>
Steven Jones wrote:

> How are density (.df3) files made?  This seems like an intriguing feature,
> yet the documentation is scarce on this matter.

Feel like creating them by hand ??
If so try the following in FRHED http://www.tu-darmstadt.de/~rkibria (Win32
only)
Create a new file that is x*y*z + 6 bytes in length (use the append feature;
extra 6 bytes are for dimensions)
(File->New, Edit->Append)

With the cursor in the first byte enter an unsigned decimal value of word
length that is x
(Home key, Edit->Enter decimal value)
Do the same on the 3rd and 5th bytes for the y and z dimensions

On every byte after the 6th (not-including) add a byte length number (0-255),
which will be the density for that voxel
The x, y and z  positions (1 based indexes) are calculated somehow as follows,
where p = position in the file, a = p - 6, xx,yy&zz are the dimensions of the
volume and floor is a func that returns the next integer below its input
z = floor(p / (xx*yy)) + 1
x = (p mod (xx*yy) ) mod xx
y = floor((p mod (xx*yy) ) / yy)
I think these are right - Anyone else know


Post a reply to this message


Attachments:
Download 'us-ascii' (2 KB)

From: Pabs
Subject: Re: density files
Date: 20 Mar 2000 23:08:05
Message: <38D6F5B2.F67AD690@hotmail.com>
There is a mistake in my formulae
p should be a (p-6)

> z = floor(p / (xx*yy)) + 1
> x = (p mod (xx*yy) ) mod xx
> y = floor((p mod (xx*yy) ) / yy)


Post a reply to this message

From: Nieminen Juha
Subject: Re: density files
Date: 21 Mar 2000 04:30:19
Message: <38d7412b@news.povray.org>
They are pretty simple, but you need to know some programming language
(which is able to write binary files) in order to do one. Currently you
can't do one with povray itself.
  The documentation helps here:

"The df3 format consists of a 6 byte header of three 16-bit integers
with high order byte first. These three values give the x,y,z size of
the data in pixels (or more appropriately called voxels). This is
followed by x*y*z unsigned integer bytes of data. The data in the
range of 0 to 255 is scaled into a float value in the range 0.0 to
1.0. It remains at 0.0 for all areas beyond the unit cube. The pattern
occupies the unit cube regardless of the dimensions in voxels."

  So suppose that you want to create a 64x64x64 density file.
  Open the destination .df3 file for binary writing and write the first
six bytes denoting the dimensions. As the documentation above says,
you should first output a 0 and then a 64, and this three times.
  Now output 64*64*64 values between 0 and 255. 0 means density 0.0 and
255 means density 1.0. The values will form a cube consisting of 64x64x64
smaller cubes (ie. 64 cubes per side).

  For example, if you want to create just a spherical density (density 1
at the center and 0 at the borders) you can do it in this way (with C):

  int XSize=64, YSize=64, ZSize=64;
  int indX, indY, indZ;
  double x, y, z, d;
  FILE* outfile = fopen("sphere.df3", "wb");

  fputc(XSize/256, outfile); fputc(XSize%256, outfile);
  fputc(YSize/256, outfile); fputc(YSize%256, outfile);
  fputc(ZSize/256, outfile); fputc(ZSize%256, outfile);

  for(indZ=0; indZ<ZSize; indZ++)
  {
    z = (indZ*2.0)/ZSize - .5; /* z goes from -1 to 1 */
    for(indY=0; indY<YSize; indY++)
    {
      y = (indY*2.0)/YSize - .5; /* y goes from -1 to 1 */
      for(indX=0; indX<XSize; indX++)
      {
        x = (indX*2.0)/XSize - .5; /* x goes from -1 to 1 */

        d = sqrt(x*x+y*y+z*z); /* distance from origin */
        if(d <= 1) /* if we are inside the unit sphere */
        {
          fputc((char)(255*(1-d)), outfile);
        }
        else
        {
          fputc(0, outfile);
        }
      }
    }
  }
  fclose(outfile);

  (NOTE: This program is untested)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Steven Jones
Subject: Re: density files
Date: 21 Mar 2000 15:20:06
Message: <38d7d976@news.povray.org>
I couldn't find it on there.  Is it possible for you to email it to me?
Thanks in advance,

Steven Jones


Post a reply to this message

From: Steven Jones
Subject: Re: density files
Date: 21 Mar 2000 15:21:38
Message: <38d7d9d2@news.povray.org>
I might try doing that in QuickBASIC.  Thanks.


Post a reply to this message

From: Ken
Subject: Re: density files
Date: 21 Mar 2000 15:35:43
Message: <38D7DD88.FF1776C8@pacbell.net>
Steven Jones wrote:
> 
> I couldn't find it on there.  Is it possible for you to email it to me?
> Thanks in advance,
> 
> Steven Jones

Incoming.......

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: Bob Hughes
Subject: Re: density files
Date: 21 Mar 2000 15:42:17
Message: <38d7dea9@news.povray.org>
Someone already has.  I have the Basic program and a Pov test scene for it here.
Most likely in the p.b.u. group from about a half year ago or less maybe.

Bob

"Steven Jones" <ste### [at] tsncc> wrote in message
news:38d7d9d2@news.povray.org...
| I might try doing that in QuickBASIC.  Thanks.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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