POV-Ray : Newsgroups : povray.general : Help needed with texture mapping : Re: Help needed with texture mapping Server Time
13 Aug 2024 19:28:33 EDT (-0400)
  Re: Help needed with texture mapping  
From: Dan Connelly
Date: 10 Jul 1998 09:16:29
Message: <35A60621.4087CF56@flash.net>
Peter Popov wrote:
> 
> Hi!
> 
> Can anyone help me to solve the following problem: I know the coordinates of
> a cylinder and I want to map a radial y pigment on it. I want to define the
> texture at the origin and then translate it. Or define a unit cylinder and
> somehow fit it into the coordinates I have.

I am afraid I don't understand the question completely, but in
general to place a texture there are two options:

* define the object in texture coordinates, then scale and/or translate
  both.

   example (not debugged) :

   cylinder {
     <0, 0, 0>,
     <1, 1, 1>,
     1
     texture { CylinderTexture }

     // the following transformations apply to the texture
     // and the object:
     scale S       // S : a scalar or vector
     rotate T      // T : a vector
     translate V   // V : a vector
   }
 
* define the texture, then scale it and/or translate it to match
  the object location.

   example (not debugged) :

   cylinder {
     V,              // V:  a vector
     V2,             // V2: a vector
     R               // R : a scalar
     texture {
       CylinderTexture

       // the following transformations apply to the texture
       // only :
       #declare H = vlength(V2 - V);
       #declare T = <atan2(...),atan2(.....),...>;  // math LAAEFTR :)
       scale <R, H, R>
       rotate T
       translate V
     }
   }


I am not implying the texture must always be matched to the
object in the manner shown... they are just typical examples.

Dan

-- 
http://www.flash.net/~djconnel/


Post a reply to this message

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