POV-Ray : Newsgroups : povray.advanced-users : Mathematical "Primitive" vs Isosurface Server Time: 19 Aug 2019 14:35:08 GMT
  Mathematical "Primitive" vs Isosurface (Message 1 to 5 of 5)  
From: Bald Eagle
Subject: Mathematical "Primitive" vs Isosurface
Date: 6 Aug 2019 21:10:01
Message: <web.5d49eb917a31cceb4eec112d0@news.povray.org>
Aside from the obvious user-defined vs implemented in source code,

can someone define and differentiate the difference between a "mathematical
primitive" like a

     sphere {0, 1}

and an isosurface object such as

     isosurface {function { x*x + y*y + z*z - 1 }} ?


Post a reply to this message

From: Le Forgeron
Subject: Re: Mathematical "Primitive" vs Isosurface
Date: 7 Aug 2019 15:47:08
Message: <5d4af27c$1@news.povray.org>
Le 06/08/2019 à 23:05, Bald Eagle a écrit :
> 
> Aside from the obvious user-defined vs implemented in source code,
> 
> can someone define and differentiate the difference between a "mathematical
> primitive" like a
> 
>      sphere {0, 1}
> 
> and an isosurface object such as
> 
>      isosurface {function { x*x + y*y + z*z - 1 }} ?
> 

The generic function need to be evaluated in various points along the
ray/path, to solve the root(s).
No intrinsic knowledge of the properties of the function is used.
The good side is that the evaluation is limited to a container.
The bad side is that bounding box optimisation is only a dream.
The computation of fancy position uses the provided data.
The computation of the function uses a virtual machine, which can be
non-optimal for the native CPU.


The native sphere: we can use its properties.
The maximal number of roots (intersection with a ray) is known.
Computing all the roots for a path is simple, without intermediate
evaluations.
The computation of fancy position uses a translation to reduce the
problem to a sphere at the origin. This might have an impact on native
precision when translated back.
UV-mapping might be available. (from coordinate of intersection to
uv-values)


Post a reply to this message

From: Bald Eagle
Subject: Re: Mathematical "Primitive" vs Isosurface
Date: 7 Aug 2019 20:20:00
Message: <web.5d4b31a665080b014eec112d0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:

> The generic function need to be evaluated in various points along the
> ray/path, to solve the root(s).
> No intrinsic knowledge of the properties of the function is used.
> The good side is that the evaluation is limited to a container.
> The bad side is that bounding box optimisation is only a dream.
> The computation of fancy position uses the provided data.
> The computation of the function uses a virtual machine, which can be
> non-optimal for the native CPU.


> The native sphere: we can use its properties.

But, the properties of sphere {} and isosurface {} should be the same --- no?

> The maximal number of roots (intersection with a ray) is known.

So, is the source-code sphere evaluated or defined in a different way than an
isosurface function of the same sphere?

> Computing all the roots for a path is simple, without intermediate
> evaluations.

Does that mean that there are shortcuts in the source code, whereas for a user
defined isosurface sphere, those can't be used?

> The computation of fancy position uses a translation to reduce the
> problem to a sphere at the origin. This might have an impact on native
> precision when translated back.
> UV-mapping might be available. (from coordinate of intersection to
> uv-values)


It seems to me that, aside from some issues of speed and accuracy, there are
largely "the same".

If this is the case, then is there anything preventing the implementation of
pseudo-Boolean operations like "soft minimum" or other variants, that provide a
smoothing of the hard boundaries?

http://iquilezles.org/www/articles/smin/smin.htm

Smooth Union, Subtraction and Intersection - exact, bound, bound
http://iquilezles.org/www/articles/distfunctions/distfunctions.htm


That would seem to address most of what a lot of people have been requesting for
quite some time with regard to rounded edges and "fillets".

http://news.povray.org/povray.general/thread/%3Cweb.57c1c5e4750b03f1a7cafab50%40news.povray.org%3E/?mtop=410897

http://news.povray.org/povray.binaries.images/thread/%3C418e6d4e@news.povray.org%3E/

I've already implemented about 4 of these, and they seem to produce very nice
transitions between shapes.   Still need to spend some time exploring some more
experiments with these, but I'm wondering if some of these could be added in
source code to manipulate primitives or more complex CSG objects, and -

if it would be possible or advantageous in any way to add a user-defined
pseudo-Boolean blending operation.  Simply because, having tried to do some very
detailed and extensive work with isosurfaces, the manner in which the functions
need to be constructed can be very cumbersome.  With "primitives", object
modifiers such as translate rotate scale, etc are easy to add in before applying
the Boolean operator.


Post a reply to this message

From: Le Forgeron
Subject: Re: Mathematical "Primitive" vs Isosurface
Date: 8 Aug 2019 16:02:58
Message: <5d4c47b2$1@news.povray.org>
Le 07/08/2019 à 22:16, Bald Eagle a écrit :
> 
> Le_Forgeron <jgr### [at] freefr> wrote:
> 
>> The generic function need to be evaluated in various points along the
>> ray/path, to solve the root(s).
>> No intrinsic knowledge of the properties of the function is used.
>> The good side is that the evaluation is limited to a container.
>> The bad side is that bounding box optimisation is only a dream.
>> The computation of fancy position uses the provided data.
>> The computation of the function uses a virtual machine, which can be
>> non-optimal for the native CPU.
> 
> 
>> The native sphere: we can use its properties.
> 
> But, the properties of sphere {} and isosurface {} should be the same --- no?
> 

