|
|
Hi,
Can anybody explain me, please, how 'isosurface' works ?
I am trying to render:
V = cos(x) + cos(y) + cos(z); // Attached
but see nothing, except the axis. At the same time function from tutorial works
fine (see code below).
Thanks in advance,
--
YB
#version 3.8;
global_settings { assumed_gamma 1 }
#include "functions.inc"
//
// Axis textures
//
#declare fin_axis = finish { phong 1 reflection {0.10 metallic 0.4 }}
#declare tex_axis_common = texture {
pigment { rgb <0.70, 0.70, 0.70> }
finish { fin_axis }}
#declare tex_axis_x = texture { pigment { rgb x} finish { fin_axis }}
#declare tex_axis_y = texture { pigment { rgb y} finish { fin_axis }}
#declare tex_axis_z = texture { pigment { rgb z} finish { fin_axis }}
//
// Axis
//
#macro axis_base( len, rad, tex_odd, tex_even )
union{
cylinder { <0, -len, 0>,<0, len, 0>, rad
texture{ checker texture{ tex_odd } texture{ tex_even }
translate <0.1, 0, 0.1> }}
cone{<0, len, 0>, rad * 2, <0, len + rad * 7, 0>, 0 texture{tex_even} }}
#end
#macro axis_xyz( len_x, len_y, len_z, rad, tex_common, tex_x, tex_y, tex_z)
union{
#if (len_x != 0) object { axis_base(len_x, rad, tex_common, tex_x) rotate<
0, 0,-90>} #end
#if (len_y != 0) object { axis_base(len_y, rad, tex_common, tex_y) rotate<
0, 0, 0>} #end
#if (len_z != 0) object { axis_base(len_z, rad, tex_common, tex_z) rotate<
90, 0, 0>} #end }
#end
#macro axis(len_x, len_y, len_z, rad)
axis_xyz( len_x, len_y, len_z, rad, tex_axis_common, tex_axis_x, tex_axis_y,
tex_axis_z)
#end
//
// Perspective camera
//
#macro camp (_x, _y, _z, _lx, _ly, _lz, _ang)
camera
{ perspective
location < _x, _y, _z>
look_at <_lx, _ly, _lz>
angle _ang
}
#end
//
// Lights
//
#declare luminosity = 1.7;
light_source {<0, 10, 0>, rgb <1,1,1> * luminosity }
light_source {<0, -10, 0>, rgb <1,1,1> * luminosity }
light_source {< 10, 0, 0>, rgb <1,1,1> * luminosity }
light_source {<-10, 0, 0>, rgb <1,1,1> * luminosity }
light_source {<0, 0, 10>, rgb <1,1,1> * luminosity }
light_source {<0, 0, -10>, rgb <1,1,1> * luminosity }
axis (3,3,3,0.02)
camp (5,5,5, 0,0.3,0, 55)
//------------- Objects --------------------------------------------
//
// FUnction
//
// #declare f = function { f_sphere(x,y,z,0.8) - pow(f_noise3d(x,y,z),2) } // Ok
#declare f = function { cos(x) + cos(y) + cos(z) } // Not displayed (?)
//
// Surface
//
isosurface {
function { f(x,y,z) }
pigment { rgbft <0,0.5,0,0.6,0>
scale 2
translate 1}
scale 1.5 }
//-------------------------------------------------------------------
Post a reply to this message
Attachments:
Download 'iso.png' (95 KB)
Preview of image 'iso.png'
|
|
|
|
"yesbird" <nomail@nomail> wrote:
> Hi,
>
> Can anybody explain me, please, how 'isosurface' works ?
> I am trying to render:
>
> V = cos(x) + cos(y) + cos(z); // Attached
So, IIRC that's like a gyroid or something...
If you email me, I can can send you a PDF copy of Mike Williams' Isosurface
Tutorial.
But the key idea is that it's an ISOsurface.
Very often what you need to do is subtract your function result from a space
coordinate so that when the function's surface point is AT that space point, the
result is zero - or whatever you set your threshold to.
After a few quick experiments, I established that you like want to "check" the
distance of your curve from a sphere, so I used that. You can probably use the
in-built f_sphere as well.
So try:
camp (7,0,-7, 0,0.3,0, 55)
//------------- Objects --------------------------------------------
//
// FUnction
//
// #declare f = function { f_sphere(x,y,z,0.8) - pow(f_noise3d(x,y,z),2) } // Ok
#declare f = function { cos(x) + cos(y) + cos(z) } // Not displayed (?)
//
// Surface
//
#declare R = 1;
isosurface {
function { sqrt (x*x+y*y+z*z)/8 - f(x, y, z)}
threshold 0
accuracy 0.0001
max_gradient 1.6
open
contained_by {box {-4, +4}}
pigment { rgbft <0,0.5,0,0.6,0>
scale 2
translate 1}
}
Post a reply to this message
Attachments:
Download 'isosurfacetest1.png' (64 KB)
Preview of image 'isosurfacetest1.png'
|
|