|
![](/i/fill.gif) |
The example blob function at the end of the isosurface tutorial behaves
differently at different scales, as can be seen in the example below. This is
not a problem with the built-in blob object. I was wondering if anyone could
provide a better formula for when using isosurfaces? Thanks!
// Begin
#version 3.6;
#include "colors.inc"
#include "functions.inc"
#include "math.inc"
#include "Axes_macro.inc"
#declare Scene_scale = frame_number;
global_settings
{
assumed_gamma 1.0
max_trace_level 5
}
// ----------------------------------------
#declare screen_scale = 1;
camera
{
#local CameraDistance = 10;
#local ScreenArea = 6;
#local AspectRatio = image_width/image_height;
orthographic
location -z*CameraDistance
direction z*CameraDistance
right x*ScreenArea*AspectRatio
up y*ScreenArea
rotate x*asind(tand(30))
// rotate x*90
rotate y*45
scale Scene_scale
}
background { color rgb <0.6,0.7,1.0> }
light_source
{
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -30>
shadowless
scale Scene_scale
}
light_source
{
<0, 0, 0> // light's position (translated below)
color rgb <1, 1, 1> // light's color
translate <-30, 30, -30>
rotate y * 90
shadowless
scale Scene_scale
}
plane { y,0 pigment {color rgbt 1/2}}
// ----------------------------------------
#declare Blob_threshold = 0.5;
#declare Blob_start = 1;
#declare fn_A = function { pow(x+Scene_scale/2,2) + pow(y+Scene_scale/2,2) +
pow(z+Scene_scale/2,2) - pow(Scene_scale,2) };
#declare fn_B = function { pow(x-Scene_scale/2,2) + pow(y-Scene_scale/2,2) +
pow(z-Scene_scale/2,2) - pow(Scene_scale,2) };
#declare fn_C = function { Blob_start + Blob_threshold }
difference
{
isosurface
{
function
{
fn_C(x,y,z)
- pow(Blob_threshold, fn_A(x,y,z))
- pow(Blob_threshold, fn_B(x,y,z))
}
threshold 0
accuracy 0.001*Scene_scale
max_gradient 4
contained_by { sphere { 0, 2 * Scene_scale } }
}
pigment {color rgb x}
}
// End
Post a reply to this message
|
![](/i/fill.gif) |