|
|
In POV-Ray v3.5 there is a new feature that
allows one to define transform functions.
And these functions can be used to do
(static) transformations of iso-surface
shapes.
The advantage of doing this within the
functions for the iso-surface instead of
adding the transformations at the end of
the iso-declaration(s) is that one can
make the iso-shapes interact with one
another in many fancy ways.
Below is some code to that shows how to
transform an iso-torus in two different
ways and then blob the two different
copies together.
Also see image in povray.binaries.images
Have fun !
Tor Olav
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Copyright 2001 by Tor Olav Kristensen
// mailto:tor### [at] hotmailcom
// http://www.crosswinds.net/~tok
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
#version 3.5; // Scene tested in v3.5 beta 4
#include "colors.inc"
#include "functions.inc" // Because it contains the f_torus() function
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Some tools
#macro TransformFunction(Fn, Transform)
#local TT = function { transform { Transform inverse } }
function { Fn(TT(x, y, z).x, TT(x, y, z).y, TT(x, y, z).z) }
#end // macro TransformFunction
#declare BlobbingFn = function(T, Sharpness) { 1/exp(Sharpness*T) }
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// Declarations of the functions for the iso-surface
#declare TorusFn = function { f_torus(x, y, z, 4.0, 0.8) }
#declare OneTransform =
transform {
rotate 30*z
scale <1, 1.5, 1>
rotate -20*y
}
#declare TransformedTorusFn1 =
TransformFunction(
function { TorusFn(x, y, z) },
OneTransform
)
#declare TransformedTorusFn2 =
TransformFunction(
function { TorusFn(x, y, z) },
transform { translate -y }
)
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
// And then assemble it all
#declare SharpNess = 10; // Also try e.g. 20
isosurface {
function {
1
-BlobbingFn(TransformedTorusFn1(x, y, z), SharpNess)
-BlobbingFn(TransformedTorusFn2(x, y, z), SharpNess)
}
contained_by { sphere { <0, 0, 0>, 8 } }
max_gradient 10
pigment { color White }
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
background { color Blue/2 }
light_source {
<1, 3, -2>*100
color White
shadowless
}
camera {
location <0, 1, -2>*7
look_at <0, 0, 0>
}
// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 =
Post a reply to this message
|
|