Difference between revisions of "User:Wfpokorny/DensityFile/BlackHoleLatheGreebling"

From POV-Wiki
Jump to navigation Jump to search
(Initial black_hole lathe greebling example page.)
 
m (Making note more accurate.)
Line 100: Line 100:
 
</pre>
 
</pre>
  
<p>'''Note.''' The reason the above code works - that contraction stops on different radii and doesn't collapse to nothing  - is the black_hole warp movement is clamped to half the radius of the black_hole.</p>
+
<p>'''Note.''' The reason the above code works - that contraction stops on different radii and doesn't collapse to nothing  - is the black_hole point movement is limited to the original distance from the point to the hole's center.</p>

Revision as of 12:12, 7 September 2016

Density_file as isosurface with lathe greebling via black_hole warps.

On the left a density_file isosurface based upon a df3 where the unit cube diagonals all have values of 0.9. On the right is the greeble-lathe effect accomplished with three black_hole warps repeating at various diagonal distances. The code in full is:

#version 3.71;
global_settings {
    assumed_gamma 1
    ambient_light srgb <1,1,1>
    noise_generator 3
}
//------ First create the df3 with 5 deep, 0.0, side padding.
#include "arrays.inc"
#declare maxZ=30;
#declare maxY=30;
#declare maxX=30;
#declare Ary=array[maxX][maxY][maxZ]
#declare midX=int(maxX/2);
#declare midY=int(maxY/2);
#declare midZ=int(maxZ/2);
#declare padMaxX=maxX-6; // Start padded at 5 end padMaxX
#declare padMaxY=maxY-6;
#declare padMaxZ=maxZ-6;
//-- First initialize all voxels to 0.0
#for (Z,0,maxZ-1)
  #for (Y,0,maxY-1)
    #for (X,0,maxX-1)
       #declare Ary[X][Y][Z]=0.0;
    #end
  #end
#end
//-- Set the cube diagonal values to 0.9 inside outer padding.
#for (X,5,padMaxX)
   #declare Ary[X][X][X]=0.9;
#end
#declare Df3FileName="GreebleDf3IsoDiag.df3";
ARRAYS_WriteDF3(Ary,Df3FileName,8)
//---

#declare Color_2 = srgbft <0.65,0.65,0.65,0,0>;
#declare Color_3 = srgbft <0.8,0.8,0.8,0,0>;
#declare ColorMap_CloudyGraySky2 = color_map {
    [ 0 Color_2 ]
    [ 1 Color_3 ]
}
#declare Pigment_CloudyGraySky2 = pigment {
    bozo sine_wave frequency 3.33 turbulence 1.0
    color_map { ColorMap_CloudyGraySky2 }
}
#declare Sky_Sphere00 = sky_sphere {
    pigment { Pigment_CloudyGraySky2 }
    emission rgb <1,1,1>
}
#declare Camera00 = camera {
    perspective
    location <2.1,2.1,-2.101>
    sky <0,1,0>
    angle 35
    right x*(image_width/image_height)
    look_at <0,0,0>
}
#declare White = srgbft <1,1,1,0,0>;
#declare Light00 = light_source { <250,250,-250>, White }

#declare Fnct00 = function {
    pattern { density_file df3 "GreebleDf3IsoDiag.df3" interpolate 5
        warp { black_hole <0,0,0>,0.17 falloff 3.0 strength 5 repeat <0.34,0.34,0.34> }
        warp { black_hole <0,0,0>,0.15 falloff 3.0 strength 5 repeat <0.30,0.30,0.30> }
        warp { black_hole <0,0,0>,0.13 falloff 3.0 strength 5 repeat <0.26,0.26,0.26> }
    }
}
#declare Fnct01 = function (x,y,z) {
    0.025-Fnct00(x,y,z)
}
#declare Magenta = srgbft <1,0,1,0,0>;
#declare Iso00 = isosurface {
    function { Fnct01(x,y,z) }
    contained_by { box { -0.0+1e-6,1.0-1e-6 } }
    threshold 0
    accuracy 0.0005
    max_gradient 6
    all_intersections
    texture {
      pigment { color Magenta }
      finish { ambient 0 }
    }
}
#declare Object00 = object {
    Iso00
    translate -0.5
    scale 1.7
}

//---
sky_sphere { Sky_Sphere00 }
camera { Camera00 }
light_source { Light00 }
object { Object00 }

Note. The reason the above code works - that contraction stops on different radii and doesn't collapse to nothing - is the black_hole point movement is limited to the original distance from the point to the hole's center.