POV-Ray : Newsgroups : povray.animations : can't make static starfield, it keeps shifting Server Time
29 Mar 2024 02:21:16 EDT (-0400)
  can't make static starfield, it keeps shifting (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Florin Andrei
Subject: can't make static starfield, it keeps shifting
Date: 15 Oct 2010 20:50:01
Message: <web.4cb8f65fd8b7640f7411a7fb0@news.povray.org>
I am trying to render an astronomy object, with stars as a background. This is
fine as a static image, but I'm having tremendous issues when doing an
animation. Basically, I can't find a solution to the simple problem of having
the exact same image (starfield) for all frames, when the camera is moving.
Looks like, no matter what, the starfield background is randomly built anew for
each frame. This is not good. I want the starry background to be exactly the
same in each frame, fully static relative to the moving camera.

I tried to paint Starfield1 on a box (or plane) and have the box move with the
exact same speed as the camera:

http://pastebin.com/raw.php?i=4KZL7jcG

povray from_mars.pov +W1920 +H1080 -visual DirectColor +A0.1 +AM2

Well, no, each frame the stars are painted again, randomly. :(

How do I make the starfield completely static for all frames when the camera is
moving?


Post a reply to this message

From: Stephen
Subject: Re: can't make static starfield, it keeps shifting
Date: 16 Oct 2010 03:31:24
Message: <4cb954cc@news.povray.org>
On 16/10/2010 1:48 AM, Florin Andrei wrote:
> Well, no, each frame the stars are painted again, randomly.:(
>
> How do I make the starfield completely static for all frames when the camera is
> moving?
>

Instead of your moving box, why not use a sky_sphere? I've used the 
pigment from Starfield1 in the example below.

sky_sphere {
     pigment {
         granite
         color_map {
             [ 0.000  0.270 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
             [ 0.270  0.280 color rgb <.5,.5,.4> color rgb <.8,.8,.4> ]
             [ 0.280  0.470 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
             [ 0.470  0.480 color rgb <.4,.4,.5> color rgb <.4,.4,.8> ]
             [ 0.480  0.680 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
             [ 0.680  0.690 color rgb <.5,.4,.4> color rgb <.8,.4,.4> ]
             [ 0.690  0.880 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
             [ 0.880  0.890 color rgb <.5,.5,.5> color rgb < 1, 1, 1> ]
             [ 0.890  1.000 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
         }
     turbulence 1
     sine_wave
     scale .5
     }
}

-- 

Best Regards,
	Stephen


Post a reply to this message

From: Alain
Subject: Re: can't make static starfield, it keeps shifting
Date: 16 Oct 2010 19:39:43
Message: <4cba37bf$1@news.povray.org>

> On 16/10/2010 1:48 AM, Florin Andrei wrote:
>> Well, no, each frame the stars are painted again, randomly.:(
>>
>> How do I make the starfield completely static for all frames when the
>> camera is
>> moving?
>>
>
> Instead of your moving box, why not use a sky_sphere? I've used the
> pigment from Starfield1 in the example below.
>
> sky_sphere {
> pigment {
> granite
> color_map {
> [ 0.000 0.270 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
> [ 0.270 0.280 color rgb <.5,.5,.4> color rgb <.8,.8,.4> ]
> [ 0.280 0.470 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
> [ 0.470 0.480 color rgb <.4,.4,.5> color rgb <.4,.4,.8> ]
> [ 0.480 0.680 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
> [ 0.680 0.690 color rgb <.5,.4,.4> color rgb <.8,.4,.4> ]
> [ 0.690 0.880 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
> [ 0.880 0.890 color rgb <.5,.5,.5> color rgb < 1, 1, 1> ]
> [ 0.890 1.000 color rgb < 0, 0, 0> color rgb < 0, 0, 0> ]
> }
> turbulence 1
> sine_wave
> scale .5
> }
> }
>

This works because the sky_sphere is effevtively a unit sphere centered 
on the camera.
This will works as long as the camera don't rotate.

The apparent change in your original star field is caused by a pattern 
that relies heavily on sub-pixel details to do it's magic. When you move 
the camera or the object that have the pattern, any difference in the 
relative positions will cause the sub pixels bits that are visible to 
change apparently at random.
The granite pattern used is very noisy, possibly the moisiest of all 
patterns. That noise in increased by the applied turbulence.

Another effect of that trick is that it's resolution dependent. If you 
change the resolution from, for example, 1600x1200 to 1601x1200, the 
pattern of stars WILL totaly change.

If you want something consistant, you should take a look at the galaxy 
include set. Available from the object collection: 
http://lib.povray.org/searchcollection/index.php. Keyword "galaxy".
It can generate star fields, nebulaes, galaxyes, comets/meteors.
It have been successfully used in several animations.



Alain


Post a reply to this message

From: Florin Andrei
Subject: Re: can't make static starfield, it keeps shifting
Date: 18 Oct 2010 20:25:01
Message: <web.4cbce51d2d8aa957411a7fb0@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:
>
> If you want something consistant, you should take a look at the galaxy
> include set. Available from the object collection:
> http://lib.povray.org/searchcollection/index.php. Keyword "galaxy".
> It can generate star fields, nebulaes, galaxyes, comets/meteors.
> It have been successfully used in several animations.

I did that, I ripped the relevant part (the pigment) from the include file and
pasted it into my script, and reduced the scale a little bit, to make the stars
smaller:

http://dl.dropbox.com/u/29966/povray/from_mars.pov

But the stars are still twinkling a lot:

http://dl.dropbox.com/u/29966/povray/from_mars.mp4

I find it surprising that such a seemingly simple task (use a static bitmap as a
fixed background in an animation) is so hard to accomplish. Is there no way to
do that within povray?


Post a reply to this message

From: Alain
Subject: Re: can't make static starfield, it keeps shifting
Date: 18 Oct 2010 21:56:14
Message: <4cbcfabe@news.povray.org>

> Alain<aze### [at] qwertyorg>  wrote:
>>
>> If you want something consistant, you should take a look at the galaxy
>> include set. Available from the object collection:
>> http://lib.povray.org/searchcollection/index.php. Keyword "galaxy".
>> It can generate star fields, nebulaes, galaxyes, comets/meteors.
>> It have been successfully used in several animations.
>
> I did that, I ripped the relevant part (the pigment) from the include file and
> pasted it into my script, and reduced the scale a little bit, to make the stars
> smaller:
>
> http://dl.dropbox.com/u/29966/povray/from_mars.pov
>
> But the stars are still twinkling a lot:
>
> http://dl.dropbox.com/u/29966/povray/from_mars.mp4
>
> I find it surprising that such a seemingly simple task (use a static bitmap as a
> fixed background in an animation) is so hard to accomplish. Is there no way to
> do that within povray?
>
>

I tried your sample. Absolutely no flickring stars. As expected as you 
use a sky_sphere.
BUT! If I stop the camera and ROTATE it like: rotate clock*y.

Doing that and I have flickering stars. Also expectable as you use a 
pattern scalled very small and have sub-pixels details.

In the sample, you definetely don't use a static bitmap, but a pattern.


Alain


Post a reply to this message

From: Christian Froeschlin
Subject: Re: can't make static starfield, it keeps shifting
Date: 19 Oct 2010 05:20:28
Message: <4cbd62dc@news.povray.org>
Florin Andrei wrote:

> But the stars are still twinkling a lot:
> 
> http://dl.dropbox.com/u/29966/povray/from_mars.mp4
> 
> I find it surprising that such a seemingly simple task (use a static bitmap as a
> fixed background in an animation) is so hard to accomplish. Is there no way to
> do that within povray?

Have you looked at the actually rendered frames? I think
you may be seeing artefacts from mp4 compression. Many codecs
don't really like artifical images and tiny sharp dots. Also,
does the animation really use a resolution of 1920x1080? If
not, you also have some scaling done by the converter.

Note that you should render without jitter (command line -J)
for animations, although it doesn't seem to do much here.


Post a reply to this message

From: Florin Andrei
Subject: Re: can't make static starfield, it keeps shifting
Date: 19 Oct 2010 15:50:01
Message: <web.4cbdf6632d8aa957411a7fb0@news.povray.org>
Here are the first 10 PNG frames (all 300 frames are like 30MB, and the first 10
are sufficient to demonstrate the problem):

http://dl.dropbox.com/u/29966/povray/from_mars.zip

You can move through them with an image viewer. The stars appearing and
disappearing between frames are clearly visible.

I am using povray 3.6.1 on Ubuntu Linux 10.04 32bit. The command line was:

povray from_mars.pov +W1920 +H1080 -visual DirectColor +A0.1 +AM2

How is my system different from yours that causes flickering here but not there?


Post a reply to this message

From: Alain
Subject: Re: can't make static starfield, it keeps shifting
Date: 19 Oct 2010 17:04:41
Message: <4cbe07e9@news.povray.org>

> Here are the first 10 PNG frames (all 300 frames are like 30MB, and the first 10
> are sufficient to demonstrate the problem):
>
> http://dl.dropbox.com/u/29966/povray/from_mars.zip
>
> You can move through them with an image viewer. The stars appearing and
> disappearing between frames are clearly visible.
>
> I am using povray 3.6.1 on Ubuntu Linux 10.04 32bit. The command line was:
>
> povray from_mars.pov +W1920 +H1080 -visual DirectColor +A0.1 +AM2
>
> How is my system different from yours that causes flickering here but not there?
>
>
In your animation, it's mainly the fainter stars that flicker. Those are 
to small to appear in my test renders.
My test used a much lower resolution and not the same aspect ratio: 
+w800 +h600 +a0.2 +am2

With the kind of pattern used, it's not realy surprising.

A possible workaround:
Render an empty scene with only the background.
In the animation, use a large box or a plane somewhat behind the 
farthest object.
Apply the prerendered background to that object as an image_map, scale 
appropriately to cover the visible area. It may be interesting to post 
process that image by bluring it a little.
Translate that object in parallel with the camera during the animation.



Alain


Post a reply to this message

From: Christian Froeschlin
Subject: Re: can't make static starfield, it keeps shifting
Date: 19 Oct 2010 19:41:10
Message: <4cbe2c96$1@news.povray.org>
Alain wrote:

> In the animation, use a large box or a plane somewhat behind the 
> farthest object.

Alternatively, simply render the foreground with +ua then
the background will be transparent in the output file and you
can externally merge them with any background bitmap you like,
e.g., using the ImageMagick suite.


Post a reply to this message

From: John VanSickle
Subject: Re: can't make static starfield, it keeps shifting
Date: 19 Oct 2010 21:02:32
Message: <4cbe3fa8@news.povray.org>
On 10/15/2010 8:48 PM, Florin Andrei wrote:
> I am trying to render an astronomy object, with stars as a background. This is
> fine as a static image, but I'm having tremendous issues when doing an
> animation. Basically, I can't find a solution to the simple problem of having
> the exact same image (starfield) for all frames, when the camera is moving.
> Looks like, no matter what, the starfield background is randomly built anew for
> each frame. This is not good. I want the starry background to be exactly the
> same in each frame, fully static relative to the moving camera.
>
> I tried to paint Starfield1 on a box (or plane) and have the box move with the
> exact same speed as the camera:
>
> http://pastebin.com/raw.php?i=4KZL7jcG
>
> povray from_mars.pov +W1920 +H1080 -visual DirectColor +A0.1 +AM2
>
> Well, no, each frame the stars are painted again, randomly. :(
>
> How do I make the starfield completely static for all frames when the camera is
> moving?

    When I need a starry background in POV-Ray, I use an assortment of 
randomly-placed triangles. There are other approaches, but I prefer this 
because I like to use objects that model the simulated objects as 
closely as possible. Stars, from the sightseeing viewpoint, are just 
ultra-bright objects that are just close enough to appear as points of 
light.
    The trick is to place the stars so that at least one pixel but no 
more than four pixels overlap the star's silhouette on the computer 
screen. This will give a point of light, especially when anti-aliasing 
is used.

     Use the following code:

#local sB=sqrt(3)/min(image_height,image_width)/sCamZ;
#local pA=< 0,          sB*2/3,1>*100000;
#local pB=< sB/sqrt(3),-sB/3,  1>*100000;
#local pC=<-sB/sqrt(3),-sB/3,  1>*100000;

#local S0=seed(4);
#local cC=16;
#local sC=.5/cC;#while(sC<=1)
mesh {
#local iI=0; #while (iI<1600/cC*sCamZ*sCamZ)
   #local vAng=<rand(S0),rand(S0),rand(S0)>*360;
   #if 
(vdot(vrotate(z,vAng),vCamD)>sCamZ/vlength(<sCamR/2,sCamU/2,sCamZ>) | 
AllStars)
     triangle { vrotate(pA,vAng), vrotate(pB,vAng), vrotate(pC,vAng) }
   #end
#local iI=iI+1; #end
   no_shadow
pigment { rgb 
<max(0,-(sC-1)*2),min(sC*4,-(sC-1)*4),max(0,(sC-.25)*4)>*.2+.8 }
finish { ambient 1 diffuse 0 }

//  scale Beyond
   translate pCamL
}
#local sC=sC+1/cC;#end

A number of parameters are used here that you'll need to define first:

* AllStars: If true, forces all stars to be made. When false prevents 
creation of off-camera stars
* Beyond: This is commented out because you may not need it. If any of 
the stars appear in front of other objects in your scene, take out the 
slashes and set Beyond to some value that puts the stars beyond all of 
the other scene objects.
* cC: This sets the number of shades of color the stars will have. Stars 
will range in color from reddish to bluish.
* pCamL: The location setting of your camera.
* sCamR: The length of the right parameter of the camera. If you didn't 
specify a right vector in the camera, use a value of 4/3 here.
* sCamU: The length of the up parameter of the camera. If you didn't 
specify this parameter in the camera statement, use 1 here.
* sCamZ: The length of the direction vector in your camera. If you 
specify the angle in your camera, then set this value equal to 
cot(radians(angle)/2)*4/3. If you didn't specify either direction or 
angle, use 1 here.
* vCamD: The normalized value of the direction vector in your camera

Hope this helps,
John


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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