POV-Ray : Newsgroups : povray.pov4.discussion.general : Request for *.df4 format (ASCII text based) Server Time
5 May 2024 13:44:47 EDT (-0400)
  Request for *.df4 format (ASCII text based) (Message 25 to 34 of 34)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: bapt
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 27 Aug 2010 16:15:01
Message: <web.4c781c43f13a83cfa3b8d9490@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 27.08.2010 17:23, schrieb bapt:
>
> > Damn, it's so close but... no luck. I cannot install POV-Ray 3.7 for some reason
> > (Mac) and the values above run through the c++ script still give me a blank
> > page. Would you mind posting the df3 and pov files so I can rule out the
> > conversion and know for sure that my povray is broken? I have cranked up the
> > absorption well above reasonable values and it's still all white.
>
> Posted it in povray.binary.scene-files, I hope it helps. I must say that
> I assume your c++ program is broken in some way.

Thanks, that's very helpful. It seems to work now.

Cheers,

baptiste


Post a reply to this message

From: John VanSickle
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 28 Aug 2010 05:03:51
Message: <4c78d0f7$1@news.povray.org>
> - 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.

If you want realistic results, each component of absorption must be 
equal to or greater than the emission component.  Making them equal 
gives you a pure glowing effect, whereas adding a bit more absorption 
gives you some smokiness.

In nature, everything which emits light also absorbs that same frequency 
of light to the same degree.  We see only the light that is at the 
outermost edges of the glowing object, but we're used to this.

Regards,
John


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 29 Dec 2010 19:05:01
Message: <web.4d1bcb91f13a83cfeb5c8e5f0@news.povray.org>
What do I need to do to modify the program code shown below, so that the first
line of the data file, instead of taking 3 parameters (Size of each dimension),
takes 4 arguments (Size of each of the three dimensins + bit resolution type).
Where the bit resolution type is 8, 16 or 32bit.


> 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: Warp
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 30 Dec 2010 03:22:04
Message: <4d1c412b@news.povray.org>
Woody <nomail@nomail> wrote:
> What do I need to do to modify the program code shown below, so that the first
> line of the data file, instead of taking 3 parameters (Size of each dimension),
> takes 4 arguments (Size of each of the three dimensins + bit resolution type).
> Where the bit resolution type is 8, 16 or 32bit.

  It requires quite some modifications because writing the larger integrals
is slightly more complicated, but this should do it:

//---------------------------------------------------------------------
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cstdio>
#include <cassert>

template<typename Int_t>
void writeIntValue(Int_t value, std::ostream& os)
{
    for(unsigned byteInd = sizeof(Int_t); byteInd-- > 0;)
        os << (unsigned char)((value >> (byteInd * 8)) & 0xFF);
}

template<typename Int_t>
void createDF3(std::istream& is, std::ostream& os,
               size_t xSize, size_t ySize, size_t zSize)
{
    std::vector<Int_t> data(xSize*ySize*zSize, 0);

    while(true)
    {
        size_t x, y, z, value;
        is >> x >> y >> z >> value;
        if(!is) break;
        const size_t ind = x + y*xSize + z*xSize*ySize;
        if(ind < data.size())
            data[ind] = Int_t(value);
    }

    for(size_t i = 0; i < data.size(); ++i)
        writeIntValue(data[i], os);
}

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;

    typedef unsigned char Int8_t;
    typedef unsigned short Int16_t;
    typedef unsigned int Int32_t;
    assert(sizeof(Int16_t) == 2);
    assert(sizeof(Int32_t) == 4);

    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, bits;
        is >> xSize >> ySize >> zSize >> bits;
        if(xSize > SIZE_LIMIT || ySize > SIZE_LIMIT || zSize > SIZE_LIMIT ||
           (bits != 8 && bits != 16 && bits != 32))
        {
            std::cout << "Skipping " << argv[i] << " (invalid input)\n";
            continue;
        }

        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);

        char header[6];
        header[0] = xSize/256; header[1] = xSize%256;
        header[2] = ySize/256; header[3] = ySize%256;
        header[4] = zSize/256; header[5] = zSize%256;
        os.write(header, 6);

        switch(bits)
        {
          case 8: createDF3<Int8_t>(is, os, xSize, ySize, zSize); break;
          case 16: createDF3<Int16_t>(is, os, xSize, ySize, zSize); break;
          case 32: createDF3<Int32_t>(is, os, xSize, ySize, zSize); break;
        }

        std::cout << argv[i] << " -> " << filename << std::endl;
    }
}
//---------------------------------------------------------------------

