User:Wfpokorny/DensityFile/BlackHoleFlower

From POV-Wiki
Jump to navigation Jump to search
Density_file as isosurface flower via black_hole warps and interpolation 3.

Interpolation 3 for some bumps/veins. The full scene description file:

#version 3.8;
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
//-- Create box at mid y
#for (Z,5,padMaxZ)
    #for (X,5,padMaxX)
       #declare Ary[X][midY][Z]=0.55;
    #end
#end
#declare Df3FileName="BlackHoleFlower.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 { <150,250,-250>, White }

#declare CtrVec = <0.5,0.5,0.5>;
#macro PetalWarps ()
   warp { black_hole CtrVec,0.50 falloff 2.0 strength 2.0 }
   warp { black_hole CtrVec,0.40 falloff 2.0 strength 2.0 }
   warp { black_hole CtrVec,0.30 falloff 2.0 strength 1.7 }
   warp { black_hole CtrVec,0.25 falloff 2.0 strength 1.5 inverse }
   warp { turbulence 0.015 octaves 6 omega 0.3 lambda 6 }
#end
#macro PetalTurbWarps ()
   warp { turbulence <0.02,0.05,0.02> }
#end

#declare Fnct00a = function {
    pattern { density_file df3 "BlackHoleFlower.df3" interpolate 3
        PetalWarps()
        PetalTurbWarps()
    }
}
#declare Fnct00b = function {
    pattern { density_file df3 "BlackHoleFlower.df3" interpolate 3
        PetalWarps()
        PetalTurbWarps()
        translate -0.5
        rotate y*30
        translate  0.5
        translate <0,-0.01,0>
    }
}
#declare Fnct00c = function {
    pattern { density_file df3 "BlackHoleFlower.df3" interpolate 3
        PetalWarps()
        PetalTurbWarps()
        translate -0.5
        rotate y*60
        translate  0.5
        translate <0,-0.02,0>
    }
}
#declare Fnct00 = function (x,y,z) { max(Fnct00a(x,y,z),Fnct00b(x,y,z),Fnct00c(x,y,z)) }
#declare Fnct01 = function (x,y,z) { 0.025-Fnct00(x,y,z) }
#declare Iso00 = isosurface {
    function { Fnct01(x,y,z) }
    contained_by { box { <0,0.3,0>,<1,0.7,1> } }
    threshold 0
    accuracy 0.0005
    max_gradient 6
    all_intersections
}
#declare Object00 = object {
    Iso00
    texture {
      pigment {
         spherical
         scale 0.5
         translate 0.5
         PetalTurbWarps()
         color_map {
         [ 0.00 srgb <1,0.4784,0.3804> ]
         [ 0.37 srgb <0.9333,0.8667,0.7647> ]
         [ 0.70 srgb <0.9882,0.9608,0.8078> ]
         [ 0.77 srgb <0.8098,0.69412,0.08235> ]
         [ 0.79 srgb <0.1098,0.09412,0.08235> ]
         [ 1.00 srgb <0.7216,0.3059,0.1569>*0.8 ]
         }
      }
      finish { ambient <0.03,0.02,0.0> diffuse 0.8,0.4 }
    }
    translate -CtrVec
    scale 2
}

//---
sky_sphere { Sky_Sphere00 }
camera { Camera00 }
light_source { Light00 }
object { Object00 rotate <-22,0,-11> }