Modeling A Stick - Experiment #1 I wanted to capture some of - TopicsExpress



          

Modeling A Stick - Experiment #1 I wanted to capture some of the organic structure when modeling a stick. Sticks arent straight, well, they are straight, but in a crooked sort of way. The first things I probably should have thought of, was using a sphere_sweep with some type of crooked spline. But that wasnt the first thing I thought of. Instead, I had in mind that I would wrap a line of spheres or cylinders in a blob and perturb their positions with a random walk based on one of the many statistical distributions available in POV. The results arent too bad, but not entirely satisfactory either. Especially the close in. Because of the way blobs work, Im left with lumpiness artifacts that are sufficiently periodic to appear un-natural. Cant quite figure out how to get rid of them. Anyone having any thoughts about other ways to model a stick, or how to improve my lumpiness problem, please make a suggestion. In Experiment #2, I am going to try the sphere_sweep/spline method using the same or similar randomizing technique. I suspect I may have the exact opposite problem - not enough lumpiness. Theres one distance shot, and one close in shot. The stick on the left was produced with the spheres, on the right, with cylinders. My code follows for those interested in the macros. All comments appreciated. #include colors.inc #include functions.inc #include rand.inc #include woods.inc #declare meter = 1; #declare decimeter = meter / 10; #declare centimeter = meter / 100; #declare millimeter = meter / 1000; #declare inch = 2.54*centimeter; #declare foot = 12*inch; #declare m = meter; #declare cm = centimeter; #declare dm = decimeter; #declare mm = millimeter; #declare in = inch; #declare ft = foot; // global_settings { assumed_gamma 1 } background { Grey } camera{ location look_at 15*dm*y angle 75 //look_at //look_at //look_at 0 } light_source{ White parallel point_at 1*y} // Checkered planes // plane { y, 0 pigment { checker rgb , rgb }} // plane { z, 10 pigment { checker rgb , rgb }} // solid plane, vertical // plane { z, 10 pigment {color rgb }} // solid plane, horizontal // plane { y, 0 pigment {color rgb }} sky_sphere { pigment { gradient y color_map { [ 0.02 color MidnightBlue ] [ 0.025 color Violet ] [ 0.075 color CornflowerBlue ] [ 0.98 color CornflowerBlue ] [ 1.0 color MidnightBlue ] } scale 2 //translate -1 } emission rgb } #macro BLOB_SPHERE_LINE( len, // Overall length of the line of spheres rad, // radius of each sphere sep, // separation between each sphere center strn, // strength value for each blob sphere ) // len = n*sep +2*rad // len = n_i*(sep+n_r*sep/n_i)+2*rad n_i interger part, 0 < n_r < 1 #local n = (len - 2*rad)/sep; #local n_i = floor(n); #local n_r = n - n_i; #local sepAdj = n_r*sep/n_i; #local dropAt = rad; #for (idx, 1, n_i, 1) sphere {0, rad, strn pigment { color Green } translate dropAt*y} #local dropAt = dropAt + sep + sepAdj; #end // for #end #macro BLOB_SPHERE_WALK( len, // Overall length of the line of spheres rad, // radius of each sphere sep, // separation between each sphere center strn, // strength value for each blob sphere rnd_x, // random number stream for x axis perturbations rnd_z, // random number stream for z axis perturbations muting, // must be > 0, the higher the number, the more the turbulence is muted ) // len = n*sep +2*rad // len = n_i*(sep+n_r*sep/n_i)+2*rad n_i interger part, 0 < n_r < 1 #local n = (len - 2*rad)/sep; #local n_i = floor(n); #local n_r = n - n_i; #local sepAdj = n_r*sep/n_i; #local dropAt = rad; #local walk_x = 0; #local walk_z = 0; #for (idx, 1, n_i, 1) sphere {0, rad, strn translate dropAt*y+walk_x*x+walk_z*z} #local dropAt = dropAt + sep + sepAdj; #local walk_x = walk_x + Rand_Gauss(0,rad/muting,rnd_x); #local walk_z = walk_z + Rand_Gauss(0,rad/muting,rnd_x); #end // for #end #macro BLOB_CYLINDER_WALK( len, // Overall length of the line of spheres rad, // radius of each sphere sep, // separation between each sphere center strn, // strength value for each blob sphere rnd_x, // random number stream for x axis perturbations rnd_z, // random number stream for z axis perturbations muting, // must be > 0, the higher the number, the more the turbulence is muted ) // len = n*sep +2*rad // len = n_i*(sep+n_r*sep/n_i)+2*rad n_i interger part, 0 < n_r < 1 #local n = (len - 2*rad)/sep; #local n_i = floor(n); #local n_r = n - n_i; #local sepAdj = n_r*sep/n_i; #local dropAt = rad; #local dropAt_prev = rad; #local walk_x = 0; #local walk_z = 0; #local walk_x_prev = 0; #local walk_z_prev = 0; #for (idx, 1, n_i, 1) #if (idx > 1) cylinder {(walk_x_prev-walk_x)*x+(dropAt_prev-dropAt)*y+(walk_z_prev-walk_z)*z,0,rad,strn translate dropAt*y+walk_x*x+walk_z*z} #end #local dropAt_prev = dropAt; #local dropAt = dropAt + sep + sepAdj; #local walk_x_prev = walk_x; #local walk_z_prev = walk_z; #local walk_x = walk_x + Rand_Gauss(0,rad/muting,rnd_x); #local walk_z = walk_z + Rand_Gauss(0,rad/muting,rnd_x); #end // for #end /* #macro BLOB_SPHERE_CYLINDER_WALK( len, // Overall length of the line of spheres rad, // radius of each sphere sep, // separation between each sphere center strn, // strength value for each blob sphere rnd_x, // random number stream for x axis perturbations rnd_z, // random number stream for z axis perturbations muting, // must be > 0, the higher the number, the more the turbulence is muted ) // len = n*sep +2*rad // len = n_i*(sep+n_r*sep/n_i)+2*rad n_i interger part, 0 < n_r < 1 #local n = (len - 2*rad)/sep; #local n_i = floor(n); #local n_r = n - n_i; #local sepAdj = n_r*sep/n_i; #local dropAt = rad; #local dropAt_prev = rad; #local walk_x = 0; #local walk_z = 0; #local walk_x_prev = 0; #local walk_z_prev = 0; #for (idx, 1, n_i, 1) // sphere {0, rad, strn pigment { color Green } translate dropAt*y+walk_x*x+walk_z*z} sphere {0, rad, strn scale y translate dropAt*y+walk_x*x+walk_z*z} #if (idx > 1) cylinder {(walk_x_prev-walk_x)*x+(dropAt_prev-dropAt)*y+(walk_z_prev-walk_z)*z,0,rad,0.1*strn translate dropAt*y+walk_x*x+walk_z*z} #end #local dropAt_prev = dropAt; #local dropAt = dropAt + sep + sepAdj; #local walk_x_prev = walk_x; #local walk_z_prev = walk_z; #local walk_x = walk_x + Rand_Gauss(0,rad/muting,rnd_x); #local walk_z = walk_z + Rand_Gauss(0,rad/muting,rnd_x); #end // for #end */ #local rnd_x = seed(534236); #local rnd_z = seed(34536); blob { threshold 0.50 BLOB_SPHERE_WALK (2*m, 3*cm, 1.5*cm, 1, rnd_x, rnd_z, 10) texture { T_Wood14 rotate x*90 scale 0.01 } translate 5*dm*y } #local rnd_x = seed(534236); #local rnd_z = seed(34536); blob { threshold 0.50 BLOB_CYLINDER_WALK (2*m, 3*cm, 1.5*cm, 1, rnd_x, rnd_z, 10) texture { T_Wood14 rotate x*90 scale 0.01 } translate 5*dm*y translate 20*cm*x }
Posted on: Sun, 01 Jun 2014 20:59:56 +0000

Trending Topics



Recently Viewed Topics




© 2015