-- 
                                                          - Warp


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 4 Jan 2011 16:55:01
Message: <web.4d239653f13a83cfc41e4df50@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Woody <nomail@nomail> wrote:
> > What do I need to do to modify the program code shown below, so that the first
> > line of the data file, instead of taking 3 parameters (Size of each dimension),
> > takes 4 arguments (Size of each of the three dimensins + bit resolution type).
> > Where the bit resolution type is 8, 16 or 32bit.
>
>   It requires quite some modifications because writing the larger integrals
> is slightly more complicated, but this should do it:
>
> //---------------------------------------------------------------------
> #include <iostream>
> #include <fstream>
> #include <vector>
> #include <string>
> #include <cstdio>
> #include <cassert>
>
> template<typename Int_t>
> void writeIntValue(Int_t value, std::ostream& os)
> {
>     for(unsigned byteInd = sizeof(Int_t); byteInd-- > 0;)
>         os << (unsigned char)((value >> (byteInd * 8)) & 0xFF);
> }
>
> template<typename Int_t>
> void createDF3(std::istream& is, std::ostream& os,
>                size_t xSize, size_t ySize, size_t zSize)
> {
>     std::vector<Int_t> data(xSize*ySize*zSize, 0);
>
>     while(true)
>     {
>         size_t x, y, z, value;
>         is >> x >> y >> z >> value;
>         if(!is) break;
>         const size_t ind = x + y*xSize + z*xSize*ySize;
>         if(ind < data.size())
>             data[ind] = Int_t(value);
>     }
>
>     for(size_t i = 0; i < data.size(); ++i)
>         writeIntValue(data[i], os);
> }
>
> 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;
>
>     typedef unsigned char Int8_t;
>     typedef unsigned short Int16_t;
>     typedef unsigned int Int32_t;
>     assert(sizeof(Int16_t) == 2);
>     assert(sizeof(Int32_t) == 4);
>
>     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, bits;
>         is >> xSize >> ySize >> zSize >> bits;
>         if(xSize > SIZE_LIMIT || ySize > SIZE_LIMIT || zSize > SIZE_LIMIT ||
>            (bits != 8 && bits != 16 && bits != 32))
>         {
>             std::cout << "Skipping " << argv[i] << " (invalid input)\n";
>             continue;
>         }
>
>         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);
>
>         char header[6];
>         header[0] = xSize/256; header[1] = xSize%256;
>         header[2] = ySize/256; header[3] = ySize%256;
>         header[4] = zSize/256; header[5] = zSize%256;
>         os.write(header, 6);
>
>         switch(bits)
>         {
>           case 8: createDF3<Int8_t>(is, os, xSize, ySize, zSize); break;
>           case 16: createDF3<Int16_t>(is, os, xSize, ySize, zSize); break;
>           case 32: createDF3<Int32_t>(is, os, xSize, ySize, zSize); break;
>         }
>
>         std::cout << argv[i] << " -> " << filename << std::endl;
>     }
> }
> //---------------------------------------------------------------------
>
> --
>                                                           - Warp

So does this always use 255 as the max voxel value regardless of the bit
resolution?

How does 255 (besides being 256 minus 1) relate to the bit resolution?

Sorry, I don't know a whole lot about bytes and bits.


Post a reply to this message

From: Warp
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 4 Jan 2011 17:08:35
Message: <4d239a63@news.povray.org>
Woody <nomail@nomail> wrote:
> [-- text/plain, encoding 8bit, charset: iso-8859-1, 117 lines --]

