POV-Ray : Newsgroups : povray.pov4.discussion.general : Request for *.df4 format (ASCII text based) Server Time
5 May 2024 10:13:29 EDT (-0400)
  Request for *.df4 format (ASCII text based) (Message 11 to 20 of 34)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Warp
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 26 Feb 2008 18:31:05
Message: <47c4a139@news.povray.org>
Tor Olav Kristensen <tor### [at] toberemovedgmailcom> wrote:
> But some might want to use POV-Ray SDL to write them...

  Then it would be better to enhance the SDL (or better yet, redesign it
from scratch) so that you can create DF3's with it, rather than change
the DF3 so that you can create them with the current SDL...

  The latter only helps creating DF3 files. The former helps creating
tons of other files too.

-- 
                                                          - Warp


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 26 Feb 2008 19:36:32
Message: <47c4b090@news.povray.org>
Warp wrote:
> Tor Olav Kristensen <tor### [at] toberemovedgmailcom> wrote:
>> But some might want to use POV-Ray SDL to write them...
> 
>   Then it would be better to enhance the SDL (or better yet, redesign it
> from scratch) so that you can create DF3's with it, rather than change
> the DF3 so that you can create them with the current SDL...
> 
>   The latter only helps creating DF3 files. The former helps creating
> tons of other files too.

Yes, I agree.

-- 
Tor Olav
http://subcube.com


Post a reply to this message

From: ingo
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 27 Feb 2008 15:16:13
Message: <Xns9A51D85816D16seed7@news.povray.org>
in news:web.47b586279e245a8f94e61a50@news.povray.org Woody wrote:

> Would it be possible to include a *.df4 format where instead of
> dimension and voxel data being in byte code, it was in some type of
> standard *.txt format? Possibly ASCII?

Have a look at the PGM file format 
http://netpbm.sourceforge.net/doc/pgm.html it supports multiple layers. I 
don't know how much of the spec is supported by POV-Ray, I doubt it deals 
with multiple images.

Ingo


Post a reply to this message

From: Antonio Ferrari
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 4 Mar 2008 11:25:00
Message: <web.47cd7729f13a83cf29aed21e0@news.povray.org>
Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:

> But some might want to use POV-Ray SDL to write them...

Yes. Sometimes ago I needed to write df3 files from SDL, but that's impossible.
On the other side, Povray read only df files in binary format. I think that one
would want to create df3 files in his macros...


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 4 Mar 2008 12:51:33
Message: <47cd8c25$1@news.povray.org>

> Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:
> 
>> But some might want to use POV-Ray SDL to write them...
> 
> Yes. Sometimes ago I needed to write df3 files from SDL, but that's impossible.
> On the other side, Povray read only df files in binary format. I think that one
> would want to create df3 files in his macros...
> 

Yep, so let's add binary-file-writing capabilities to POV SDL, like Warp 
said. Not make an ASCII-based df3.


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 8 Dec 2008 08:20:00
Message: <web.493d1e87f13a83cf3182ed980@news.povray.org>
Nicolas Alvarez <nic### [at] gmailisthebestcom> wrote:

> > Tor Olav Kristensen <tor### [at] TOBEREMOVEDgmailcom> wrote:
> >
> >> But some might want to use POV-Ray SDL to write them...
> >
> > Yes. Sometimes ago I needed to write df3 files from SDL, but that's impossible.
> > On the other side, Povray read only df files in binary format. I think that one
> > would want to create df3 files in his macros...
> >
>
> Yep, so let's add binary-file-writing capabilities to POV SDL, like Warp
> said. Not make an ASCII-based df3.

that sounds like a fine idea. my main objection with the binary versuses the
ascii formats was that all the tutirials on the df3 binary format made things
alot more complicated with stuff like big indian and little indian. but im
assuming that if the ability to write binaries would make this trival, at the
very least there would be documentation as it applies to pov as opposed to
general computing


Post a reply to this message

From: bapt
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 26 Aug 2010 17:45:01
Message: <web.4c76df5af13a83cfa3b8d9490@news.povray.org>
Hi list,

I'm trying to use a density file in povray for the first time and the page is
always blank.

I use an external program to generate a file data.dat which looks like this,

10 10 10
0 0 0 240
1 0 0 240
2 0 0 240
3 0 0 240
4 0 0 240
5 0 0 240
6 0 0 240
7 0 0 240
8 0 0 240
etc ...

where the first line gives the dimensions, the first three columns are xyz
coordinates and last column the density value.

I use the c++ code posted here to create a df3 file. OK so far, I think.
Unfortunately, my basic example shows a blank page with nothing in it. I don't
know if the df3 file is incorrect or if it's a problem with the povray file
below,


background { color rgb <1.0,1.0,1.0> }
global_settings {
ambient_light <0.3,0.3,0.3>
}

#include "colors.inc"
#include "textures.inc"

light_source{<10,10,-10> color White}
#declare dist = 1.5;


camera {location <dist , dist ,dist>
right <0, 4/3, 0>
 up    <0,0,1>
 look_at  <0.0 , 0.0 , 0.0>}


#declare theinterior = interior {
   media {
      density {
         density_file df3 "data.df3"
         interpolate 1
         color_map {
            [0.00 rgb <0,0,0>]
            [0.2 rgb <0,0,1>]
            [0.4 rgb <0,1,0>]
            [1.00 rgb <1,0,0>]
         }
      }
   }
}

box {
   <0,0,0>, <1,1,1>
   pigment { rgbf 1 }
   interior { theinterior }
   hollow
}


I'll appreciate any advice.

Regards,

baptiste



