POV-Ray : Newsgroups : povray.pov4.discussion.general : 3D warp repeat for primitives Server Time
27 Dec 2024 20:36:18 EST (-0500)
  3D warp repeat for primitives (Message 8 to 17 of 17)  
<<< Previous 7 Messages Goto Initial 10 Messages
From: jr
Subject: Re: 3D warp repeat for primitives
Date: 9 Aug 2024 13:35:00
Message: <web.66b652eac952a069c7a7971d6cde94f1@news.povray.org>
hi,

"Kenneth" <kdw### [at] gmailcom> wrote:
> ...
> As in, taking any pre-made object and turning it into a triangle mesh surface--
> even objects with holes, voids, undercuts, etc. So far, I have solved only 'step
> A'-- finding regularly-spaced points on all the surfaces, without picking
> redundant points. Even that's not quite perfect, though. The *bigger* problem is
> how to logically connect those points to make triangles... which is the 'holy
> grail' of the entire scheme, of course!

ingo wrote/published a "meshmaker" macro[*], I guess you could explore that code
for ideas, there's also a "nagging feeling" of having forgotten another mesh2
generating macro published in the NGs.

[*] which I haven't to hand, sorry.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: 3D warp repeat for primitives
Date: 9 Aug 2024 14:30:00
Message: <web.66b65f8fc952a069d5cc4ae625979125@news.povray.org>
"Kenneth" <kdw### [at] gmailcom> wrote:

> As in, taking any pre-made object and turning it into a triangle mesh surface--
> even objects with holes, voids, undercuts, etc. So far, I have solved only 'step
> A'-- finding regularly-spaced points on all the surfaces, without picking
> redundant points. Even that's not quite perfect, though.