> Warp <war### [at] tagpovrayorg> wrote:
> > Woody <nomail@nomail> wrote:
> > > What do I need to do to modify the program code shown below, so that the first
> > > line of the data file, instead of taking 3 parameters (Size of each dimension),
> > > takes 4 arguments (Size of each of the three dimensins + bit resolution type).
> > > Where the bit resolution type is 8, 16 or 32bit.
> >
> >   It requires quite some modifications because writing the larger integrals
> > is slightly more complicated, but this should do it:
> >
> > //---------------------------------------------------------------------
> > #include <iostream>
> > #include <fstream>
> > #include <vector>
> > #include <string>
> > #include <cstdio>
> > #include <cassert>
> >
> > template<typename Int_t>
> > void writeIntValue(Int_t value, std::ostream& os)
> > {
> >     for(unsigned byteInd = sizeof(Int_t); byteInd-- > 0;)
> >         os << (unsigned char)((value >> (byteInd * 8)) & 0xFF);
> > }
> >
> > template<typename Int_t>
> > void createDF3(std::istream& is, std::ostream& os,
> >                size_t xSize, size_t ySize, size_t zSize)
> > {
> >     std::vector<Int_t> data(xSize*ySize*zSize, 0);
> >
> >     while(true)
> >     {
> >         size_t x, y, z, value;
> >         is >> x >> y >> z >> value;
> >         if(!is) break;
> >         const size_t ind = x + y*xSize + z*xSize*ySize;
> >         if(ind < data.size())
> >             data[ind] = Int_t(value);
> >     }
> >
> >     for(size_t i = 0; i < data.size(); ++i)
> >         writeIntValue(data[i], os);
> > }
> >
> > 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;
> >
> >     typedef unsigned char Int8_t;
> >     typedef unsigned short Int16_t;
> >     typedef unsigned int Int32_t;
> >     assert(sizeof(Int16_t) == 2);
> >     assert(sizeof(Int32_t) == 4);
> >
> >     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, bits;
> >         is >> xSize >> ySize >> zSize >> bits;
> >         if(xSize > SIZE_LIMIT || ySize > SIZE_LIMIT || zSize > SIZE_LIMIT ||
> >            (bits != 8 && bits != 16 && bits != 32))
> >         {
> >             std::cout << "Skipping " << argv[i] << " (invalid input)\n";
> >             continue;
> >         }
> >
> >         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);
> >
> >         char header[6];
> >         header[0] = xSize/256; header[1] = xSize%256;
> >         header[2] = ySize/256; header[3] = ySize%256;
> >         header[4] = zSize/256; header[5] = zSize%256;
> >         os.write(header, 6);
> >
> >         switch(bits)
> >         {
> >           case 8: createDF3<Int8_t>(is, os, xSize, ySize, zSize); break;
> >           case 16: createDF3<Int16_t>(is, os, xSize, ySize, zSize); break;
> >           case 32: createDF3<Int32_t>(is, os, xSize, ySize, zSize); break;
> >         }
> >
> >         std::cout << argv[i] << " -> " << filename << std::endl;
> >     }
> > }
> > //---------------------------------------------------------------------
> >
> > --
> >                                                           - Warp

> So does this always use 255 as the max voxel value regardless of the bit
> resolution?

> How does 255 (besides being 256 minus 1) relate to the bit resolution?

  Where do you see a 255 in the program?

  The maximum value for each voxel is dependent on the bit size. If you
are eg. using 16 bits, the maximum value is 65535.

