POV-Ray : Newsgroups : povray.animations : Animation of Numerical Simulations Server Time22 Jul 2024 13:23:40 EDT (-0400)
 Animation of Numerical Simulations (Message 1 to 7 of 7)
 From: Sereib Subject: Animation of Numerical Simulations Date: 25 Oct 2012 14:30:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.50898277955aa4a08be086270%40news.povray.org",
"dateCreated": "2012-10-25T18:30:01+00:00",
"datePublished": "2012-10-25T18:30:01+00:00",
"author": {
"@type": "Person",
"name": "Sereib"
}
}
Hi,

I would like to make animations based on a numerical simulation (e. g. the
dynamic of a globular cluster, or wave propagation). This would mean:

1) The parameter clock varies from e. g. 0 to 100 controlled by the ini file

2) In the scene file, the numerical simulation starts at t (time) = 0 and
proceeds to time = clock with a certain number of time intervals.

3) The result in rendered, and everything proceeds with step 1)

The problem is, that for each frame the numerical simulation always hast to
start at t = 0, e. g.:

Frame 1 (clock = 0.1): Simulation runs from t = 0.0 to 0.1, and renders the
result
Frame 2 (clock = 0.2): Simulation runs from t = 0.0 to 0.2, and renders the
result
Frame 3 (clock = 0.3): Simulation runs from t = 0.0 to 0.3, and renders the
result
Frame 4 (clock = 0.4): Simulation runs from t = 0.0 to 0.4, and renders the
result
...........

This means, povray has to calculate much more than really required. Thus it
would be helpful to buffer the result of each step, in order to proceed with
this result in the next step, so this would result in:

Frame 1 (clock = 0.1): Simulation runs from t = 0.0 to 0.1, and renders the
result
Frame 2 (clock = 0.2): Simulation runs from t = 0.1 to 0.2, and renders the
result
Frame 3 (clock = 0.3): Simulation runs from t = 0.2 to 0.3, and renders the
result
Frame 4 (clock = 0.4): Simulation runs from t = 0.3 to 0.4, and renders the
result
...........

This would require some kind of global variables which keep their value between
two animation steps called by the ini file. Any idea how this could be done?
Writing the variables (= e. g. the positions and speed vectors of the star
cluster calculated up to now) in a text-file, and importing it in the next
animation step?

Of course I could perform the simulation in e. g. visual basic and let visual
basic write output files with povray code, which could be included step by step
in the scene file. I assume this could be done via

#include(concat("c:\simulation_",str(clock,0,0),".inc"))

if the include files generated by visual basic are named "simulation1.inc",
"simulation2.inc", "simulation3.inc" ... ?

Any idea how to solve this solely with povray code?
Is there a tricky simple solution I just have overseen?

Thank you! Kind regards, Christian
```
 From: clipka Subject: Re: Animation of Numerical Simulations Date: 25 Oct 2012 14:50:15 Message: <508989e7\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#508989e7%241%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-25T18:50:15+00:00",
"datePublished": "2012-10-25T18:50:15+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
Am 25.10.2012 20:25, schrieb Sereib:

> This would require some kind of global variables which keep their value between
> two animation steps called by the ini file. Any idea how this could be done?
> Writing the variables (= e. g. the positions and speed vectors of the star
> cluster calculated up to now) in a text-file, and importing it in the next
> animation step?

Yes.

Use #write to write to a text file, and read the data back in the next

(Alternatively, some people use #write to generate an .inc file to be
#included in the next frame.)
```
 From: Sereib Subject: Re: Animation of Numerical Simulations Date: 26 Oct 2012 06:00:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.508a5e261d7520bff52c3ced0%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-26T10:00:01+00:00",
"datePublished": "2012-10-26T10:00:01+00:00",
"author": {
"@type": "Person",
"name": "Sereib"
}
}
Thanks, I will try this!