Using something like a progressive trace () to generate a crossing number (used
for insidedness tests for polygons, but storing all of the crossing points would
allow this.

https://news.povray.org/povray.pov4.discussion.general/message/%3Cweb.662158a818d5960295196c9d25979125%40news.povray.or
g%3E/#%3Cweb.662158a818d5960295196c9d25979125%40news.povray.org%3E

> The *bigger* problem is
> how to logically connect those points to make triangles... which is the 'holy
> grail' of the entire scheme, of course!

Well, that's why it's easy to convert parametric shapes into meshes, since you
can cycle through the values and calculate where the next point is.

Looking at primitive CSG's or isosurfaces, you're sort of working backwards.
You have a value of sorts, but you don't have access to the underlying mechanism
of how it was generated. (This is also what bothers me about POV-Ray's
parametric {} object - why the hell is it so slow? )

Anyway, none of that really has to do with the repeat warp mechanism for
primitives. . .

- BW


Post a reply to this message

From: Thomas de Groot
Subject: Re: 3D warp repeat for primitives
Date: 10 Aug 2024 03:32:29
Message: <66b7178d$1@news.povray.org>
Op 9-8-2024 om 19:33 schreef jr:
> ingo wrote/published a "meshmaker" macro[*], I guess you could explore that code
> for ideas, there's also a "nagging feeling" of having forgotten another mesh2
> generating macro published in the NGs.
> 
> [*] which I haven't to hand, sorry.
> 
> 
I add it here.

I have used it, though I don't remember when exactly, I should have a 
pov-scene somewhere.... (looking for it)

-- 
Thomas


Post a reply to this message


Attachments:
Download 'makemesh.inc.txt' (6 KB)

From: Thomas de Groot
Subject: Re: 3D warp repeat for primitives
Date: 10 Aug 2024 03:56:07
Message: <66b71d17$1@news.povray.org>
Op 10-8-2024 om 09:32 schreef Thomas de Groot:
> Op 9-8-2024 om 19:33 schreef jr:
>> ingo wrote/published a "meshmaker" macro[*], I guess you could explore 
>> that code
>> for ideas, there's also a "nagging feeling" of having forgotten 
>> another mesh2
>> generating macro published in the NGs.
>>
>> [*] which I haven't to hand, sorry.
>>
>>
> I add it here.
> 
> I have used it, though I don't remember when exactly, I should have a 
> pov-scene somewhere.... (looking for it)
> 
My memory is not what it has been :(

meshmaker.inc can be found in the official POV-Ray/include folder.....

-- 
Thomas


Post a reply to this message

From: jr
Subject: Re: 3D warp repeat for primitives
Date: 10 Aug 2024 05:00:00
Message: <web.66b72b6bc952a069c7a7971d6cde94f1@news.povray.org>
hi,

Thomas de Groot <tho### [at] degrootorg> wrote:
> ...
> My memory is not what it has been :(

know the feeling..


> meshmaker.inc can be found in the official POV-Ray/include folder.....

perhaps that is what I was thinking of, unsure now :-).


@Kenneth

fwiw, I had a look in "the collection" too, and got 2 and-a-half :-) "hits":

/meshrelief
The meshrelief include file comprises a set of macros that create meshes of
simple shapes, and displace the surfaces according to a predefined pigment.
These macros are intended for creating realistic, but relatively low-detail,
building blocks that can be copied many times to build structures, and render
many times faster than the equivalent isosurfaces.

/meshlathe
Lathes are often useful to easily create objects like wineglasses, pots, etc.
However, often they can be rather slow to render. This include file creates a
triangle mesh from a spline by rotating it around the y axis, similarly to how
the lathe object works. Several options and parameters to define the amount of
triangles and debugging features are supported, as demonstrated in the example
pov file and the image (rendered from it).

/scroll  (Scroll_array2mesh2.inc)
Include file for the Scroll_Mesh2FromArray macro takes an array of Positions and
generates a mesh2 object.

if you're interested, I can post the zip(s).


regards, jr.


Post a reply to this message

From: Cousin Ricky
Subject: Re: 3D warp repeat for primitives
Date: 10 Aug 2024 12:10:13
Message: <66b790e5$1@news.povray.org>
On 2024-08-10 03:56 (-4), Thomas de Groot wrote:
> 
> meshmaker.inc can be found in the official POV-Ray/include folder.....

If you are using POV-Ray 3.7, please note that there is a bug in
meshmaker.inc 3.7.  It is fixed in POV-Ray 3.8, and should work without
modification if you copy it to your 3.7 include folder.


Post a reply to this message

From: Thomas de Groot
Subject: Re: 3D warp repeat for primitives
Date: 11 Aug 2024 03:13:39
Message: <66b864a3$1@news.povray.org>
Op 10-8-2024 om 18:10 schreef Cousin Ricky:
> On 2024-08-10 03:56 (-4), Thomas de Groot wrote:
>>
>> meshmaker.inc can be found in the official POV-Ray/include folder.....
> 
> If you are using POV-Ray 3.7, please note that there is a bug in
> meshmaker.inc 3.7.  It is fixed in POV-Ray 3.8, and should work without
> modification if you copy it to your 3.7 include folder.
> 
Ah! Good to remind us of this, and thanks!

I use 3.8 most of the time, but I shall do as you say.

-- 
Thomas


Post a reply to this message

From: Kenneth
Subject: Re: 3D warp repeat for primitives
Date: 16 Aug 2024 17:15:00
Message: <web.66bfc0a0c952a06991c33a706e066e29@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:

> When we have meshes, with multiple instantiations, we merely apply a
> transformation matrix to the reference mesh in order to do the calculations to
> find the new position of the copy.
>
> If we simply apply the same methods to ACTUAL TEXTURED OBJECTS, then we
> ought to be able to accomplish exactly the same thing.   When I texture an
> object, and THEN translate it, the texture "follows" it.  So i ought to be
> able to define a unit cell with a vector, and then simply use mod () to
> repeat that unit EVERYWHERE.
>
> The attached is an isosurface of a 100 x 100 grid using mod () which rendered
> in 7 seconds.  We KNOW primitives render much faster than isosurfaces, and
> so would be a feasible way to accomplish the same thing only using all of
> the native optimizing of CSG objects.

(Sorry for the long delay in responding. I finally got a little bit of free
time-- but then my internet connection went down completely for 3 days; no clue
as to why. There's a bad technical glitch somewhere...) Anyway...

SO...From your isosurface/spheres render-- as your analogue-- I have a much
clearer idea of what you're after: a (quasi-)infinite built-in 'pattern' of 3-D
objects via a warp/repeat or some such, using any(?) kind of pre-made object as
the 'unit', not just a sphere. Then the underlying pattern mechanism can place
the objects within a pre-defined(?) set of planes, appearing to go to infinity
in at least 2 if not all 3 axes (but constrained by the planes.) And
accomplished very quickly, because the basic pattern is built-in behind the
scenes, rather than having to code the entire shebang in SDL. Correct so far?

It's an intriguing idea...but I still wonder if *nearly* the same thing could be
accomplished visually-- albeit in a much slower way-- by nested #for loops, to
place the (*many!*) objects in such a grid-like arrangement, 'appearing' to go
to infinity even though the loops have finite start and end locations.

As has been mentioned, even POV-ray's typical built-in patterns-- when applied
to a plane, for example-- lose their definition the farther the pattern is from
the camera. So having the 3-D objects go all the way to 'infinity' (i.e.
quasi-infinity) may not be necessary anyway; instead, only as far as what looks
like infinity, before they lose their definition too. (I hope that makes sense.)

And if the camera moves during an animation, it seems to me that the #for-loop
construction could easily be adjusted to keep the many objects looking like they
still go out to quasi-infinity (by changing the finite start and end locations
in the loops.)

But I agree that it would be nice to have such an 'infinite 3-D-object pattern'
built-in, if only for the vast parse/render-speed increase.

BTW: If your code for your red-spheres-isosurface analogue scene is still
intact, would you mind posting it here? I would like to see how and where you
used your 'mod' code to get the repeating spheres in the isosurface. I haven't
used such a trick before.


Post a reply to this message

From: Bald Eagle
Subject: Re: 3D warp repeat for primitives
Date: 16 Aug 2024 21:20:00
Message: <web.66bffa2ec952a0691f9dae3025979125@news.povray.org>
> SO...From your isosurface/spheres render-- as your analogue-- I have a much
> clearer idea of what you're after: a (quasi-)infinite built-in 'pattern' of 3-D
> objects via a warp/repeat or some such, using any(?) kind of pre-made object as
> the 'unit', not just a sphere.

YES.

> Then the underlying pattern mechanism can place
> the objects within a pre-defined(?) set of planes, appearing to go to infinity
> in at least 2 if not all 3 axes (but constrained by the planes.) And
> accomplished very quickly, because the basic pattern is built-in behind the
> scenes, rather than having to code the entire shebang in SDL. Correct so far?

Well - the objects are coded in SDL.
The repeating unit cell is defined by the "vector" or however the actual
implementation would be defined.   Maybe just an automatic bounding box of the
union.
(The set of planes is just sort of a way to bound the isosurface analogue - we
likely don't need it for the actual source implementation)
Then the way the pattern is repeated is handled by the warp specified by the
user.


> It's an intriguing idea...but I still wonder if *nearly* the same thing could be
> accomplished visually-- albeit in a much slower way-- by nested #for loops, to
> place the (*many!*) objects in such a grid-like arrangement, 'appearing' to go
> to infinity even though the loops have finite start and end locations.

Well yes - we can fake such things - but what if we're talking about an
isosurface or a parametric.  Or _anything_ that renders slowly.
The magic of mod () is that when you solve the equation for <x, y, z> once, you
have solved it for every mod (<x, y, z>, N) in all of 3D space.
Because everything is just a copy of that basis unit cell.
Obviously lighting and shadow and everything else needs to be calculated because
the absolute coordinates are different and there are differences in lighting and
proximity to other scene elements - but the geometry and texture is already
established at that point for every analogous point in every other unit cell.

> As has been mentioned, even POV-ray's typical built-in patterns-- when applied
> to a plane, for example-- lose their definition the farther the pattern is from
> the camera. So having the 3-D objects go all the way to 'infinity' (i.e.
> quasi-infinity) may not be necessary anyway; instead, only as far as what looks
> like infinity, before they lose their definition too. (I hope that makes sense.)

Yes, yes, we can fake many things - but that's not the point.

> And if the camera moves during an animation, it seems to me that the #for-loop
> construction could easily be adjusted to keep the many objects looking like they
> still go out to quasi-infinity (by changing the finite start and end locations
> in the loops.)

But that has to be babysat by the (new) user.
How would you like to have to explicitly define the extent of any pigment {}
statement that you used in a scene rather than just being able to rely on the
fact that that procedural pattern is inherent in the very 3D-space of the scene?

> But I agree that it would be nice to have such an 'infinite 3-D-object pattern'
> built-in, if only for the vast parse/render-speed increase.

It would be faster and require far less memory.

> BTW: If your code for your red-spheres-isosurface analogue scene is still
> intact, would you mind posting it here? I would like to see how and where you
> used your 'mod' code to get the repeating spheres in the isosurface. I haven't
> used such a trick before.

Of course.
Notice that that entire thing is a single isosurface.

You have Mike Williams' site that I converted to PDF - just search for "mod" and
it ought to be the first search result.

Also read his web page on holes to see an(other) excellent example of how
efficient and fast "baking" a feature into the equations is.


Notice that I have ONE shape - a sphere with a radius of 0.5, so that the
diameter is the width of a unit cell. Mod () takes care of the rest no matter
how large you set Ext to be, or where (in that narrow slice of space) you
position the contained_by box.
------------------------------------------------------------------------

#version 3.8;
global_settings {assumed_gamma 1.0 }

camera {
 location <0, 4, -40>
 right x*image_width/image_height
 up y
 look_at <0, 0, 0>
}

light_source {<0, 5, -50> rgb 1}

sky_sphere {pigment {rgb 1}}

#declare Ext = 100;
#declare Radius = 0.5;
#declare Sphere = function (X, Y, Z) {sqrt(X*X+Y*Y+Z*Z)-Radius}
isosurface {
   function {Sphere (mod(abs(x),1)-0.5, y, mod(abs(z),1)-0.5)}
   max_gradient 1

   accuracy     0.001
   contained_by {box {-<Ext, 0.6, Ext>, <Ext, 0.6, Ext>}}
     texture {pigment {rgb x} finish {specular 0.4}}
}


Post a reply to this message

From: Bald Eagle
Subject: Re: 3D warp repeat for primitives
Date: 16 Aug 2024 21:45:00
Message: <web.66bfffbdc952a0691f9dae3025979125@news.povray.org>
And to follow up a little further on that,

See:
http://news.povray.org/povray.binaries.images/thread/%3Cweb.5d3c5fe27be432e04eec112d0%40news.povray.org%3E/?ttop=443897
&toff=600

All of those rocks are a single isosurface.

I can pattern them uniquely, as I have, but having a ray intersection that
triggers - not the usual texture evaluation - but a blindingly faster stored
value from a "lookup table" derived from a single evaluation of the basis unit
cell - I think would make a scene with a complex texture render MUCH faster.

Mod () is just a "portal" to the cell defined by the magnitude of the divisor.
A grid of TV screens all showing the same image.  Cahnge the image, change ALL
the cells.
You don't have a lot of images where you have to change all of them
individually.
https://en.wikipedia.org/wiki/Modulo

Just think about making your faked pattern with real objects.
Let's say its a Lego.
You place all the Legos next to each other - but you already know what the next
spot is going to look like even before it gets filled in, because they're all
identical to the first Lego.  The Nth Lego is just an identical copy of the
first one.
And the unit cell is defined by the dimensions of the Lego - that's your unit.

But you can still make them all "look different" - even though the underlying
pigment is the same - by lining them up so they go through a tunnel and out
again, and only lighting them from one side.


Post a reply to this message

<<< Previous 7 Messages Goto Initial 10 Messages

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