Cat Condo.

by Lewis Sellers on November 26th, 2001
No CommentsComments

Date: November 26 2001 06:11 AM

A povray 3.1 model of a blue cat condo.

My cats made me put their favorite objects up here: The catcondo with fully articulated carpeting is a favorite as it took several hours to work out the math to mesh all the carpet fibers around the object. And yes, the fibers are all seperate objects.

Code:

///catcondo.pov
// 1024×768 AA 0.3 for computer speed comparisons
//susy’s cat condo 1998
// lsellers@usit.net http://www.public.usit.net/~lsellers http://www.intrafoundation.com
// 2001 nov. tweaked slightly under povray 3.5beta7

#declare highquality=1; //0=fast low quality, 1=realistic computational expensive model/lighting (slow)

//
#declare T_LightWood =
texture {
pigment {
wood
color_map {
[0.0 color rgb<.85, .65, .51>]
[0.9 color rgb<.75, .50, .45>]
[1.0 color rgb<.55, .36, .34>]
}
turbulence 0.12
octaves 3
scale <0.05, .05, 1>
rotate <4,3,0>
}
finish {
diffuse 0.9
brilliance 1
specular .5
roughness .5
}
}
#declare T_BlueCarpet =
texture {
pigment {
color rgb<.5,.5,1>
}
normal {
quilted 1
turbulence 0.4
}
normal {
granite .1
turbulence 0
}
finish {
diffuse 0.9
brilliance .5
}
scale .1
}

camera {
location  <0,2.5,-2.5>
//    look_at   <0,1,0>
look_at   <.5,1,0>
angle 60
}

light_source { <4,5,-6> color rgb<1,1,1> }

#if (highquality=1)
media { scattering { 3 rgb<.1,.1,.1> }}
#end

plane {
y, 0
pigment { checker pigment{ rgb<1,1,1>}, pigment{ rgb<0,0,0>} }
scale .5
finish { reflection 0 }
hollow
}
plane {
z, 4
pigment { checker pigment{ rgb<1,1,1>}, pigment{ rgb<0,0,0>} }
scale .5
finish { reflection 0 }
hollow
}

//catcondo 1.2d 1.9h .9hole
//susy’s cat condo by lewis sellers 1.2d 1.9h .9hole
#declare catcondo = union {
difference {
cylinder {<0,0,0>,<0,1.9,0>, .6}

cylinder {<0,1.8,0>,<0,1.91,0>, .5} //top
cylinder {<0,.2,0>,<0,1.7,0>, .5 texture{T_LightWood}} //cavity
cylinder {<0,-.01,0>,<0,.1,0>, .5 texture{T_LightWood}} //bottom

cylinder {<0,.55,-2>,<0,.55,0>, .325} //bottom hole
cylinder {<0,1.35,-2>,<0,1.35,0>, .325} //upper hole
}
intersection { //make ledge
box {<-1,.9,-1>,<1,1.0,0>}
cylinder {<0,.2,0>,<0,1.7,0>, .5} //cavity
}

#if (highquality=1)
//start seed
#declare s=seed(131);

// the main exterior minus cat holes. dist=sqr( (x1-x0)2 + (y1-y0)2 )
#declare obs=0;
#while (obs <= pi*2)

//speed optimization by cache
#declare cx=cos(obs)*.6;
#declare cz=sin(obs)*.6;
#declare cx2=cos(obs)*.63;
#declare cz2=sin(obs)*.63;

#declare oby=0;
#while (oby <= 1.9)

#declare justdoit=1;

#if (oby>.225 & oby<.875)
#declare l=vlength(<cx,oby-.55,cz-(-.6)>);
#if(l<.325)
#declare justdoit=0;
#end
#end

#if (oby>1.025 & oby<1.675)
#declare l=vlength(<cx,oby-1.35,cz-(-.6)>);
#if(l<.325)
#declare justdoit=0;
#end
#end

#if (justdoit=1)
cylinder { <cx,oby,cz>, <cx2+(rand(s)*.01),oby+(rand(s)*.025),cz2+(rand(s)*.01)>, .01 }
#end

#declare oby=oby+.0125;
#end

#declare obs=obs+pi/128;
#end

