// ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 // Copyright 2003 by Tor Olav Kristensen // Email: t o r _ o l a v _ k [ a t ] h o t m a i l [ d o t ] c o m // http://home.no/t-o-k // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 // File: MountainIso.inc #version 3.5; // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #declare SquashFn = function(T, S) { select(S, -0.5, 0.5)*(tanh(abs(S)*T) - 1) } #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 // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #declare E = 3; #declare WaveFn = function(R) { sin(R)/(R + E) } #declare AgateFn = TransformFunction( function { pattern { agate lambda 2 octaves 8 turbulence 0.5 } }, transform { scale 70*<1, 1, 1> } ) #declare BozoFn = TransformFunction( function { pattern { bozo lambda 0.1 octaves 5 turbulence 1.2 } }, transform { scale 10*<1, 1, 1> } ) #declare Fn = function(x, z) { 5*WaveFn(5*AgateFn(x, 0, z)) +4*AgateFn(x, 0, z) -2*BozoFn(x, 0, z) } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7 #declare pMin = <-150, -1.9, -50>; #declare pMax = < 50, 3.2, 150>; #declare IsoMountains = isosurface { function { y - Fn(x, z) } max_gradient 6 contained_by { box { pMin, pMax } } } // ===== 1 ======= 2 ======= 3 ======= 4 ======= 5 ======= 6 ======= 7