POV-Ray : Newsgroups : povray.general : arrays and animations Server Time
27 Nov 2024 16:44:56 EST (-0500)
  arrays and animations (Message 1 to 6 of 6)  
From: kike
Subject: arrays and animations
Date: 8 May 2008 07:05:01
Message: <web.4822dd51f812a232be7bfb550@news.povray.org>
I still go on with my animation and I've got another question.

I want to use the function trace in an animation. The thing is that I want to
calculate the intersection between one object and 10.000 spheres. This costs a
lot but I need to do it just once (I mean, that all the frames will use the
same trace results).

So I thought it would be a good idea to declare an array with all the trace
results like

#declare P[i]=trace...

but as I just need to do this once I thought this would work:

#declare P=array[dim]

#if (frame_number=1)
#while (i<dim)
P[i]=trace...
#end
#end

and then use the value of P[i] for the rest of the animation. But it seems not
to work. From one frame to another it doesnt save the array.

Can you think of a solution without writting an external file with the values of
P[i]

Thanks in advance!!!!


Post a reply to this message

From: Jan Dvorak
Subject: Re: arrays and animations
Date: 8 May 2008 08:30:17
Message: <4822f259$1@news.povray.org>
kike napsal(a):
> I still go on with my animation and I've got another question.
> 
> I want to use the function trace in an animation. The thing is that I want to
> calculate the intersection between one object and 10.000 spheres. This costs a
> lot but I need to do it just once (I mean, that all the frames will use the
> same trace results).
> 
> So I thought it would be a good idea to declare an array with all the trace
> results like
> 
> #declare P[i]=trace...
> 
> but as I just need to do this once I thought this would work:
> 
> #declare P=array[dim]
> 
> #if (frame_number=1)
> #while (i<dim)
> P[i]=trace...
> #end
> #end
> 
> and then use the value of P[i] for the rest of the animation. But it seems not
> to work. From one frame to another it doesnt save the array.
> 
> Can you think of a solution without writting an external file with the values of
> P[i]
> 
> Thanks in advance!!!!
> 
> 
no information is stored between individual frames except for what you 
save by yourself. Thus the only alternatives would be more complicated 
and impractical (I can think of some incomplete solutions and other 
ideas - one of each).


Post a reply to this message

From: triple r
Subject: Re: arrays and animations
Date: 8 May 2008 08:45:00
Message: <web.4822f540758b8493dcb320720@news.povray.org>
Jan Dvorak <jan### [at] centrumcz> wrote:
> no information is stored between individual frames except for what you
> save by yourself. Thus the only alternatives would be more complicated
> and impractical (I can think of some incomplete solutions and other
> ideas - one of each).

Ah, the days of persistent variables.  I certainly abused that feature.  But it
really shouldn't be too hard to write to a file.  Just look it up in the docs.
Or else you can always run the whole simulation up to the current frame if it
doesn't take too long.

 - Ricky


Post a reply to this message

From: Christian Froeschlin
Subject: Re: arrays and animations
Date: 9 May 2008 03:56:05
Message: <48240395$1@news.povray.org>
>>no information is stored between individual frames except for what you
>>save by yourself. Thus the only alternatives would be more complicated
>>and impractical (I can think of some incomplete solutions and other
>>ideas - one of each).

Actually, it would be nice to have "meta-elements" for
scenes in SDL so you could write something like this:

#macro PARAMETRIZED_SCENE(i)
scene
{
   global_settings {...}
   camera {...}
   light_source {...}
   ...
}
#end

#local i=0;
#while (i < 10)
   #local filename      = concat(...);
   #local extra_options = +FN
   #render filename extra_options
     PARAMETRIZED_SCENE(i)
   #end
   #local i=i+1;
#end

Not just for animations, but also for creating sets of
structurally identical images (e.g., button graphics for
web sites, games, or similar).


Post a reply to this message

From: kike
Subject: Re: arrays and animations
Date: 9 May 2008 05:35:00
Message: <web.48241a2f758b8493be7bfb550@news.povray.org>
> Actually, it would be nice to have "meta-elements" for
> scenes in SDL so you could write something like this:

Yeah!, that was exactly what I was talking about!


Post a reply to this message

From: John VanSickle
Subject: Re: arrays and animations
Date: 9 May 2008 07:42:19
Message: <4824389b@news.povray.org>
kike wrote:
> Can you think of a solution without writing an external file with the values of
> P[i]

What's wrong with writing the values to a separate file?  I've done that 
before with other data generated in a POV-Ray script.  It isn't hard at 
all to write the file so that it's an .INC file that POV-Ray can parse. 
  Then you use a simple #include statement to bring all of the data in 
as painlessly as possible.

Regards,
John


Post a reply to this message

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