Warp <war### [at] tagpovrayorg> wrote:
> Woody <nomail@nomail> wrote:
> > If you every have a few moments do you think you could modify the source code
> > you posted at http://news.povray.org/4799ff49%40news.povray.org, so that it can
> > take one or more *.txt files specified in the command line (instead of the
> > testdata.txt) and output them into df3 format with the same name (except for
> > the txt extension).
>
>   You mean with the same input file format?
>   How about this:
>
>
> #include <iostream>
> #include <fstream>
> #include <vector>
> #include <string>
> #include <cstdio>
>
> int main(int argc, char* argv[])
> {
>     // Limit the size of the df3 dimensions (safeguard against invalid input).
>     // Maximum df3 size will be SIZE_LIMIT*SIZE_LIMIT*SIZE_LIMIT.
>     const size_t SIZE_LIMIT = 256;
>
>     if(argc < 2)
>     {
>         std::cout << "Usage: " << argv[0] << " <files>\n";
>         return 0;
>     }
>
>     for(int i = 1; i < argc; ++i) // for each input file
>     {
>         std::ifstream is(argv[i]);
>         if(!is.good())
>         {
>             std::cerr << "Couldn't open ";
>             std::perror(argv[i]);
>             continue;
>         }
>
>         size_t xSize, ySize, zSize;
>         is >> xSize >> ySize >> zSize;
>         if(xSize > SIZE_LIMIT || ySize > SIZE_LIMIT || zSize > SIZE_LIMIT)
>         {
>             std::cout << "Skipping " << argv[i] << " (invalid input)\n";
>             continue;
>         }
>
>         std::vector<char> data(xSize*ySize*zSize + 6, 0);
>
>         // Setup df3 header:
>         data[0] = xSize/256; data[1] = xSize%256;
>         data[2] = ySize/256; data[3] = ySize%256;
>         data[4] = zSize/256; data[5] = zSize%256;
>
>         // Read input data and create df3 data:
>         while(true)
>         {
>             size_t x, y, z, value;
>             is >> x >> y >> z >> value;
>             if(!is.good()) break;
>             const size_t ind = x + y*xSize + z*xSize*ySize + 6;
>             if(ind < data.size())
>                 data[ind] = char(value);
>         }
>
>         // Write df3 file:
>         std::string filename = argv[i];
>         size_t ind = filename.find_last_of('.');
>         if(ind != filename.npos) filename.resize(ind);
>         filename += ".df3";
>         std::ofstream os(filename.c_str(), std::ios::binary);
>         os.write(&data[0], data.size());
>         std::cout << argv[i] << " -> " << filename << std::endl;
>     }
> }


Post a reply to this message

From: clipka
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 26 Aug 2010 18:38:24
Message: <4c76ece0$1@news.povray.org>
Am 26.08.2010 23:40, schrieb bapt:

> #declare theinterior = interior {
>     media {
>        density {
>           density_file df3 "data.df3"
>           interpolate 1
>           color_map {
>              [0.00 rgb<0,0,0>]
>              [0.2 rgb<0,0,1>]
>              [0.4 rgb<0,1,0>]
>              [1.00 rgb<1,0,0>]
>           }
>        }
>     }
> }

You might consider this a case of "POV-Ray fails to help you with a 
useful error message": Your media has a density, but no type. Is it 
supposed to be absorbing, emitting or scattering?


Post a reply to this message

From: bapt
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 27 Aug 2010 01:40:00
Message: <web.4c774f79f13a83cfa3b8d9490@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 26.08.2010 23:40, schrieb bapt:
>
> > #declare theinterior = interior {
> >     media {
> >        density {
> >           density_file df3 "data.df3"
> >           interpolate 1
> >           color_map {
> >              [0.00 rgb<0,0,0>]
> >              [0.2 rgb<0,0,1>]
> >              [0.4 rgb<0,1,0>]
> >              [1.00 rgb<1,0,0>]
> >           }
> >        }
> >     }
> > }
>
> You might consider this a case of "POV-Ray fails to help you with a
> useful error message": Your media has a density, but no type. Is it
> supposed to be absorbing, emitting or scattering?

I see, I added the following but still get a blank page,

#declare theinterior = interior {
   media {
    emission <1,1,1> / 10
     absorption <1,1,1> / 30
     scattering { 1, <0,0,0> }
      density {
         density_file df3 "data.df3"
         interpolate 1
         color_map {
            [0.00 rgb <0,0,0>]
            [0.2 rgb <0,0,1>]
            [0.4 rgb <0,1,0>]
            [1.00 rgb <1,0,0>]
         }
      }
   }
}

Thanks for helping,

baptiste


Post a reply to this message

From: clipka
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 27 Aug 2010 06:16:21
Message: <4c779075$1@news.povray.org>
Am 27.08.2010 07:39, schrieb bapt:

>> You might consider this a case of "POV-Ray fails to help you with a
>> useful error message": Your media has a density, but no type. Is it
>> supposed to be absorbing, emitting or scattering?
>
> I see, I added the following but still get a blank page,
>
> #declare theinterior = interior {
>     media {
>      emission<1,1,1>  / 10
>       absorption<1,1,1>  / 30
>       scattering { 1,<0,0,0>  }
>        density {
>           density_file df3 "data.df3"
>           interpolate 1
>           color_map {
>              [0.00 rgb<0,0,0>]
>              [0.2 rgb<0,0,1>]
>              [0.4 rgb<0,1,0>]
>              [1.00 rgb<1,0,0>]
>           }
>        }
>     }
> }

- Emission will be invisible, as your background is plain white.

- You can leave out scattering, as with a value of <0,0,0> it does 
nothing (the scattering color specifies how much the red, green and blue 
components of the light will be affected).

- Your absorption is simply too weak. Try absorption <1,1,1>*30 instead. 
Depends on how dense your density map actually is, though. Note that the 
smaller the distances in your scene are, the higher your media 
parameters have to be for the same effect.


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

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