All the difficulty here, or the easy way rather, is to well position the fabric at the beginning, and to make so that it tends to gather in a smaller zone than its dimensions.
Once more, we will make it easy: a cube (witth rounded edges), lying on the ground:
#declare R = 1; #declare Cube = union { box { < R, 0, R>, < 1-R, 1, 1-R> } box { < R, 0, 0>, < 1-R, 1-R, 1> } box { < 0, 0, R>, < 1, 1-R, 1-R> } cylinder { < R, 0, R>, < R, 1-R, R>, R } cylinder { < R, 0, 1-R>, < R, 1-R, 1-R>, R } cylinder { < 1-R, 0, R>, < 1-R, 1-R, R>, R } cylinder { < 1-R, 0, 1-R>, < 1-R, 1-R, 1-R>, R } sphere { < R, 1-R, R>, R } sphere { < R, 1-R, 1-R>, R } sphere { < 1-R, 1-R, R>, R } sphere { < 1-R, 1-R, 1-R>, R } translate -.2*x } #declare Obstacle = union { plane { y,0 } object { Cube } }
We will reuse WriteClothFile(...) macro from the preceding example, and we will create a rectangular cloth (30 X 50 points):
WriteClothFile("drape.cth", 30, 50, 2/50, 20, 1.5) simcloth { environment Obstacle friction 0 gravity -.5*y damping 0.9 intervals 0.03 iterations 200 input "drape.cth" mesh_output "drape.msh" smooth_mesh on uv_mesh on } #declare Drap = mesh { #include "drape.msh" uv_mapping texture { pigment { checker color rgb<1, .5, .2> color rgb<1, .8 ,.4> scale <1/10, 3/50, 1> } } }
Well... hu... good, but it is not what is called pretty good-looking lying cloth (this one is rather banal...)
Let's modify the positioning of each point of the cloth, in macro WriteClothFile(...) , by carrying out a rotation of -60 degrees around axis Z, and slightly translating it towards the right, like this:
#local tempx = -l1/2 + i*nlng; #local tempz = -l2/2 + j*nlng; #local vtemp =; #local vtemp = vaxis_rotate(vtemp, z, -60); #local tempy = ht + (-1+2*rand(st))*nlng*0.1; #local vtemp = vtemp + tempy*y + .2*x; #write(file, vtemp.x, ",", vtemp.y, ",", vtemp.z, ", 0.0, 0.0, 0.0,\n")
One does not forget "to level up" the cloth, and the starting position can be visualized:
And finally, let the nature... well, ClothRay... do its job:
For the lazy ones, complete script: drape.pov
Obviously, the absence of internal test of collision (fabric against fabric) causes some "errors" (see in bottom of cloth).... But, one can nevertheless obtain more or less satisfactory things.