POV-Ray : Newsgroups : povray.binaries.images : Cylindrical pattern animation - how to get the circles/dots overlap Server Time
14 Jun 2026 02:14:39 EDT (-0400)
  Cylindrical pattern animation - how to get the circles/dots overlap (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Jörg "Yadgar" Bleimann
Subject: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 12 Jun 2026 11:32:30
Message: <6a2c268e$1@news.povray.org>
Hi(gh)!

As a background for an animated text imploring a dear friend to buy a 
new laptop, I want to have a white mesh2 screen with slowly growing 
black polka dots, which finally overlap until no white is visible 
anymore - but instead they just stop growing as they touch each other!

Is there a way to keep them growing anyway? Or do I have to use a 
different pigment pattern?

Here is the code:

// begin code:

/* #declare loop=div(clock,200);
#switch(loop)
   #case(0) */
     #declare OuterColor=<1, 1, 1>;
     #declare InnerColor=<0, 0, 0>;
     #declare TranslateVector=<-0.005, -0.0035, 0>;
/*  #break
#end */


mesh2
{
   vertex_vectors
   {
     4
     <-1, 0.5, 1>, <3, 0.5, 1>, <-1, -0.5, -1>, <3, -0.5, 1>
   }
   face_indices
   {
     2
     <0, 1, 2>, <1, 2, 3>
   }
   texture
   {
     pigment
     {
       cylindrical
       rotate <90, 0, 0>
       translate <1, 1, 0>
       warp { repeat x*2 }
       warp { repeat y*2 }
       color_map
       {
         [0 color rgb OuterColor]
         [1-clock/105 color rgb OuterColor]
         [1-clock/105 color rgb InnerColor]
         [1 color rgb InnerColor]
       }
     }
     finish { ambient 1 diffuse 0 }
     scale 0.05
     translate clock*TranslateVector
   }
}

camera
{
   orthographic
   location <1, 0.15, -5>
   look_at <1, 0.15, 0>
   right <1000, 0, 0>
   up <0, 100, 0>
   angle 40
}

See you in Khyberspace!

Yadgar

Now playing: Infinitude (Richard Vimal)
-- 
VBI BENE, IBI BACTRIA!


Post a reply to this message

From: Bald Eagle
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 12 Jun 2026 15:15:00
Message: <web.6a2c5a15a47dc4fff58bc24b25979125@news.povray.org>
> I want to have a white mesh2 screen with slowly growing
> black polka dots, which finally overlap until no white is visible
> anymore - but instead they just stop growing as they touch each other!
>
> Is there a way to keep them growing anyway? Or do I have to use a
> different pigment pattern?

You need to use a different pigment pattern.
"The cylindrical pattern creates a one unit radius cylinder along the Y axis.
..... It starts at 1.0 at the origin and decreases to a minimum value of 0.0 as
it approaches a distance of 1 unit from the Y axis. It remains at 0.0 for all
areas beyond that distance."

https://wiki.povray.org/content/Reference:Cylindrical_Pattern

You probably want to use something like a
pigment { function {}} block, where you use sqrt(x*x+y*y) < Radius.
And then use your clock to change the radius
(that would give you a single growing disk)

To get around that, use sqrt (mod(x,1)*mod(x,1)+mod(y,1)*mod(y,1)) which will
make every disk repeat every unit.

But then you have to center them, using Mike Williams' repeat unit fix.
"Using mod(x,2) will cause the shape to be repeated in the x direction every 2
units. If your original isosurface
created a shape centred at the origin, then there's a problem with the way that
it chooses which bits to repeat.
The left half of the object gets repeated in one direction and the right half of
the object gets repeated in the other
direction. To fix this, we'd like to substitute mod(x,2)+1 where x is negative
and mod(x,2)-1 where x is positive. To
fix both directions at once, for a symmetrical object, we can use abs(x) like
this mod(abs(x),2)-1.
Page 17 of 149
To change the length of the repeat unit we can do this mod(abs(x),Step)-Step/2."

Which should give you:
sqrt ( (mod(abs(x),2)-1) * (mod(abs(x),2)-1) + (mod(abs(y),2)-1) *
(mod(abs(y),2)-1) )

If you just use the function value, you'll probably get a gradient.
You can use the above function to calculate a value by subtracting it from your
radius.  Use that as the first argument in a select() statement, and return 1 or
0 to get a hard white to black transition.

Hope that's understandable and helps.

- BE


Post a reply to this message

From: Bald Eagle
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 12 Jun 2026 15:30:00
Message: <web.6a2c5e07a47dc4fff58bc24b25979125@news.povray.org>
So, try this:

If you take your clock value and multiply it by sqrt(2), then the black will
reach all the way into the corner of each square, and will give you a fully
black texture.

- BE




#version 3.7;
global_settings{ assumed_gamma 1.0 }
#default {finish {ambient 0 diffuse 1} }


camera {
 //orthographic
 location <0,0,-50>     // position & direction of view
 look_at  <0,0,0>
 right    x*image_width/image_height
}

sky_sphere {pigment {rgb 1}}
light_source {<0, 0, -100> rgb 1}

#declare Dots = function {sqrt ( (mod(abs(x),2)-1) * (mod(abs(x),2)-1) +
(mod(abs(y),2)-1) *
(mod(abs(y),2)-1) )}


