POV-Ray : Newsgroups : povray.text.scene-files : BoxBlob source : Re: BoxBlob source Server Time
28 Jul 2024 18:14:13 EDT (-0400)
  Re: BoxBlob source  
From: Michael Andrews
Date: 6 Oct 1999 13:24:12
Message: <37FB8589.D85E3C6C@reading.ac.uk>
/* Isosurface blob */

#include "colors.inc"

global_settings { assumed_gamma 1.0 max_trace_level 10 }

background { color rgb <1/15,1/sqrt(15),1>*0.5 }
                       
// Light constants.                       
#declare lightDir = vnormalize(<-0.5,2.1,-2>);
#declare lightLen = 1.5e6;
#declare lightRad = lightLen*sin(radians(0.25));
#declare lightCol = <1,.97,.95>;

// Camera constants.
#declare camPos = <-0.25, 0.5, -0.75>*30; 
#declare camLookAt = <0,0,0>;
#declare camAngle = 40;

camera {
	up <0, 1, 0>
	right <4/3, 0, 0>
	location  camPos
	direction <0.0, 0.0, 1>
	angle     camAngle
	look_at   camLookAt
}

light_source {
	0*x
	colour rgb lightCol
	translate lightDir*lightLen
	parallel
	point_at 0
	media_attenuation on
}

#declare r0 = 3;
#declare r1 = 0.5;

#declare fnTor = function { "Torus", <r0,r1> }

#declare fnSph = function { "Sphere", <1> }

#declare fnBox = function {
sqr(max(0,(max(abs(x),max(abs(y),abs(z))))-1)) }
               
#declare fnTorB = function { sqr(max(0,1-sqr(1+fnTor(x,y,z)))) }
#declare fnSphB = function { sqr(max(0,1-sqr(1+fnSph(x,y,z)))) }
#declare fnBoxB = function { sqr(max(0,1-sqr(1+fnBox(x,y,z)))) }

#declare fnLongFunc = function {
	0.1 - (
		  fnTorB(x,z,y)
		+ fnSphB(x*2,0,z*2)
		+ fnSphB(0,y*2,z*2)
		+ fnBoxB(x,y+3,z)
		+ fnBoxB(x,y-3,z)
		+ fnBoxB(x+3,y,z)
		+ fnBoxB(x-3,y,z)
	)
}

isosurface {
	function { fnLongFunc(x,y,z) }
	bounded_by { box { -10, 10 } }
	eval
	sign 1 
	pigment { rgb <.9,.85,.7> }
}

/*
	Bye for now,
		Mike Andrews.
*/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.