Tuesday, September 25, 2007

A povray mesh2 based character modelled IN povray


This is a 100 frame animation I made of a new thing I did in povray.

This is a single mesh2 object. I modeled it with a routine I wrote in the povray Scene Description Language. What it allows me to do is specify a certain number of "cross sections" or splines, and then it skins or draws a series of triangles between then. The cool thing is that in povray I can then animate the meshes themselves and then I have a "character" that is animatable and made from a single mesh.

Others have done this before. The new thing I have done here is to allow a different cross section at every step. I start out with circles for arms and then make a parallelogram that mimics the shape of a chest.

Persistence of Vision Raytracer SDL posted below:

//povray 3.6 scene file originated by Greg M. Johnson

#include"transforms.inc"

#declare rarm_transform=transform{translate -8*x rotate -45*z*sin(2*pi*clock) translate 8*x}
#declare larm_transform=transform{ translate 8*x rotate 45*z*sin(2*pi*clock) translate -8*x}
//#declare larm_transform=transform{ rotate 30*z*sin(2*pi*clock) }

#declare toppt=vtransform(<-14,0,0>,larm_transform);

#declare numrings=8;
#declare npts=90;//frame_number;
#declare ring=array[numrings+1]
#declare ring[0]=spline{ cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<-12,0,0> ,larm_transform)
#declare n=n+1;
#end
}
#declare ring[1]=spline{ cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<-8,0,0>
#declare n=n+1;
#end
}
#declare ring[2]=spline{cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<-4,0,0>
#declare n=n+1;
#end
}
#declare bre=0.5*<0,0.5*sin(4*pi*clock),sin(4*pi*clock)>;

#declare ring[3]=spline{linear_spline
0,<-3,0,5>+bre,0.15,<-3,3,1>,0.25,<-3,3,-1>,0.4,<-3,-0,-4>,0.6,<-2.5,-8,-2.5>,0.8,<-2.5,-8,2.5>,0.9,<-2.5,-4,2.5>
0.95,<-3,-2,5>+bre,1.0,<-3,0,5>+bre}

#declare ring[4]=spline{linear_spline
0,<>+bre,0.15,<>,0.25,<>,0.4,<>,0.6,<>,0.8,<>,0.9,<>,
0.95,<3,-2,5>+bre,1.0,<>+bre}

#declare ring[5]=spline{cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<4,0,0>
#declare n=n+1;
#end
}
#declare ring[6]=spline{cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<8,0,0>
#declare n=n+1;
#end
}
#declare ring[7]=spline{ cubic_spline
#declare n=-1;
#while (n
<0,sin(n/npts*2*pi),cos(n/npts*2*pi)>+<12,0,0> ,rarm_transform)
#declare n=n+1;
#end
}




//#declare botpt=vtransform(<0,-6,0>,chin_transform);
#declare botpt=vtransform(<14,0,0> ,rarm_transform);

#declare themesh=
mesh2{
vertex_vectors{
npts*numrings+2
toppt,
#declare nspacer=0.5;

#declare ringo=0;
#while(ringo
<0,n+1,1+mod(n+1,npts)>,
#declare n=n+1;
#end

#declare a=1;
#declare anen=0;
#while(anen
0.25)
#declare np=0;
#while(np
,
,
#declare np=np+1;
#end
,
//
, //the problem??
, //the problem??
#else
//#//if(nspacer=0)
#declare np=0;
#while(np
,
,
#declare np=np+1;
#end
//
,
//<1,2,0>//
,
//
, //9:
, //9:

//
, //
, //,

#end
#declare nspacer=mod(nspacer+0.5,1);
#declare a=a+npts;
#declare anen=anen+1;
#end

#declare n=0;
#while(n
,
#declare n=n+1;
#end
}
pigment {rgb 1}
}

object{themesh rotate 180*y translate -12*x}
object{themesh rotate -90*x translate 12*y+8*z}
object{themesh rotate -104*y translate 15*x+5*z}

light_source{<0,200,-50> color rgb 1}
light_source{<0,200,0> color rgb x rotate -80*x rotate 45*y}
light_source{<0,200,0> color rgb z rotate -80*x rotate -45*y}
light_source{<0,0,0> color rgb 1 translate 10*x }
background{rgb 1}

No comments: