POV-Ray : Newsgroups : povray.binaries.images : Tracing around objects Server Time
18 Nov 2024 12:17:48 EST (-0500)
  Tracing around objects (Message 1 to 7 of 7)  
From: Mike Kost
Subject: Tracing around objects
Date: 9 Aug 2005 14:59:30
Message: <42f8fd10@news.povray.org>
Hey all,

I've been goofing around with .df3 files and stumbled onto a neat effect. To
create the attached image, I included a tree (generic one from POV-Tree)
and used the trace() function to probe the surface of the tree and output
intersection coordinates to the command line. A python script processed the
intersection points into a .df3 file. In a second .pov file, I included the
.df3 as the density in a media section to create the ghost tree on the
right while the original tree is on the left. 

Mike K
-- 
http://povray.tashcorp.net


Post a reply to this message


Attachments:
Download 'trunk.png' (183 KB)

Preview of image 'trunk.png'
trunk.png


 

From: Lonnie
Subject: Re: Tracing around objects
Date: 9 Aug 2005 15:35:00
Message: <web.42f904a51fc1e6e93b3a698d0@news.povray.org>
Mike Kost <con### [at] povraytashcorpnet> wrote:
> Hey all,
>
> I've been goofing around with .df3 files and stumbled onto a neat effect. To
> create the attached image, I included a tree (generic one from POV-Tree)
> and used the trace() function to probe the surface of the tree and output
> intersection coordinates to the command line. A python script processed the
> intersection points into a .df3 file. In a second .pov file, I included the
> .df3 as the density in a media section to create the ghost tree on the
> right while the original tree is on the left.
>
> Mike K
> --
> http://povray.tashcorp.net

Super-Cool effect!  I am doing something rather similiar to generate clouds
with .df3 (the media in my last "Armillary" post uses a .df3.)  I wish
there was a way to generate binary files directly from POV - maybe there is
and I have just missed it.  What I need is POV's excellent random number
generators.  Right now I have to output the random stream to an ascii file,
read that file into my BASIC program, and then write out the .df3.  A file
made of a cube of 1000^3 two byte integers is big enough, but in comma
separated ascii it's immense! I can't use the BASIC random generator
because I get those nasty plateaus.


Post a reply to this message

From: Mike Kost
Subject: Re: Tracing around objects
Date: 9 Aug 2005 16:18:39
Message: <42f90f9e@news.povray.org>
Lonnie wrote:
> Mike Kost <con### [at] povraytashcorpnet> wrote:
>> Hey all,
>>
>> I've been goofing around with .df3 files and stumbled onto a neat effect.
>> To create the attached image, I included a tree (generic one from
>> POV-Tree) and used the trace() function to probe the surface of the tree
>> and output intersection coordinates to the command line. A python script
>> processed the intersection points into a .df3 file. In a second .pov
>> file, I included the .df3 as the density in a media section to create the
>> ghost tree on the right while the original tree is on the left.
>>
>> Mike K
>> --
>> http://povray.tashcorp.net
> 
> Super-Cool effect!  I am doing something rather similiar to generate
> clouds
> with .df3 (the media in my last "Armillary" post uses a .df3.)  I wish
> there was a way to generate binary files directly from POV - maybe there
> is
> and I have just missed it.  What I need is POV's excellent random number
> generators.  Right now I have to output the random stream to an ascii
> file,
> read that file into my BASIC program, and then write out the .df3.  A file
> made of a cube of 1000^3 two byte integers is big enough, but in comma
> separated ascii it's immense! I can't use the BASIC random generator
> because I get those nasty plateaus.

Since I can't remember what you're processing into the .df3 besides
randomness, take with a grain of salt, but ... why don't you take advantage
of POV's noise functions? Import the large variations via a .df3 file into
a function  

    #declare f_data3d = function {
            pattern {
                    density_file df3 "my.df3"
                    interpolate 2
            }
    }

