 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
>
> F(x,y,z,t) =
> select ( (y<(44/10)) * (y>-(24/10)),
> 0, 1, ThickIsoExterior((10*x/15),y,z,t)
> )
>
> Hope that makes sense.
Hi BE,
I followed your advice with respect to select() and added the appropriate code
using the boolean & instead of multiply.
And it works - well, not the way it should.
I believe there is something wrong in my Povray code which is hard for me to
find out.
I added AT's equations as comment above the Povray code.
Meanwhile I read the threads initiated by klp in Povray's advanced users
<6752dcbc@news.povray.org>
in Dec 2024 about the topic but I could not find the solution there.
The interesting thing about my misinterpretation of AT's equations is:
(1) setting threshold 1 and accuracy 0.01 (max_gradient 2352446)
==> Povray renders something solid (not the object I was expecting)
==> Trace Time: 1h 38 min using 16 threads
(2) setting threshold 0 and accuracy 0.01 (max_gradient 2352446)
==> Povray renders something invisible
==> Trace Time: about the same as above
(3) setting threshold 0.01 and accuracy 0.1 (max_gradient 2352446)
==> Povray renders an object that looks like being peeled
==> Trace Time: 0h 39 min using 16 threads
And no, Povray doesn't complain about gaps in the object!
I will post an image of (1) and (3) in p.b.i
Thanks for your patience
Droj
Post a reply to this message
Attachments:
Download 'iso_devil_plate_test.pov.txt' (4 KB)
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I don't know what your ultimate goal is, but when I just evaluated the
isosurface for
function {DevilFn2(x,y,z)
I get the following render (Cam and lights adjusted, white sky_sphere)
- BW
Post a reply to this message
Attachments:
Download 'iso_devil_plate_test.png' (39 KB)
Preview of image 'iso_devil_plate_test.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> I don't know what your ultimate goal is, but when I just evaluated the
> isosurface for
>
> function {DevilFn2(x,y,z)
>
> I get the following render (Cam and lights adjusted, white sky_sphere)
>
> - BW
When you render the function #declare Iso = function(x,y,z) {
you get the image attached.
The next 2 functions should add thickness to the shape (you see the rim of the
'plate' is thin like an eggshell).
And this is where the flaw is.
Droj
Post a reply to this message
Attachments:
Download 'iso_devil_plate.png' (77 KB)
Preview of image 'iso_devil_plate.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Try Mike Williams' isosurface thickening trick:
Thickening
If we have a function F(x,y,z) we can turn it into two parallel surfaces by
using abs(F(x,y,z))-C where C is some
small value. The original function should be one that works with zero threshold.
The two resulting surfaces are
what you would get by rendering the original function with threshold +C and -C,
but combined into a single
image. The space between the two surfaces becomes the "inside" of the object. In
this way we can construct
things like glasses and cups that have walls of non-zero thickness.
#declare F = function {y + f_noise3d (x*2, 0, z*2)}
isosurface {
function {abs (F(x, y, z))-0.1}
....
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 28.04.2025 um 20:26 schrieb Bald Eagle:
> Try Mike Williams' isosurface thickening trick:
>
> Thickening
> If we have a function F(x,y,z) we can turn it into two parallel surfaces by
> using abs(F(x,y,z))-C where C is some
> small value. The original function should be one that works with zero threshold.
> The two resulting surfaces are
> what you would get by rendering the original function with threshold +C and -C,
> but combined into a single
> image. The space between the two surfaces becomes the "inside" of the object. In
> this way we can construct
> things like glasses and cups that have walls of non-zero thickness.
> #declare F = function {y + f_noise3d (x*2, 0, z*2)}
> isosurface {
> function {abs (F(x, y, z))-0.1}
> ....
>
>
Obviously this should work. But I run into a problem with this approach.
The yellow object depictes the devils plate function without any thickening:
#declare c=1/10000;
#declare Th=1/10;
#declare Devil = function(x,y,z) {
x*x*x*x+2*x*x*z*z-36/100*x*x-y*y*y*y+25/100*y*y+z*z*z*z }
#declare Devil2 = function(x,y,z) { Devil(x,sqrt(y*y+z*z)-15/10,z) }
#declare IsoExterior = function (x,y,z) { Devil2(x,y,sqrt(x*x+z*z)-15/10) }
isosurface { function { IsoExterior(x,y,z) }
contained_by { box { <-45/10,-25/10,-75/10>,<45/10,45/10,75/10> } }
threshold 0.0
open
max_gradient 2500
pigment { colour Yellow }
}
The red object shows the approach by Abderrahman Taha (MathMod). He
calculates the numerical derivatives to approximate the normals. Then
the shape is shifted a small amount along and against these normals.
Finally, both functions are multiplied to form the sets of points at
which at least one of the functions returns the value zero - the
threshold that is then used in the isosurface:
// numerical derivatives
#declare DFx = function(x,y,z) {
(IsoExterior(x+c,y,z)-IsoExterior(x,y,z))/c }
#declare DFy = function(x,y,z) {
(IsoExterior(x,y+c,z)-IsoExterior(x,y,z))/c }
#declare DFz = function(x,y,z) {
(IsoExterior(x,y,z+c)-IsoExterior(x,y,z))/c }
// normalisation
#declare R = function (x,y,z) { x/sqrt(x*x+y*y+z*z) }
#declare IsoPlus = function (x,y,z) {
IsoExterior( x+Th*R(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
y+Th*R(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
z+Th*R(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z)))
}
#declare IsoMinus = function (x,y,z) {
IsoExterior( x-Th*R(DFx(x,y,z),DFy(x,y,z),DFz(x,y,z)),
y-Th*R(DFy(x,y,z),DFz(x,y,z),DFx(x,y,z)),
z-Th*R(DFz(x,y,z),DFx(x,y,z),DFy(x,y,z)))
}
#declare ThickIsoExterior = function (x,y,z) {
IsoPlus(x,y,z)*IsoMinus(x,y,z) }
#declare DevilsPlate = function (x,y,z) {
select ( -(-24/10-y)*(y-44/10),ThickIsoExterior((10*x/15),y,z), 1)
}
isosurface {
function {
DevilsPlate(x,y,z)
}
contained_by { box { <-45/10,-25/10,-75/10>,<45/10,45/10,75/10> } }
threshold 0.0
open
max_gradient 20000000
pigment { colour Red }
}
The orange object ist nearly the same as the red one but without the
select statement, moving the range condition for y into the bounding box.
This all works very fine, but Mike Williams' approach (dark purple)
looks a little strange:
#declare DevilsPlateD = function (x,y,z) {
select (
-(-24/10-y)*(y-44/10),(abs(IsoExterior((10*x/15),y,z))-0.01) ,1)
}
isosurface {
function {
DevilsPlateD(x,y,z)
}
contained_by { box { <-45/10,-25/10,-75/10>,<45/10,45/10,75/10> } }
threshold 0.0
// open
max_gradient 1000000
pigment { colour DarkPurple }
}
All values for max_gradient are adjusted according to the log.
max_trace_level was at maximum (256).
I have no idea what happens here.
Best regards
Michael
Post a reply to this message
Attachments:
Download 'devilsplate02.png' (173 KB)
Preview of image 'devilsplate02.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
MichaelJF <fri### [at] t-online de> wrote:
Well, the red and orange are looking good!
I'm not sure what's happening with MW's method, but I was just making a quick
suggestion.
The surface obviously extends infinitely in the +/-y directions, and so the
select is just there to trim the function.
I believe we can exclude that and just rely on the contained_by box.
IsoExterior (10*x/15),y,z) just scales the function in the x direction.
I'd take that out and use scale to take care of that part.
I'm just guessing here, but what if you then try something like:
IsoExterior (abs (x) - 0.01, abs (y) - 0.01, abs (z) - 0.01)
maybe also experiment with subtracting from f_r (x, y, z)
(include functions.inc)
try changing the threshold from 0 to 0.01
There's a lot of tricky things that have to be done to get certain functions to
work well with isosurfaces in POV-Ray vs other software packages
Maybe take a look further upstream at the preceding functions in the daisy chain
to see if a better gradient can be fashioned.
Define a set of y axes across the xz plane in the AABB, and graph the function
along those y-axes and see what pops out.
- BW
> This all works very fine, but Mike Williams' approach (dark purple)
> looks a little strange:
>
> #declare DevilsPlateD = function (x,y,z) {
> select (
> -(-24/10-y)*(y-44/10),(abs(IsoExterior((10*x/15),y,z))-0.01) ,1)
> }
> isosurface {
> function {
> DevilsPlateD(x,y,z)
> }
> contained_by { box { <-45/10,-25/10,-75/10>,<45/10,45/10,75/10> } }
> threshold 0.0
> // open
> max_gradient 1000000
> pigment { colour DarkPurple }
> }
>
> All values for max_gradient are adjusted according to the log.
> max_trace_level was at maximum (256).
>
> I have no idea what happens here.
>
> Best regards
> Michael
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bald Eagle" <cre### [at] netscape net> wrote:
> MichaelJF <fri### [at] t-online de> wrote:
>
> Well, the red and orange are looking good!
>
> I'm not sure what's happening with MW's method, but I was just making a quick
> suggestion.
>
> The surface obviously extends infinitely in the +/-y directions, and so the
> select is just there to trim the function.
> I believe we can exclude that and just rely on the contained_by box.
>
> IsoExterior (10*x/15),y,z) just scales the function in the x direction.
> I'd take that out and use scale to take care of that part.
>
> I'm just guessing here, but what if you then try something like:
> IsoExterior (abs (x) - 0.01, abs (y) - 0.01, abs (z) - 0.01)
>
> maybe also experiment with subtracting from f_r (x, y, z)
> (include functions.inc)
>
> try changing the threshold from 0 to 0.01
>
> There's a lot of tricky things that have to be done to get certain functions to
> work well with isosurfaces in POV-Ray vs other software packages
>
> Maybe take a look further upstream at the preceding functions in the daisy chain
> to see if a better gradient can be fashioned.
>
> Define a set of y axes across the xz plane in the AABB, and graph the function
> along those y-axes and see what pops out.
>
> - BW
>
>
Hi,
I tried some of the solutions proposed here and yes, the orange object is the
best approximation.
When you mentioned to use the function f_r (x, y, z) - although I do not have a
clue what it does (there is no comment in functions.inc) I remembered that TOK
used it in his source code for prettyball_1_at_klp_tok.pov.txt.
I tested it with Abderrahman Taha's Clebsch_2 and it worked amazingly well.
So, I adapted the code for Devil Plate, too which now looks as follows.
=================================================================
// Iso_Devil_Plate_test8.pov
#version 3.7;
global_settings { assumed_gamma 2.2 }
#include "colors.inc"
#include "textures.inc"
#include "metals.inc"
#include "functions.inc"
#declare H = 1e-4;
#declare Th = 1/10;
#declare Xmin = -45/10;
#declare Xmax = 45/10;
#declare Ymin = -24/10;
#declare Ymax = 44/10;
#declare Zmin = -75/10;
#declare Zmax = 75/10;
// Devil=x^4+2*x^2*z^2-(36/100)*x^2-y^4+(25/100)*y^2+z^4
#declare DevilFn = function {
pow(x,4)+2*pow(x,2)*pow(z,2)-(36/100)*pow(x,2)-pow(y,4)+(25/100)*pow(y,2)+pow(z,4)
}
// Devil2=Devil(x,sqrt(y*y+z*z)-(15/10),z,t)
#declare DevilFn2 = function(x,y,z) {
DevilFn (
x,
sqrt(y*y+z*z)-(15/10),
z
)
}
// IsoExterior=Devil2(x,y,sqrt(x*x+z*z)-(15/10),t)
#declare IsoExt = function(x,y,z) {
DevilFn2 (
x,
y,
sqrt(x*x+z*z)-(15/10)
)
}
// DFx=((IsoExterior(x+c,y,z,t)-IsoExterior(x,y,z,t))/c)
#declare DFX = function { (IsoExt(x+H,y,z)-IsoExt(x,y,z))/H }
// DFy=((IsoExterior(x,y+c,z,t)-IsoExterior(x,y,z,t))/c)
#declare DFY = function { (IsoExt(x,y+H,z)-IsoExt(x,y,z))/H }
// DFz=((IsoExterior(x,y,z+c,t)-IsoExterior(x,y,z,t))/c)
#declare DFZ = function { (IsoExt(x,y,z+H)-IsoExt(x,y,z))/H }
// Adaptation according to TOK's code follows
#declare Fn =
function(x, y, z, dx, dy, dz, s) {
IsoExt(
x + dx*s,
y + dy*s,
z + dz*s
)
}
// F(x,y,z,t) = if(y<(44/10)&y>-(24/10),ThickIsoExterior((10*x/15),y,z,t),1);
select() removed
#declare DP_Fn = function(x,y,z,dx,dy,dz) {
Fn(x, y, z, dx, dy, dz, +Th/f_r(dx, dy, dz))
*
Fn(x, y, z, dx, dy, dz, -Th/f_r(dx, dy, dz))
// instead of: IsoPlus(x,y,z)*IsoMinus(x,y,z),
}
//ISO Devil_Plate =
isosurface {
function {DP_Fn(
10*x/15,y,z, // scaling x
DFX(x, y, z),
DFY(x, y, z),
DFZ(x, y, z)
)
}
contained_by{box{<Xmin,Ymin,Zmin>, <Xmax, Ymax, Zmax>}}
threshold 0.0 // Trace Time 0 h 26 min
accuracy 0.01
max_gradient 2216254
open
pigment {Yellow}
rotate 90*y
}
#declare Win = image_width/image_height;
background { color <1.0,1.0,1.0> }
camera {
location <0, 15, -25>
up y
right Win*x
look_at <0.0, 0.0, 0.0>
angle 54
}
light_source {
<-17, 25, -35>
color rgb <1, 1, 1>
}
=====================================================================
It's probably as close to the original as it can get.
Thanks to all of you for the input.
Droj
Post a reply to this message
Attachments:
Download 'iso_devil_plate_test8.png' (77 KB)
Preview of image 'iso_devil_plate_test8.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Droj" <803### [at] droj de> wrote:
> When you mentioned to use the function f_r (x, y, z) - although I do not have a
> clue what it does (there is no comment in functions.inc)
You need to check the wiki entry under functions.inc
f_r(x,y,z): When used alone, the R function gives a surface that consists of all
the points that are a specific distance (threshold value) from the origin,
So basically you're just comparing your surface to a spherical shell.
At least you were able to work something out and get a decent result.
Isosurfaces can certainly be tricky, especially since we don't have vector
functions and certain inbuilt functions that other software packages pull from
libraries.
Chris R does everything with isosurfaces - maybe he can focus his highly trained
mind on it.
- BW
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> It's probably as close to the original as it can get.
Agreed! I think, the only improvement is to close the surface by
removing the open statement
Best regards
Michael
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
MichaelJF <fri### [at] t-online de> wrote:
> > It's probably as close to the original as it can get.
> Agreed! I think, the only improvement is to close the surface by
> removing the open statement
>
> Best regards
> Michael
Thanks, Michael, for the hint to remove 'open'.
I realised that there was still something wrong at the rim.
Your hint was the icing on the cake!
Droj
Post a reply to this message
Attachments:
Download 'iso_devil_plate.png' (382 KB)
Preview of image 'iso_devil_plate.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |