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

From POV-Wiki
Jump to navigation Jump to search
(Initial example for functions/objects to df3s.)
 
m (Changed 3.7.1 reference to 3.8.)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
[[Image:Df3_FunctionToDF3.png|center|frame|Density_file as isosurface where df3 created by macro from a defined function or object.]]
 
[[Image:Df3_FunctionToDF3.png|center|frame|Density_file as isosurface where df3 created by macro from a defined function or object.]]
  
<p>Converting functions or objects via functions and the object pattern into df3s. Complete scene file follows</p>:
+
<p>Converting functions or objects via functions and the object pattern into df3s. The complete scene file follows:</p>  
  
 
<pre>
 
<pre>
#version 3.71;
+
#version 3.8;
 
global_settings {
 
global_settings {
 
     assumed_gamma 1
 
     assumed_gamma 1

Latest revision as of 18:45, 4 January 2018

Density_file as isosurface where df3 created by macro from a defined function or object.

Converting functions or objects via functions and the object pattern into df3s. The complete scene file follows:

#version 3.8;
global_settings {
    assumed_gamma 1
    ambient_light srgb <1,1,1>
    noise_generator 3
}

#include "arrays.inc"           // For ARRAYS_WriteDF3()
#include "arraycoupleddf3s.inc" // Array coupled df3 macros & functions.

#include "functions.inc"

   //--- Can turn objects into df3 via ConvertFunctionToDF3 as follows
// #declare Sphere00 = sphere { 0.5,0.2 }
// #declare Fnct00 = function { pattern { object { Sphere00 } } }
// ConvertFunctionToDF3(50,50,50,0.0,0.5,0.9,1.1,Fnct00,"FunctionToDF3.df3",8,0)

#declare Fnct00 = function (x,y,z) { f_sphere(x-0.5,y-0.5,z-0.5,0.2) }

ConvertFunctionToDF3(50,50,50,0.0,0.5,-9e10,0.0,Fnct00,"FunctionToDF3.df3",8,0)

// #error "Stop before render if just creating df3 for future work"

#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.7,2.7,-2.701>
    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 {
    <50,150,-250>, White
}

#declare Fnct01 = function {
    pattern { density_file df3 "FunctionToDF3.df3" interpolate 3 }
}
#declare Fnct02 = function (x,y,z) {
    0.025-Fnct01(x,y,z)
}
#declare Neptune = srgb <0.4863,0.7176,0.7333>;
#declare Iso00 = isosurface {
    function { Fnct02(x,y,z) }
    contained_by { box { 0.2+1e-6,0.8-1e-6 } }
    threshold 0
    accuracy 0.0005
    max_gradient 6
    all_intersections
    pigment { color Neptune }
    finish { phong 0.9 }
}
#declare Object00 = object {
    Iso00
    translate -0.5
    scale 2.2
}

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