Then combine this function with f_noise3d to get the variation

    #declare f_final3d = function { f_data3d(x,y,z) + 0.01 *
f_noise3d(x,y,z) }

Then use this as a function into the density statement

    media {
        ... media settings here ...
        density {
            function { f_final3d(x,y,z) }
            color_map { ... }            
        }
    }

If you go that route, you should be able to get the general shape using a
smaller .df3 and use Povray to add small, random variations that are
expensive to capture in .df3 files. 

Mike
--
http://povray.tashcorp.net


Post a reply to this message

From: Lonnie
Subject: Re: Tracing around objects
Date: 9 Aug 2005 17:35:00
Message: <web.42f920961fc1e6e93b3a698d0@news.povray.org>
Thanks Mike - I had just hit on that idea when you posted.  I had been
reading through Mike Williams' tutorial on isosurfaces (I am modeling
flowstone) and saw that .df3 files could be used as a pattern function for
them as well.  Almost any function could be mapped, not just random
numbers.


Post a reply to this message

From: jute
Subject: Re: Tracing around objects
Date: 11 Aug 2005 05:25:00
Message: <web.42fb18441fc1e6e9fc1dc6790@news.povray.org>
"Lonnie" <lon### [at] yahoocom> wrote:

> and I have just missed it.  What I need is POV's excellent random number
> generators.  Right now I have to output the random stream to an ascii file,
> read that file into my BASIC program, and then write out the .df3.

Judging from your use of BASIC, I suppose you don't run Linux.  However,
if you have a linux box somewhere near you, you can get pretty good
random values from the kernel entropy pool.

From the command line (resolution is two bytes in this example):

dd if=/dev/urandom bs=2 count=1 2>/dev/null | hexdump -d |grep "0000000" |
awk '{print $2/65536}'

Or with some C (resolution is four bytes):

//
//  this method returns a random value between 0 and 1
//
double getrnd(int rdev, void** datar);
double getrnd(int rdev, void** datar) {
  ssize_t bytesread = read(rdev, datar, 4);
  unsigned long rint = (unsigned long)(*datar);
  double rval = (double)rint/4294967296.;
  return rval;
}

int main(int argc, char **argv) {

  // open the kernel entropy pool
  int rndev = open("/dev/urandom", O_RDONLY);
  void* rdata[4];

  double x = getrnd(rndev,rdata);
  close(rndev);
}


Post a reply to this message

From: Ross
Subject: Re: Tracing around objects
Date: 11 Aug 2005 14:16:31
Message: <42fb95ff$1@news.povray.org>
"Mike Kost" <con### [at] povraytashcorpnet> wrote in message
news:42f8fd10@news.povray.org...
> Hey all,
>
> I've been goofing around with .df3 files and stumbled onto a neat effect.
To
> create the attached image, I included a tree (generic one from POV-Tree)
> and used the trace() function to probe the surface of the tree and output
> intersection coordinates to the command line. A python script processed
the
> intersection points into a .df3 file. In a second .pov file, I included
the
> .df3 as the density in a media section to create the ghost tree on the
> right while the original tree is on the left.
>
> Mike K
> -- 
> http://povray.tashcorp.net
>

i was wondering if you could also use photons on an object to get "ghost"
effects. have an object that a lot of photons land on, render with saving
photons to file. then render again, removing the object but loading the
photon file.

just a thought. i havn't tried it yet.


Post a reply to this message

From: Lonnie
Subject: Re: Tracing around objects
Date: 12 Aug 2005 00:00:00
Message: <web.42fc1d981fc1e6e93b3a698d0@news.povray.org>
> Judging from your use of BASIC, I suppose you don't run Linux.  However,
> if you have a linux box somewhere near you, you can get pretty good
> random values from the kernel entropy pool.

Right now looking into Python's pseudo-random number generators - they
should do quite nicely.


Post a reply to this message

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