POV-Ray : Newsgroups : povray.general : --- Server Time
2 Nov 2024 13:18:19 EDT (-0400)
  --- (Message 1 to 1 of 1)  
From: Mike Williams
Subject: Re: Curtains again...
Date: 8 Mar 2004 13:02:15
Message: <8Z2XKAAVQHTAFwV+@econym.demon.co.uk>
Wasn't it Darren New who wrote:
>I'm trying to put images on curtains to make a tapestry. The curtains 
>themselves are linear_sweep cubic_spline prisms. It seems to work 
>mostly-ok if I have a curtain that is essentially in the x-y plane, and 
>if I rotate the image I can put it on a curtain that's in the y-z plane.
>
>However, I was trying to use uv_mapping to get the image to conform to 
>the surface, and it seems to work (I think) on a curtain in the x-y 
>plane, but gives me all kinds of bizarre results in the y-z plane. 
>(Again, not planes, but prisms that are basically long and skinny.)
>
> From reading the manual, it looks like image mapping onto a prism isn't 
>supported in 3.5. From playing around with trying to make it work, and 
>dropping back to simpler examples, it seems like a non-uv-mapped image 
>fits in the 1x1 square (regardless of the actual shape of the image, 
>too, which seems odd) and a uv-mapped image is ... larger? Or is it 
>mapped point-for-point with images on the object it's wrapping and I'm 
>just misinterpreting what I'm seeing?

Uv mapping is not supported for prism object. The "uv_mapping" keyword
is ignored and you get exactly the same result as for non-uv-mapping.
The image is painted onto the <0,0>,<1,1> square.

>Is there any way of getting an image to map to a spline and look like 
>it's following with wiggles?

You have to use one of the objects that supports uv_mapping. That's
bicubic_patch, mesh, mesh2, lathe, sor, sphere or box. I guess it would
be possible to construct a curtain from bicubic pathces, but I'd tend to
go with meshes since I'm more familiar with mesh generators.

Here's a simple example using Ingo Janssen's "param.inc". The x
parameter of MySpline controls how x varies (it's almost linear with a
bit of a sway). The y parapmeter of MySPline controls how y varies (it
stretches slightly at the top, as if the curtain stretches under its own
weight). The z parameter of MySpline controls how z varies (it wiggles
back and forth). I've added some slight sideways wiggles with the 
"+ MySpline(v).z*0.2" bit.

"param.inc" is part of the "mmmm" package at 
<http://members.home.nl/seedseven/>

#declare MySpline = function {
   spline {
     cubic_spline 
    -1.5, <-1.5,-1.5,  -0.2>,
    -1.0, <-1,  -1.0,   0.2>,
    -0.5, <-0.4,-0.5,  -0.2>,
     0.0, < 0,   0.0,   0.2>,
     0.5, < 0.6, 0.5,  -0.2>,
     1.0, < 1,   1.5,   0.2>,
     1.5, < 1.5  2.5,  -0.2>
   }
 }

#declare Fx = function(x,y) {MySpline(u).x}
#declare Fy = function(x,y) {MySpline(y).y}
#declare Fz = function(x,y) {MySpline(u).z + MySpline(v).z*0.2}

#include "param.inc"

object {Parametric(Fx,Fy,Fz,<-1,-1>,<1,1>,20,20,"")
    pigment {uv_mapping image_map {png "arrow.png"}}
}


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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