POV-Ray : Newsgroups : povray.binaries.images : Crackle again Server Time
4 Feb 2023 20:57:39 EST (-0500)
  Crackle again (Message 7 to 16 of 17)  
<<< Previous 6 Messages Goto Latest 10 Messages Next 1 Messages >>>
From: Bill Pragnell
Subject: Re: Crackle again
Date: 24 Nov 2022 05:50:00
Message: <web.637f4aa5c37f1de022cd71f26f35e431@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> I've only just gotten back in, and haven't worked it out in enough detail to
> understand exactly how all the parts work.   I tried it with the "POVRAY"
> point set, got it to work, dabbled a bit more, and broke it again...

Everything used to generate the cells gets stored in arrays - try rendering
individual meshes to get a feel for the objects that go into the pigments.

What made me think of this method was a comment someone made in the other thread
that a field of cones could be used to generate a 2D voronoi field. My code uses
a 'depth' of 10, with 45-degree cones - the slice used by the function is just
above this y=-10 floor so tweaking might cause it to miss the objects.

The other thing I'm unsure about is how many arguments the max() function can
accept - this is probably the practical upper limit on the cell count.

> I'm wondering if there are other ways to control the colors of the cells - by
> height?  by area?

In that snippet, the BrightFn is what I use to generate the cell value 0-1; a
pigment was the obvious choice, but you might be able to do something with the
stored meshes to generate a suitable function for area... basically anything
that could feasibly be encoded in a function.

> Very interested in your mortar idea.

I was referring to the custom 'standard' crackle that you demonstrated in your
post, using the min distance from a seed point to generate the color value. The
documentation even mentions using a solid crackle with a regular crackle layered
over it to generate mortar for the solid cells.

> Also wondering if the Delaunay triangulation can be done as well.  Rendering
> the dual would be a cool effect.

No idea - this is a bit of a hack! I imagine triangulation could be done with an
SDL macro, and then the triangles could be colored however you want... but I
have no experience implementing Delaunay triangulation so I'm not sure.

> Great work, Bill - this was a very clever solution.

It was fun to think through! Now if only we could have iteration in user-defined
functions... :)

Bill


Post a reply to this message

From: Bald Eagle
Subject: Re: Crackle again
Date: 24 Nov 2022 09:15:00
Message: <web.637f7befc37f1de01f9dae3025979125@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:

> The other thing I'm unsure about is how many arguments the max() function can
> accept - this is probably the practical upper limit on the cell count.

Nope.  I the one I posted was 500, and I successfully ran one with 1500, which
was SLOW.

But also, even if there is an upper limit, just make an aggregating function
that takes the max () of other, max() functions with fewer arguments than the
limit.


> I was referring to the custom 'standard' crackle that you demonstrated in your
> post, using the min distance from a seed point to generate the color value.

"My post" ... I make a lot of them, and I don't think I've posted any with
POV-Ray's native crackle pattern.

> The
> documentation even mentions using a solid crackle with a regular crackle layered
> over it to generate mortar for the solid cells.

Interesting.   I'll have to look at that - way back in 2013, I used this method
for making mortar for my Secret Passage scene.

#declare Pigment_1 =
pigment{ crackle solid turbulence 0.35 scale 0.45
         color_map{
          [0.00 color rgb<1, 1, 1>*0]
          [0.08 color rgb<1, 1, 1>*0]
          [0.40 color rgb<1, 0.55, 0>]
          [1.00 color rgb<1, 1, 0.8>]
         } // end of color_map
} // end of pigment -----------------

#declare Roughness = 2;

//  Flagstone Texture
#declare Texture_1 =
texture {crackle form <-1, 1, 0> metric 2 offset 0.1 cubic_wave turbulence 0
scale 12
         texture_map {
  [0.00 pigment {Clear}]
  [0.01 pigment {Clear}]
  [0.01 crackle solid form <-1, 1, 0> metric 2 offset 0
   texture_map {
   [0.00 T_Stone5  normal {granite scale Roughness}]
   [0.20 T_Stone5  normal {granite scale Roughness}]

   [0.20 T_Stone14 normal {agate scale Roughness}]
   [0.40 T_Stone14 normal {agate scale Roughness}]

   [0.40 T_Stone20 normal {bumps scale Roughness}]
   [0.60 T_Stone20 normal {bumps scale Roughness}]

   [0.60 T_Stone33 normal {ripples scale Roughness}]
   [0.80 T_Stone33 normal {ripples scale Roughness}]

   [0.80 T_Stone43 normal {waves scale Roughness}]
   [1.00 T_Stone43 normal {waves scale Roughness}]
   }]  //  end of inner texture map
          } // end of outer texture_map

 } // end of texture


