POV-Ray : Newsgroups : povray.general : deforming a texture on a mesh : Re: deforming a texture on a mesh Server Time
29 Jul 2024 20:16:15 EDT (-0400)
  Re: deforming a texture on a mesh  
From: Christian Froeschlin
Date: 31 Aug 2010 13:35:32
Message: <4c7d3d64@news.povray.org>
esterichia wrote:

> I want to apply a texture to a disc (or a square or any plane object), applying
> some deformation to the image I'm using. The deformation is incremental and
> depends on the clock.

I can't help you with the mesh uv mapping, but it sounds
like you might be better off deforming the texture itself.
There are two ways of doing this: Using a warp {} block
in the texture, which is limited to certain types of
supported deformations, or pigment functions.

For the latter option, the idea is to convert you image
pigment into a pigment function, and define a new function
which represents a deformed pigment. As user-defined vector
functions are currently not supported this requires defining
separate R,G,B functions and average them together later.

Assuming P is your existing image map pigment, and
(fx(x,y),fy(x,y)) is some 2D deformation function
to be applied to the image with coordinates ranging
from 0 to 1, it should be similar to (untested):

#macro FROM_BLACK(COLOR)
color_map
{
   [0 color rgb 0]
   [1 color COLOR]
}
#end

#declare F = function { pigment {P} }

#declare R = pigment
{
   function {F(fx(x,y),fy(x,y),z).red} FROM_BLACK(Red)
}
#declare G = pigment
{
   function {F(fx(x,y),fy(x,y),z).green} FROM_BLACK(Green)
}
#declare B = pigment
{
   function {F(fx(x,y),fy(x,y),z).blue} FROM_BLACK(Blue)
}
#declare Q = pigment {average pigment_map {[R] [G] [B]} }


Hope this helps,

   Christian


Post a reply to this message

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