#declare Radius = sqrt(2);

plane {z, 0 pigment {function {select (Dots (x, y, z) - Radius, 0, 1)} } }


Post a reply to this message

From: Jörg "Yadgar" Bleimann
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 12 Jun 2026 18:00:18
Message: <6a2c8172$1@news.povray.org>
Hi(gh)!

Am 12.06.26 um 21:29 schrieb Bald Eagle:

> plane {z, 0 pigment {function {select (Dots (x, y, z) - Radius, 0, 1)} } }

Just for better understandig: what do the second and third parameters of 
select() represent? Are they just compressed rgb vectors, i. e. black 
and white?

See you in Khyberspace!

Yadgar

-- 
VBI BENE, IBI BACTRIA!


Post a reply to this message

From: Bald Eagle
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 12 Jun 2026 21:05:00
Message: <web.6a2cac74a47dc4ffd1d09a9825979125@news.povray.org>
> Just for better understandig: what do the second and third parameters of
> select() represent? Are they just compressed rgb vectors, i. e. black
> and white?

Yes.  0 gets vector-promoted to rgb <0, 0, 0>, and 1 gets vector-promoted to rgb
<1, 1, 1>.


Post a reply to this message

From: Jörg "Yadgar" Bleimann
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 13 Jun 2026 07:40:02
Message: <6a2d4192$1@news.povray.org>
Hi(gh)!

Am 13.06.26 um 03:03 schrieb Bald Eagle:
> 
>> Just for better understandig: what do the second and third parameters of
>> select() represent? Are they just compressed rgb vectors, i. e. black
>> and white?
> 
> Yes.  0 gets vector-promoted to rgb <0, 0, 0>, and 1 gets vector-promoted to rgb
> <1, 1, 1>
Are you sure? If I replace them with actual color vectors, I get the 
error message "Parse Error: Expected 'operand', color
  keyword 'rgb' found instead"! How can I use real colors instead?

See you in Khyberspace!

Yadgar


-- 
VBI BENE, IBI BACTRIA!


Post a reply to this message

From: Bald Eagle
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 13 Jun 2026 08:00:00
Message: <web.6a2d459ca47dc4ffd1d09a9825979125@news.povray.org>
> Are you sure? If I replace them with actual color vectors, I get the
> error message "Parse Error: Expected 'operand', color
>   keyword 'rgb' found instead"!

Absolutely.

You are trying to shove a keyword and a vector into a scalar-only function that
gets parsed by the function VM.


> How can I use real colors instead?

Use a pigment_map. or a color_map.

In that case, you can even get rid of the select() statement.

The _maps do exactly that:  they map the output values of your function to
colors, pigments, textures, normals, or materials.

color_map {
  [ 0.0  rgb <0, 0, 0>]
  [ 0.5  rgb <0, 0, 0>]
  [ 0.5  rgb <1 ,1 ,1>]
  [ 1.0  rgb <1 ,1 ,1>]
}

Double entries at 0.5 give a hard transition.
Now any value below 0.5 will be black, and any value above 0.5 will be white.

- BE


Post a reply to this message

From: Jörg "Yadgar" Bleimann
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 13 Jun 2026 09:31:32
Message: <6a2d5bb4$1@news.povray.org>
Hi(gh)!

Am 13.06.26 um 13:57 schrieb Bald Eagle:

> Use a pigment_map. or a color_map.
> 
> In that case, you can even get rid of the select() statement.
> 
> The _maps do exactly that:  they map the output values of your function to
> colors, pigments, textures, normals, or materials.
> 
> color_map {
>    [ 0.0  rgb <0, 0, 0>]
>    [ 0.5  rgb <0, 0, 0>]
>    [ 0.5  rgb <1 ,1 ,1>]
>    [ 1.0  rgb <1 ,1 ,1>]
> }
> 
> Double entries at 0.5 give a hard transition.
> Now any value below 0.5 will be black, and any value above 0.5 will be white.

I tried this, but now I get rings rather than growing solid black dots, 
as you can see in the attachment (clock=20)!

See you in Khyberspace!

Yadgar




-- 
VBI BENE, IBI BACTRIA!


Post a reply to this message


Attachments:
Download 'baldeagle_test.png' (20 KB)

Preview of image 'baldeagle_test.png'
baldeagle_test.png


 

From: Bald Eagle
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 13 Jun 2026 11:30:00
Message: <web.6a2d7669a47dc4fff58bc24b25979125@news.povray.org>
> > In that case, you can even get rid of the select() statement.
Scratch that.   Keep the select () statement.

> I tried this, but now I get rings

You'll get solid dots with select.

- BE


Post a reply to this message

From: Jörg "Yadgar" Bleimann
Subject: Re: Cylindrical pattern animation - how to get the circles/dots overlap
Date: 13 Jun 2026 12:32:01
Message: <6a2d8601@news.povray.org>
Am 13.06.26 um 17:25 schrieb Bald Eagle:

> You'll get solid dots with select.

...but then, again, no other colors than black and white?

-- 
VBI BENE, IBI BACTRIA!


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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