POV-Ray : Newsgroups : povray.advanced-users : drapes/curtians : Re: drapes/curtians Server Time
30 Jul 2024 04:17:54 EDT (-0400)
  Re: drapes/curtians  
From: Mike Williams
Date: 2 Apr 2000 10:23:25
Message: <WHb+MDAOa154EwCm@econym.demon.co.uk>
Wasn't it Robert Jefferson who wrote:

>How do you make drapes for a romm

I do it with isosurfaces.

I built it up like this:-

Stage 1: a vertical plane contained by a box gives a flat rectangle.

  isosurface {
    function { z }
    contained_by {box {-1,1}}
    open
  }


Stage 2: add a sin wave in the x direction to create folds in the
material

  function { z + sin(x*12)*0.15 }


Stage 3: add a second wave with a different frequency to make the folds
look less regular

  function { z + (sin(x*12)+cos(x*7))*0.15 }


Stage 4: the curtains in my room have a tendency to be less folded at
the top, where they meet the curtain rail. To reduce the folding to zero
at (y=1) we would multiply the fold effect by (y-1), but the material
isn't perfectly straight at the top, so try multiplying by (y-1.5) so
that the zero point is a little way off the top.

  function { z + (sin(x*12)+cos(x*7))*0.15*(y-1.5) }

Stage 5: but now the folds have become a little exaggerated at the
bottom edge, because ay y=-1 they're being multiplied by -2.5, so reduce
the 0.15 factor.

  function { z + (sin(x*12)+cos(x*7))*0.05*(y-1.5)}

Stage 6: that's not bad for heavy curtains, but perhaps lighter curtains
should have a high frequency component to the folds, like this

  isosurface {
    function { z + (sin(x*12)+cos(x*7)/2-sin(x*50)/4)*0.025*(y-1.5)}
    contained_by {box {-1,1}}
    open
    pigment {rgb <1,.5,0>}
  }


If you're using MegaPOV 0.3 or earlier, replace "contained_by  open"
with "clipped_by".

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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