POV-Ray : Newsgroups : povray.binaries.images : woven cloth modeling : woven cloth modeling Server Time
7 Aug 2024 23:21:30 EDT (-0400)
  woven cloth modeling  
From: Lonnie
Date: 4 Nov 2005 04:20:00
Message: <web.436b25a72e95780d5d3b08c0@news.povray.org>
It took about 15 minutes of typing from the germ of the idea to the start of
rendering, but before the first pixel was written I realized how messed up
this would be.   No I don't mean the edge - that's  simple to fix.  I mean
the fabric is only distorted in the y direction.  Perfectly elastic, not at
all real world behavior.  A quick and dirty fix would be to "normalize" the
intersections (nodes) of the crossing splines by estimating
the real length of each x and z spline, then adjusting spacing by the mean.
 I may render that version just for fun, and to test out some arrays I need
later.  The right way to do this is tensor analysis.  Yipes!  Multilinear
algebra, but doable.   Elasticity is a fourth rank tensor,  which relates
stress and strain on the thread (and therefore stretchtng and warping.)
Friction with the underlaying surface needs to be factored in,  as well as
gravity, mass of the thread, and the dynamics of how the cloth landed in
the first place, which is where I'll start with coordinate transformations.
 Any thoughts and suggestions (HELP!) welcome .

I used a  height field in this example,  try an isosurface!

#version 3.6;

global_settings {
  assumed_gamma 1.0
}

camera {
  location  <-32.0, 36.5, 13.0>
  direction 1.5*z
  right     x*image_width/image_height
  look_at   <50.0, -4.0,  50.0>
}

light_source {
  <0,0,0>
  color rgb <1, 1, 1>
  translate <-86, 151, -300>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

#declare myheight=height_field {
  sys
  "height.bmp"   // mine is 200x200, hand painted
  smooth
  scale <100,25,100>
}

union{
  plane {y, -2}
  object{myheight translate <0,-2,0>}
  texture{
    pigment{
      granite
      color_map{
        [0.0 color rgb <.4,.3,.2>]
        [0.2 color rgb <.3,.16,.1>]
        [0.5 color rgb <.2,.3,.2>]
        [0.7 color rgb <.7,.5,.2>]
        [1.0 color rgb <.1,.05,.0>]
      }
    }
  }
}

// no need for arrays now - just build the sweeps

#declare mynormal=<0,0,0>;   // here are the z sweeps
#declare myflip=0;
#declare mx=0;
  #while(mx<100)
    #if (myflip=0)
      #declare myflip=1;
    #else
      #declare myflip=0;
    #end
  #declare mz=0;
  sphere_sweep{
    b_spline
    102,
    <mx,0,-2>,.2
    #while(mz<100)
      #if (myflip=0)
        #declare myflip=1;
      #else
        #declare myflip=0;
      #end
      #declare my=trace(myheight,<mx,30,mz>,<0,-1,0>,mynormal).y;
      #if (myflip=true)
        <mx,my+1,mz>,.2
      #else
        <mx,my-1,mz>,.2
      #end
      #declare mz=mz+1;
    #end
    <mx,0,100>,.2
    texture{
      pigment{ color rgb <0,.5,.9>}
      finish{specular .5}
    }
  }
  #declare mx=mx+1;
#end

#declare mynormal=<0,0,0>;  // and here are the x sweeps
#declare myflip=1;
#declare mz=0;
  #while(mz<100)
    #if (myflip=0)
      #declare myflip=1;
    #else
      #declare myflip=0;
    #end
  #declare mx=0;
  sphere_sweep{
    b_spline
    102,
    <mx,0,-2>,.2
    #while(mx<100)
      #if (myflip=0)
        #declare myflip=1;
      #else
        #declare myflip=0;
      #end
      #declare my=trace(myheight,<mx,30,mz>,<0,-1,0>,mynormal).y;
      #if (myflip=true)
        <mx,my+1,mz>,.2
      #else
        <mx,my-1,mz>,.2
      #end
      #declare mx=mx+1;
    #end
    <mx,0,100>,.2
    texture{
      pigment{ color rgb <.7,.5,.2>}
      finish{specular .5}
    }
  }
  #declare mz=mz+1;
#end


Post a reply to this message


Attachments:
Download 'weave2.jpg' (130 KB)

Preview of image 'weave2.jpg'
weave2.jpg


 

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.