POV-Ray : Newsgroups : povray.text.scene-files : Abstract Experiment code ... Server Time
1 Nov 2024 17:21:55 EDT (-0400)
  Abstract Experiment code ... (Message 1 to 1 of 1)  
From: Michael Andrews
Subject: Abstract Experiment code ...
Date: 12 Oct 1999 10:33:11
Message: <3803467F.615681CC@reading.ac.uk>
/*
	Abstract Experiment on Graph Paper
		By Michael Andrews.

	This needs the superpatch to run.
	Otherwise, enjoy.
*/

global_settings { assumed_gamma 1.0 max_trace_level 10 ambient_light 3
	radiosity {
		count 200              
		error_bound 0.33       
		gray_threshold 0.3     
		distance_maximum 0     
		low_error_factor 0.33  
		nearest_count 9        
		minimum_reuse 0.001    
		brightness 3.3         
		recursion_limit 2      
	}
}

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

// Camera constants.
#declare camPos = <-0.35, 0.5, -0.75>*6; 
#declare camLookAt = <0,0,0>;
#declare camAngle = 25;

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 pS = pigment { bozo colour_map {[0 rgb 0][1 rgb 1]} scale 1/4 }
#declare pR = pigment { bozo colour_map {[0 rgb 0][1 rgb 1]} scale 1/4 translate 100 }

#declare N = 30;

union {
	#declare Y = 0; #while (Y < N)
		#declare hfS = height_field {
			pattern N+1,N+1 {
				hf_gray_16
				pS translate -y*Y/(N-1)
			}
			scale <N,N-1,N>/(N-1)
		}
		#debug concat("Layer ", str(Y,0,0), "\n")
		#declare X = 0; #while (X < N)
			#declare Z = 0; #while (Z < N)
				#declare nS = <0,0,0>;
				#declare S = trace (hfS, <(X+0.001)/(N-1),2,(Z+0.002)/(N-1)>, -y, nS);
				#declare pT = max(0,min(1,2*S.y-1));
				#if (pT > 0)
					// uncomment  the following #if and the coresponding #end to get the shell
					// #if (X=0 | Y=0 | Z=0 | X=(N-1) | Y=(N-1) | Z=(N-1))
						box { 
							-1,1 
							#switch (pT)
								#range (0.0, 0.2) scale 0.6/(N-1) rotate (pT/0.2)*(nS-0.5)*<-1,1,1>*30 #break 
								#range (0.2, 0.9) scale 0.6/(N-1) rotate ((pT-0.2)/0.7)*(nS-0.5)*<1,-1,1>*30
#break 
								#range (0.9, 1.0) scale 0.6/(N-1) rotate ((pT-0.9)/0.1)*(nS-0.5)*<1,1,-1>*30
#break 
							#end
							translate <X,Y,Z>/(N-1)-0.5
							material {
								texture {
									function { pT }
									texture_map {
								    	[0.2 pigment { rgbf 0.8 }              finish { ambient 0.1 diffuse 0.5
specular 0.5 reflection 0.5 }]
								    	[0.2 pigment { rgb <0.8,0.3,0.9>*0.7 } finish { ambient 0.1 diffuse 1
brilliance 0.5 }]
								    	[0.9 pigment { rgb <0.6,0.3,0.9>*0.2 } finish { ambient 0.1 diffuse 1
brilliance 0.5 }]
								    	[0.9 pigment { rgb <0.6,1,0.4> }       finish { ambient 0.1 diffuse 1
brilliance 15 }]
								    	[1.0 pigment { rgb <0.6,1,0.4>*0.3 }   finish { ambient 0.1 diffuse 1
brilliance 15 }]
								    }
								}
								interior { ior 1.33 fade_distance 1/N fade_power 1/3 }
							}
						}
					// #end 
				#end
			#declare Z = Z + 1; #end
		#declare X = X + 1; #end
	#declare Y = Y + 1; #end
}				

// Graph paper
#declare fnGrid = function { 1-max(abs(1-((abs(x%1))*2)),abs(1-((abs(z%1))*2))) }

plane {
	y,0
	pigment { 
		function {
min(fnGrid(x,0,z),min(fnGrid(x*2,0,z*2),fnGrid(x*10,0,z*10)))+0.02*noise3d(x*20,0,z*20)
} 
		colour_map {[0.04 rgb <0.3,0.8,0.9>][0.04 rgb 1]} 
	}
	normal {
		average
		normal_map {
			[1 bumps -0.5 scale <5,1,0.2>*1/5 ]
			[1 bumps -0.5 scale <0.2,1,5>*1/5 ]
		}
		scale 0.1
	}
	translate -y*0.5*(N+1)/N
}


Post a reply to this message

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