//Fuzzy Bear sat by the fire, lamenting the loss of his leg //by Tekno Frannansa // //It's a load of hairy balls! union //declare a macro between the "union" and it's "{" so we don't need a whitespace after #end. //hairy ball macro! #macro S(P,R) //position, scale (vector, so can do squashed spheres for the ears and stretched one for the leg) //number of hairs #local i=999*R.x; //if you have too many the bear looks too spherical and uninteresting, too few and he looks spikey. proportional to R so more hairs on larger surface #while (i) //implicitly #while(i!=0) cone { P-15 //base position offset by -15, to save having to add it to each thing +R*y*.8, //comb his hair down by sticking the base of the hairs higher than the centre of the sphere R.x/8, //base radius of cone base on size of sphere, use R.x because we ain't got time for vlength(R) or similar //tip is base position plus a pseudo random vector //we create a unit vector along z, then rotate by i*<9.07,31,7> //these numbers are good because they don't create regular patterns in the fur, because they're mostly primes. //the .07 is added to ensure it doesn't repeat after 360 strands of hair, this will in fact take a pretty long time to repeat //after that, the numbers were tweaked until I got something that looked like a random distribution on a sphere. //finally, scale this vector by our scale vector, to get the squashed sphere shape we want P-15 +R*vrotate(z,i*<9.07,31,7>), 0 //tip has 0 radius, obviously } #local i=i-1; #end #end { //union //the scene //it's all in a union so we can create it at an easy coordinate, like -5 (i.e. <-5,-5,-5>) //then rotate it round the camera to view at an interesting angle //development note: to get these coordinates I actually started out with something different but spotted //that scaling by *3 approx would save characters. It was approx so x/4->x, .7->2. slightly //altering the bear's proportions but saving lots of characters! //body S(0,6) //head S(6*y,4) //ears S(9*y+3*x,2-z) S(9*y-3*x,2-z) //visible arm (we'll pretend he has 2 and just can't see it from this angle!) S(<5,3,1>,2+x) //leg S(-2-x+8*z,2+z) //ground plane plane{y,-18} //colour everything //unfortunately we have no space to colour ground and bear seperately, so pretend he's sat by a fire so everything gets orangey shades //the default colours for radial are gorgeous and interesting, if a little abstract, but they're too yellow for fire. //so balance this yellow later using the light colour. pigment{radial} //spin it round to view the scene //this was found by trial and error attempting to use less characters to get a view similar to <45,150,0> //after finding this strange rotation I adjusted the lights and bear orientation to give good composition, //and coincedentally found I could save more characters in those with this new composition, lucky! :) rotate 40+y*99 } //light, placed relative to the camera, not relative to the scene (which is rotated). //my aim was to show enough of the bear that you could see he was furry, without making it too obvious how simple his construction was. //unfortunately I think it would take a lot more than good lighting to pull off that trick, still it looks quite nice. light_source{18,2+x} /* //packed versions: //1st version - still too long, preserved because I'm about to pull limbs off him... //union#macro S(P,R)#local i=7200;#while(i)cone{P-5,R.x/6,P-5+R* //vrotate(z,i*<19.07,31,23>),0}#local i=i-1;#end#end#macro F(P,R)S(P //,R)S(P-2*P*z,R)#end{S(0,2)S(2*y,1.3)F(3*y+z,.5-x/3)F(y+2*z,.5+z/ //3)F(<3,-1,2>/2,.8+x/2)plane{y,-6}rotate<45,150,0>pigment{rgb 1}} //light_source{4-8*x,2-z-y/4} //moved stuff to simplify numbers & threw out some stuff, e.g. a leg //34567812345678123456781234567812345678123456781234567812345678 union#macro S(P,R)#local i=7200;#while(i)cone{P-5,R.x/5,P-5+R* vrotate(z,i*<9.07,31,7>),0}#local i=i-1;#end#end{S(0,2)S(2*y,1.3)S (3*y+x,.5-z/3)S(3*y-x,.5-z/3)S(y+z/2+x*2,.6+x/4)S(<-1,-.5,2>,.6+ z/4)plane{y,-6}pigment{radial}rotate 40+y*99}light_source{6,3-y} //<45,150,0> //40+y*99 <- similar view, not quite as good so flipped bear x<->z for better composition, also allowed us to move the light somewhere simpler */