POV-Ray : Newsgroups : povray.binaries.images : A method creat uniform thick shell : Re: A method creat uniform thick shell Server Time
5 May 2024 22:35:18 EDT (-0400)
  Re: A method creat uniform thick shell  
From: And
Date: 30 Oct 2013 12:35:01
Message: <web.52713448dce0719ad7d2abf60@news.povray.org>
I have written a macro which uses above technique to make an isosurface thin
shell. I post it below. But I found that it is only for a small thickness or it
don't have a constant thickness result. Furthermore, for many functions its
result is not expect.

So, don't take too much expect with it.

//-------------------macro-----------------------------

#macro Shape_ThinShellOf3DFunction(input_function, _min_extent, _max_extent,
_thickness, _max_gradient)
#local CSG_OVERLAP=0.001;
#local h=0.00001;
#local normalized_function =
function(var1,var2,var3)
{
input_function(var1,var2,var3)
/sqrt(
pow((input_function(var1+h,var2,var3)-input_function(var1,var2,var3))/h,2)
+pow((input_function(var1,var2+h,var3)-input_function(var1,var2,var3))/h,2)
+pow((input_function(var1,var2,var3+h)-input_function(var1,var2,var3))/h,2)
)
}
difference{
isosurface{
function{normalized_function(x,y,z)-_thickness/2}
max_gradient _max_gradient
contained_by{box{_min_extent,_max_extent}}
all_intersections
}
isosurface{
function{normalized_function(x,y,z)+_thickness/2}
max_gradient _max_gradient
contained_by{box{_min_extent-<CSG_OVERLAP,CSG_OVERLAP,CSG_OVERLAP>,_max_extent+<CSG_OVERLAP,CSG_OVERLAP,CSG_OVERLAP>}}
all_intersections
}
}
#end





//---------------------Here is a good look example------

#declare f_noise3d = function { internal(76) }
#declare f_test=
function(x,y,z){
x*x+y*y+z*z-1- 0.5*f_noise3d(x/0.3,y/0.3,z/0.3)
}

difference{
Shape_ThinShellOf3DFunction(f_test, <-1.3,-1.3,0>, <1.3,1.3,1.3>, 0.04, 10)
box{<-1.5,-1.5,-0.1>,<1.5,0,1.5>}
texture{
    pigment{rgb<1,1,1>}
    finish{
        ambient 0.1
        diffuse 0.6
    }
}
}

//----------------------------------------------------------


Post a reply to this message

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