> > Also wondering if the Delaunay triangulation can be done as well.  Rendering
> > the dual would be a cool effect.
>
> No idea - this is a bit of a hack! I imagine triangulation could be done with an
> SDL macro, and then the triangles could be colored however you want... but I
> have no experience implementing Delaunay triangulation so I'm not sure.

Yeah - me neither, but I thought maybe you'd have another stroke of genius   :)

Also wondering if, with your existing knowledge of how your code works, if there
was a way to "draw lines" with cylinders around the borders of the cells.
Something to do with the mesh vertices perhaps....


Post a reply to this message

From: Bill Pragnell
Subject: Re: Crackle again
Date: 24 Nov 2022 09:50:00
Message: <web.637f839fc37f1de022cd71f26f35e431@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> > I was referring to the custom 'standard' crackle that you demonstrated in
> > your post, using the min distance from a seed point to generate the color
> > value.
>
> "My post" ... I make a lot of them, and I don't think I've posted any with
> POV-Ray's native crackle pattern.

Sorry; the previous crackle thread from a couple of days ago, with the custom
version you showed that just colors a point based on distance to the closest
seed point.

This one:
http://news.povray.org/povray.binaries.images/message/%3Cweb.6376dd8c302862a41f9dae3025979125%40news.povray.org%3E

> > The documentation even mentions using a solid crackle with a regular crackle
> > layered over it to generate mortar for the solid cells.
>
> Interesting.   I'll have to look at that - way back in 2013, I used this
> method for making mortar for my Secret Passage scene.

See 3.4.7.2.3 in the online reference help ('Crackle Pattern'). It's only a
brief mention. From your example though, it looks like you're comfortable with
this technique already.

> Also wondering if, with your existing knowledge of how your code works, if
> there was a way to "draw lines" with cylinders around the borders of the
> cells. Something to do with the mesh vertices perhaps....

Hmm that's a thought. It would consist of a large quantity of spheres and/or
cylinders placed around each mesh base, all as a single object pattern. It would
be much slower than using another function texture layer, but it would give an
constant thickness of mortar, which the texture method might not... I'll have to
try this out when I get the chance!

Bill


Post a reply to this message

From: Bald Eagle
Subject: Re: Crackle again
Date: 24 Nov 2022 11:00:00
Message: <web.637f94a9c37f1de01f9dae3025979125@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:

> Sorry; the previous crackle thread from a couple of days ago, with the custom
> version you showed that just colors a point based on distance to the closest
> seed point.

http://news.povray.org/povray.binaries.images/message/%3Cweb.6376dd8c302862a41f9dae3025979125%40news.povray.org%3E

Ah.  "Colors" meaning simple scalar grayscale shading.

>
> > > The documentation even mentions using a solid crackle with a regular crackle
> > > layered over it to generate mortar for the solid cells.

I think what they mean is the reverse?
"There is no provision for mortar, but mortar may be created by layering or
texture-mapping a standard crackle texture with a solid one."

It's been a while since I've messed with that, and their language there is a
little - vague.

> > Also wondering if, with your existing knowledge of how your code works, if
> > there was a way to "draw lines" with cylinders around the borders of the
> > cells. Something to do with the mesh vertices perhaps....
>
> Hmm that's a thought. It would consist of a large quantity of spheres and/or
> cylinders placed around each mesh base, all as a single object pattern.

I was actually thinking not as an object pattern, but as the native lattice of
cylinders.  Make a scene with small spheres as the center points, and make the
Voronoi with cylinder{} objects.

AND, if that's possible - then why not do the Voronoi with prism {} objects.
Then they can all be collected into an array and textured however one wants -
even manually, one at a time.

But there is obviously much to played with here.   How does it look if instead
of using cones, we use spheres, ellipsoids, superellipsoids, pyramids, etc?

http://www.f-lohmueller.de/pov_tut/all_shapes/shapes3_0000e.htm
http://www.f-lohmueller.de/pov_tut/all_shapes/shapes350e.htm

While researching this, I have also seen people use other distance metrics, such
as the "Manhattan distance" or "taxicab distance", etc.


Post a reply to this message

From: Bald Eagle
Subject: Re: Crackle again
Date: 24 Nov 2022 14:00:00
Message: <web.637fbe99c37f1de01f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> I was actually thinking not as an object pattern, but as the native lattice of
> cylinders.  Make a scene with small spheres as the center points, and make the
> Voronoi with cylinder{} objects.

Like so:


Post a reply to this message


Attachments:
Download 'billpragnellvoronoicylindertest.png' (103 KB)

Preview of image 'billpragnellvoronoicylindertest.png'
billpragnellvoronoicylindertest.png


 

From: Bald Eagle
Subject: Re: Crackle again
Date: 24 Nov 2022 14:20:00
Message: <web.637fc2e2c37f1de01f9dae3025979125@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> AND, if that's possible - then why not do the Voronoi with prism {} objects.
> Then they can all be collected into an array and textured however one wants -
> even manually, one at a time.

Here's a quick and dirty, scaling each prism height randomly.


Post a reply to this message


Attachments:
Download 'billpragnellvoronoiprismtest.png' (94 KB)

Preview of image 'billpragnellvoronoiprismtest.png'
billpragnellvoronoiprismtest.png


 

From: Bill Pragnell
Subject: Re: Crackle again
Date: 24 Nov 2022 14:35:00
Message: <web.637fc6b2c37f1de0b96893c06f35e431@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> "Bald Eagle" <cre### [at] netscapenet> wrote:
>
> > I was actually thinking not as an object pattern, but as the native lattice
> > of cylinders.  Make a scene with small spheres as the center points, and
> > make the Voronoi with cylinder{} objects.
>
> Like so:

Excellent!

I'm thinking there's scope for some optimization here - removing points between
collinear segments, removing duplicates (for drawing the edges, at least) - this
would make the cells much lighter, and if done at the right stage improve
parsing time.
Coupled with aggregation of max() as you described before (like a binary tree or
similar), this could definitely be improved :)

Different seed shapes would also be interesting.

Bill


Post a reply to this message

From: Bill Pragnell
Subject: Re: Crackle again
Date: 24 Nov 2022 14:35:00
Message: <web.637fc75bc37f1de0b96893c06f35e431@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> Here's a quick and dirty, scaling each prism height randomly.

Even more excellent!

I just need to find some time to play with it myself now :)


Post a reply to this message

From: Bill Pragnell
Subject: Re: Crackle again
Date: 24 Nov 2022 19:30:00
Message: <web.63800bdac37f1de0b96893c06f35e431@news.povray.org>
See p.t.s-f for a macro to generate 2D Voronoi polygons (including collinear
point removal!).

Here's my version of the Voronoi patchwork city :)


Post a reply to this message


Attachments:
Download 'cracklebobs2.png' (462 KB)

Preview of image 'cracklebobs2.png'
cracklebobs2.png


 

From: Bald Eagle
Subject: Re: Crackle again
Date: 25 Nov 2022 20:40:00
Message: <web.63816d6ec37f1de01f9dae3025979125@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:

> > Also wondering if the Delaunay triangulation can be done as well.  Rendering
> > the dual would be a cool effect.
>
> No idea - this is a bit of a hack! I imagine triangulation could be done with an
> SDL macro, and then the triangles could be colored however you want... but I
> have no experience implementing Delaunay triangulation so I'm not sure.

So, it looks like what happens, is that we draw a line perpendicular to a
Voronoi edge and connect it to another Voronoi center point.

https://web.archive.org/web/20170922181219/http://www.geom.uiuc.edu/~samuelp/del_project.html
(see diagrams at end)

So, somewhere, I know I have the "calculate the closest point on a line to
another point not on the line" macro.  We can use that to create a vector
perpendicular to the line, and then somewhere along that extended vector ought
to be a point in an adjacent cell.

But now I'm thinking that if we are finding the closest point when constructing
the Voronoi, can't we somehow leverage that and draw the line right when we know
our starting center and the just-found closest point?

Much to think about.

We also don't have a Delaunay pattern implemented in POV-Ray, so that would be a
cool thing to add.


Post a reply to this message

<<< Previous 6 Messages Goto Latest 10 Messages Next 1 Messages >>>

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