clipka <ano### [at] anonymousorg> wrote:
> Am 25.10.2012 20:25, schrieb Sereib:
>
> > This would require some kind of global variables which keep their value between
> > two animation steps called by the ini file. Any idea how this could be done?
> > Writing the variables (= e. g. the positions and speed vectors of the star
> > cluster calculated up to now) in a text-file, and importing it in the next
> > animation step?
>
> Yes.
>
> Use #write to write to a text file, and read the data back in the next
>
> (Alternatively, some people use #write to generate an .inc file to be
> #included in the next frame.)
```
 From: robert alzinger Subject: Re: Animation of Numerical Simulations Date: 26 Oct 2012 15:45:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.508ae73f1d7520bf883a834c0%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-26T19:45:01+00:00",
"datePublished": "2012-10-26T19:45:01+00:00",
"author": {
"@type": "Person",
"name": "robert alzinger"
}
}
> I would like to make animations based on a numerical simulation (e. g. the
> dynamic of a globular cluster, or wave propagation). This would mean:

In the last month I have done this with the marble machine.
program description:
POV-Ray #writes the start  position of the marble(s) at clock=0 to a file
than running for each frame 0 <= clock < x
do:
- #read position from the file
- calculate the new position.
- #write the new position
- display everything

see the result at

http://www.alzinger.de/cms5/robert/raytracing/marble-machine-in-povray.html

and the making of sub-pages.
if you need it i can publish the POV-Ray source?

It is not necessary to re-simulate for each frame from the beginning.

Robert
```
 From: Sereib Subject: Re: Animation of Numerical Simulations Date: 31 Oct 2012 05:45:01 Message:
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.5090f2441d7520bf7396802a0%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-31T09:45:01+00:00",
"datePublished": "2012-10-31T09:45:01+00:00",
"author": {
"@type": "Person",
"name": "Sereib"
}
}
Thank you, it works fine now!

By the way, some kind of "#global" identifiers which keep their values between
two frames would be fine and make these kind of animations easier
```
 From: Christian Froeschlin Subject: Re: Animation of Numerical Simulations Date: 31 Oct 2012 11:45:51 Message: <509147af\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#509147af%241%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-31T15:45:51+00:00",
"datePublished": "2012-10-31T15:45:51+00:00",
"author": {
"@type": "Person",
"name": "Christian Froeschlin"
}
}
Sereib wrote:
> Thank you, it works fine now!
>
> By the way, some kind of "#global" identifiers which keep their values between
> two frames would be fine and make these kind of animations easier

I tried something like this, is is actually a small change if cleanup
of memory is not a priority and values may persist between individual
renders even when not doing an animation (can also be very useful).
The latter part only concerns rendering from IDE, of course.

Once 3.7 is released I'll try to patch it in the final source code
and post it here. Currently I didn't even get around to setting up
compilation again after moving to 64-bit / VS 2010. I think there
was no free precompiled 64-bit boost installer so I'll have to
look into compiling that as well. Someday ...
```
 From: clipka Subject: Re: Animation of Numerical Simulations Date: 31 Oct 2012 19:52:41 Message: <5091b9c9\$1@news.povray.org>
```
{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#5091b9c9%241%40news.povray.org",
"headline": "Re: Animation of Numerical Simulations",
"dateCreated": "2012-10-31T23:52:41+00:00",
"datePublished": "2012-10-31T23:52:41+00:00",
"author": {
"@type": "Person",
"name": "clipka"
}
}
Am 31.10.2012 16:45, schrieb Christian Froeschlin:

> Once 3.7 is released I'll try to patch it in the final source code
> and post it here. Currently I didn't even get around to setting up
> compilation again after moving to 64-bit / VS 2010. I think there
> was no free precompiled 64-bit boost installer so I'll have to
> look into compiling that as well. Someday ...

You won't have to worry about boost (or openEXR) anymore - they've
become an integral part of our build process for Windows by now, just
like the other libraries we're using (e.g. libpng).
```