From the point of view of the code, no.

isosurface defines a "potential", a value for every point of space.
And finding the intersections with the surface which delimit the
positive from the negative is the jobs of a solver.

sphere {} is only a surface that delimit the separation between inside
and outside. there is no "potential" for every point of space. At best,
you can know if it is inside or outside.

>> The maximal number of roots (intersection with a ray) is known.
> 
> So, is the source-code sphere evaluated or defined in a different way than an
> isosurface function of the same sphere?

Yes.

> 
>> Computing all the roots for a path is simple, without intermediate
>> evaluations.
> 
> Does that mean that there are shortcuts in the source code, whereas for a user
> defined isosurface sphere, those can't be used?
> 

Exactly.

>> The computation of fancy position uses a translation to reduce the
>> problem to a sphere at the origin. This might have an impact on native
>> precision when translated back.
>> UV-mapping might be available. (from coordinate of intersection to
>> uv-values)
> 
> 
> It seems to me that, aside from some issues of speed and accuracy, there are
> largely "the same".
> 

Of course, they are mathematically the same. But the way it get computed
is very different.

> If this is the case, then is there anything preventing the implementation of
> pseudo-Boolean operations like "soft minimum" or other variants, that provide a
> smoothing of the hard boundaries?
> 
> http://iquilezles.org/www/articles/smin/smin.htm
> 
> Smooth Union, Subtraction and Intersection - exact, bound, bound
> http://iquilezles.org/www/articles/distfunctions/distfunctions.htm
> 
> 
> That would seem to address most of what a lot of people have been requesting for
> quite some time with regard to rounded edges and "fillets".
> 

why do I have a feeling of another return of the blob ?
(blob have sphere & cylinder, and they have nothing in common with the
code of native sphere and cylinder)




>
http://news.povray.org/povray.general/thread/%3Cweb.57c1c5e4750b03f1a7cafab50%40news.povray.org%3E/?mtop=410897
> 
> http://news.povray.org/povray.binaries.images/thread/%3C418e6d4e@news.povray.org%3E/
> 
> I've already implemented about 4 of these, and they seem to produce very nice
> transitions between shapes.   Still need to spend some time exploring some more
> experiments with these, but I'm wondering if some of these could be added in
> source code to manipulate primitives or more complex CSG objects, and -
> 
> if it would be possible or advantageous in any way to add a user-defined
> pseudo-Boolean blending operation.  Simply because, having tried to do some very
> detailed and extensive work with isosurfaces, the manner in which the functions
> need to be constructed can be very cumbersome.  With "primitives", object
> modifiers such as translate rotate scale, etc are easy to add in before applying
> the Boolean operator.

Can you use macro to combine the various surfaces ?
With optional argument such as a transformation matrix.

SPHERE( center, radius )
GLUE()
SPHERE( center, radius, transform )

or something along ?

And the scary details are handled inside the macro ?


Post a reply to this message

From: Bald Eagle
Subject: Re: Mathematical "Primitive" vs Isosurface
Date: 8 Aug 2019 17:40:06
Message: <web.5d4c5da965080b014eec112d0@news.povray.org>
Le_Forgeron <jgr### [at] freefr> wrote:

> > But, the properties of sphere {} and isosurface {} should be the same --- no?

> From the point of view of the code, no.

Yes, the code is always different.  I just wondered _how_ different.


> isosurface defines a "potential", a value for every point of space.

> sphere {} is only a surface that delimit the separation between inside
> and outside. there is no "potential" for every point of space. At best,
> you can know if it is inside or outside.

Mmmmmmmmm..... I will take a look at the source when I have some time to find
it, but I would have to guess that if a sphere is a "mathematical primitive",
then it is based on an equation that defines the surface, and the ray-object
intersection equation uses >, =, and < to determine inside or outside or
right-on.

does the "potential" exist only because of the way the code evaluates an
isosurface, and the "potential" for a sphere, while extant, and mathematically
identical is simply inaccessible due to the specialized structure of the code
for rendering primitives?

> why do I have a feeling of another return of the blob ?
> (blob have sphere & cylinder, and they have nothing in common with the
> code of native sphere and cylinder)

I've never looked at the blob / metaball code or have any knowledge of the
history of its development.  Sounds like a messy story.  ;D


> Can you use macro to combine the various surfaces ?
> With optional argument such as a transformation matrix.
>
> SPHERE( center, radius )
> GLUE()
> SPHERE( center, radius, transform )
>
> or something along ?
>
> And the scary details are handled inside the macro ?


I did some thinking about this post-coffee and pre-heavy lifting.  My thoughts
(for proof of concept) were similar - use a macro to define the various
transformation matrices and then multiply them together, and then define
functions for the final x, y, and z transformations before plugging them into
the function for the shape.
So, your idea to do it in a similar way is encouraging.  :)



And that's fine for making my head hurt, flexing the mental muscles, and playing
around with the idea to illustrate what may be possible...

But really, the end goal would be to have different types of customizable
Boolean operators in the source code.

Then, it would be a simple matter of something like
smoothunion {box{} sphere {} method 1 strength 0.1}


Post a reply to this message

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