// inner flat top
#declare obx=0;
#declare obs_i=0;
#declare cc=0;
#while (obx <= .5)
#declare obs=0;
#declare cc=cc+1;
#declare obs_i=obs_i+1; //variable density
#while (obs <= pi*2)
cylinder { <cos(obs)*obx,1.8,sin(obs)*obx>, <cos(obs)*obx+(rand(s)*.01),1.83,sin(obs)*obx+(rand(s)*.01)>, .01 }
#declare obs=obs+pi/obs_i;
#end
#declare obx=obx+.0125;
#end

// outer flat top
#declare obx=.5;
#while (obx <= .6)
#declare obs=0;
#while (obs <= pi*2)
cylinder { <cos(obs)*obx,1.9,sin(obs)*obx>, <cos(obs)*obx+(rand(s)*.01),1.93,sin(obs)*obx+(rand(s)*.01)>, .01 }
#declare obs=obs+pi/128;
#end
#declare obx=obx+.0125;
#end

// top inner horiz ring
#declare oby=1.8;
#while (oby <= 1.9)
#declare obs=0;
#while (obs <= pi*2)
cylinder { <cos(obs)*.5,oby,sin(obs)*.5>, <cos(obs)*.47+(rand(s)*.01),oby+(rand(s)*.025),sin(obs)*.47+(rand(s)*.01)>, .01 }
#declare obs=obs+pi/128;
#end
#declare oby=oby+.0125;
#end

// ledge
#declare obx=0;
#declare obs_i=0;
#declare cc=0;
#while (obx <= .5)
#declare obs=pi;
#declare cc=cc+1;
#declare obs_i=obs_i+1; //variable density
#while (obs <= pi*2)
cylinder { <cos(obs)*obx,1,sin(obs)*obx>, <cos(obs)*obx+(rand(s)*.01),1.03,sin(obs)*obx+(rand(s)*.01)>, .01 }
#declare obs=obs+pi/obs_i;
#end
#declare obx=obx+.0125;
#end

// bottom cat hole <0,.55,-.6> .325
#declare obs=0;
#while (obs <= pi*2)
#declare obz=-.60;

#declare cx=cos(obs)*.325; //cache x base
#declare cy=sin(obs)*.325+0.55; //cache y base
#declare cx2=cos(obs)*.295; //cache x2 base
#declare cy2=sin(obs)*.295+0.55; //cache y2 base

#while (obz <= -.50)
#declare obz_m=obz+abs(cos(obs)*.1)+.001; //cutting the cat hole into a cylinder doesn’t give a perfect ring. must mod depth
#declare obz=obz+.0125;
cylinder { <cx, cy, obz_m>, <cx2+(rand(s)*.01), cy2+(rand(s)*.01), obz_m+(rand(s)*.025)>, .01}
#end

#declare obs=obs+pi/128;
#end

// top cat hole <0,1.35,-.6> .325
#declare obs=0;
#while (obs <= pi*2)
#declare obz=-.60;

//speed optimization by caching
#declare cx=cos(obs)*.325; //cache x base
#declare cy=sin(obs)*.325+1.35; //cache y base
#declare cx2=cos(obs)*.295; //cache x2 base
#declare cy2=sin(obs)*.295+1.35; //cache y2 base

#while (obz <= -.50)
#declare obz_m=obz+abs(cos(obs)*.1)+.001; //cutting the cat hole into a cylinder doesn’t give a perfect ring. must mod depth
#declare obz=obz+.0125;
cylinder { <cx, cy, obz_m>, <cx2+(rand(s)*.01), cy2+(rand(s)*.01), obz_m+(rand(s)*.025)>, .01}
#end

#declare obs=obs+pi/128;
#end
#end

texture {T_BlueCarpet}
}

object{catcondo rotate<0,0,0> translate<0,0,0> }

/*
#declare c=0
#declare py=-10
#while (py < 10)
#declare px=-10
#while (px < 10)
object{catcondo rotate<0,degrees(cos(c)),0> translate<px,0,py> }
#declare c=c+pi/10
#declare px=px+2
#end
#declare py=py+2
#end
*/


Categories: Computer Graphics

Leave Comment

Commenting Options

Alternatively, you can create an avatar that will appear whenever you leave a comment on a Gravatar-enabled blog.