-- 
                                                          - Warp


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 4 Jan 2011 19:15:01
Message: <web.4d23b716f13a83cfc41e4df50@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Woody <nomail@nomail> wrote:
> > [-- text/plain, encoding 8bit, charset: iso-8859-1, 117 lines --]
>
> > Warp <war### [at] tagpovrayorg> wrote:
> > > Woody <nomail@nomail> wrote:
> > > > What do I need to do to modify the program code shown below, so that the first
> > > > line of the data file, instead of taking 3 parameters (Size of each
dimension),
> > > > takes 4 arguments (Size of each of the three dimensins + bit resolution type).
> > > > Where the bit resolution type is 8, 16 or 32bit.
> > >
> > >   It requires quite some modifications because writing the larger integrals
> > > is slightly more complicated, but this should do it:
> > >
> > > //---------------------------------------------------------------------
> > > #include <iostream>
> > > #include <fstream>
> > > #include <vector>
> > > #include <string>
> > > #include <cstdio>
> > > #include <cassert>
> > >
> > > template<typename Int_t>
> > > void writeIntValue(Int_t value, std::ostream& os)
> > > {
> > >     for(unsigned byteInd = sizeof(Int_t); byteInd-- > 0;)
> > >         os << (unsigned char)((value >> (byteInd * 8)) & 0xFF);
> > > }
> > >
> > > template<typename Int_t>
> > > void createDF3(std::istream& is, std::ostream& os,
> > >                size_t xSize, size_t ySize, size_t zSize)
> > > {
> > >     std::vector<Int_t> data(xSize*ySize*zSize, 0);
> > >
> > >     while(true)
> > >     {
> > >         size_t x, y, z, value;
> > >         is >> x >> y >> z >> value;
> > >         if(!is) break;
> > >         const size_t ind = x + y*xSize + z*xSize*ySize;
> > >         if(ind < data.size())
> > >             data[ind] = Int_t(value);
> > >     }
> > >
> > >     for(size_t i = 0; i < data.size(); ++i)
> > >         writeIntValue(data[i], os);
> > > }
> > >
> > > 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;
> > >
> > >     typedef unsigned char Int8_t;
> > >     typedef unsigned short Int16_t;
> > >     typedef unsigned int Int32_t;
> > >     assert(sizeof(Int16_t) == 2);
> > >     assert(sizeof(Int32_t) == 4);
> > >
> > >     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, bits;
> > >         is >> xSize >> ySize >> zSize >> bits;
> > >         if(xSize > SIZE_LIMIT || ySize > SIZE_LIMIT || zSize > SIZE_LIMIT ||
> > >            (bits != 8 && bits != 16 && bits != 32))
> > >         {
> > >             std::cout << "Skipping " << argv[i] << " (invalid input)\n";
> > >             continue;
> > >         }
> > >
> > >         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);
> > >
> > >         char header[6];
> > >         header[0] = xSize/256; header[1] = xSize%256;
> > >         header[2] = ySize/256; header[3] = ySize%256;
> > >         header[4] = zSize/256; header[5] = zSize%256;
> > >         os.write(header, 6);
> > >
> > >         switch(bits)
> > >         {
> > >           case 8: createDF3<Int8_t>(is, os, xSize, ySize, zSize); break;
> > >           case 16: createDF3<Int16_t>(is, os, xSize, ySize, zSize); break;
> > >           case 32: createDF3<Int32_t>(is, os, xSize, ySize, zSize); break;
> > >         }
> > >
> > >         std::cout << argv[i] << " -> " << filename << std::endl;
> > >     }
> > > }
> > > //---------------------------------------------------------------------
> > >
> > > --
> > >                                                           - Warp
>
> > So does this always use 255 as the max voxel value regardless of the bit
> > resolution?
>
> > How does 255 (besides being 256 minus 1) relate to the bit resolution?
>
>   Where do you see a 255 in the program?
>
>   The maximum value for each voxel is dependent on the bit size. If you
> are eg. using 16 bits, the maximum value is 65535.
>
> --
>                                                           - Warp

I suppose I was seeing 255 from the sample I posted at
http://news.povray.org/4799ff49%40news.povray.org and was thinking that 255 was
the maximum.

Thanks Again for your help. :)


-Jeff


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 28 Jan 2011 19:10:01
Message: <web.4d435a46f13a83cfc41e4df50@news.povray.org>
Warp,

Do you know where I can find the POVRay volunteer wishlist? I think its also an
Amazon wishlist?

Who do I ask about where to have the items shipped?

-J


Post a reply to this message

From: Woody
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 1 Feb 2011 08:25:00
Message: <web.4d48094af13a83cfc41e4df50@news.povray.org>
Warp,

Do you know where I can find the POVRay volunteer wishlist? I think its also an
Amazon wishlist?

Who do I ask about where to have the items shipped?

-J


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Request for *.df4 format (ASCII text based)
Date: 1 Feb 2011 09:16:14
Message: <4d4815ae$1@news.povray.org>

>    Warp,
>
> Do you know where I can find the POVRay volunteer wishlist? I think its also an
> Amazon wishlist?

   It's empty at the moment:

http://www.amazon.com/wishlist/3HDAWHAITQIKL/ref=cm_wl_rlist_go

   Regards,

-- 
Jaime Vives Piqueres
		
La Persistencia de la Ignorancia
http://www.ignorancia.org


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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