User:Wfpokorny/DensityFile/TubulenceWarpsExamples

From POV-Wiki
< User:Wfpokorny‎ | DensityFile
Revision as of 18:45, 4 January 2018 by Wfpokorny (talk | contribs) (Changed 3.7.1 reference to 3.8.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Density_file as isosurface with various turbulence warps applied.

Complete pov example file for the 6 images above :

#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 some crossing axis
#for (X,5,padMaxX)
   #declare Ary[X][midY][midZ]=0.95;
#end
#for (Y,5,padMaxY)
   #declare Ary[midX][Y][midZ]=0.95;
#end
#for (Z,5,padMaxZ)
   #declare Ary[midX][midY][Z]=0.95;
#end
#declare Df3FileName="TurbulenceWarps.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 }

#include "functions.inc"
#declare Fnct00 = function {
    pattern { density_file df3 "TurbulenceWarps.df3" interpolate 5
     //                                                        // 0
     // warp { turbulence 0.02 octaves 6 omega 0.33 lambda 6 } // 1
     // warp { turbulence 0.05 octaves 6 omega 0.44 lambda 5 } // 2
     // warp { turbulence -0.22 octaves 3 omega 3.0 lambda 2.7 } // 3
     // warp { turbulence 0.20 octaves 6 omega 0.99 lambda 5 } // 4
     // warp { turbulence 0.07 octaves 8 omega 0.99 lambda 7 } // 5
    }
}
#declare Fnct01 = function (x,y,z) {
    0.025-Fnct00(x,y,z)
}
#declare BaryteGreen = srgb <0.6157,0.7686,0.3725>;
#declare Iso00 = isosurface {
    function { Fnct01(x,y,z) }
    contained_by { box { -0.2+1e-6,1.2-1e-6 } }
    threshold 0
    accuracy 0.0005
    max_gradient 6  // 12 needed for warp 3
    all_intersections
    texture {
      pigment { color BaryteGreen }
      finish { ambient <0.03,0.02,0.0> diffuse 0.8,0.4 phong 0.7 }
    }
}
#declare Object00 = object {
    Iso00
    translate -0.5
    scale 1.7
}

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