POV-Ray : Newsgroups : povray.binaries.images : Bathtub - take 2 : Re: Bathtub - take 2 Server Time
1 Aug 2024 14:26:59 EDT (-0400)
  Re: Bathtub - take 2  
From: Trevor G Quayle
Date: 20 Dec 2008 21:50:00
Message: <web.494dae6c6655db18c67b294d0@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> "alphaQuad" <alp### [at] earthlinknet> wrote:
> > "Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> >
>
> If you know the size of the pool box, then refer to uv_mapping in the docs to
> see how it gets applied.  You should be able to work out the proportions and
> mathematics from that.  I may do some more playing with it later when I get a
> chance.
>
> "3.5.7.1  Supported Objects"
> This section shows how the texture gets sampled and applied to a box object.
>
> -tgq

OK this took a little work, but should take the guesswork out of tiling the
pool.  I've added a few tricks to this as well.  The uvmapping you were using
can be adapted to a square shape pool, but if you were to change to a
rectangular shape, it would cause big problems.  This pattern will avoid this
and let you have reactangular pools with a consistent tile size and grout size.
 You'll also noticed that I offset the grouting by half its size and added a
half grout to the opposite side so the each full tile rectangle is bounded on
all sides by a half width of grout.  This makes it work nice at the edges so
that the tile is not butting the edges, but rather grout.  Each individual
x/y/z plane pattern is sized independently and then added to the areas
corresponding to the uv mapping of the box.  Next step will be to make it as a
single pattern...

-tgq


//START
#declare BSiz=<20,6,10>;  //Size of box
#declare TilSiz=<2,1>;    //Size of tile (x,y)
#declare Grt=0.1;         //Width of grout

#declare TilCol=rgb 0;  //Tile colour
#declare GrtCol=rgb 1;  // Grout colour

#declare DimX=Grt/TilSiz.u; //Grout scaling x
#declare DimY=Grt/TilSiz.v; //Grout scaling y
#declare DimZ=Grt/TilSiz.v; //Grout scaling z

#declare PX=pigment{  //Tile pattern x plane
      gradient x
      pigment_map{
        [  DimZ/2 GrtCol]
        [  DimZ/2 gradient y colour_map{[DimY/2 GrtCol][DimY/2 TilCol][1-DimY/2
TilCol][1-DimY/2 GrtCol]}]
        [1-DimZ/2 gradient y colour_map{[DimY/2 GrtCol][DimY/2 TilCol][1-DimY/2
TilCol][1-DimY/2 GrtCol]}]
        [1-DimZ/2 GrtCol]
      }
      scale <TilSiz.u/BSiz.z/4,TilSiz.v/BSiz.y/3>
}

#declare PY=pigment{  //Tile pattern y plane
      gradient x
      pigment_map{
        [  DimX/2 GrtCol]
        [  DimX/2 gradient y colour_map{[DimZ/2 GrtCol][DimZ/2 TilCol][1-DimZ/2
TilCol][1-DimZ/2 GrtCol]}]
        [1-DimX/2 gradient y colour_map{[DimZ/2 GrtCol][DimZ/2 TilCol][1-DimZ/2
TilCol][1-DimZ/2 GrtCol]}]
        [1-DimX/2 GrtCol]
      }
      scale <TilSiz.u/BSiz.x/4,TilSiz.v/BSiz.z/3>
}

#declare PZ=pigment{  //Tile pattern y plane
      gradient x
      pigment_map{
        [  DimX/2 GrtCol]
        [  DimX/2 gradient y colour_map{[DimY/2 GrtCol][DimY/2 TilCol][1-DimY/2
TilCol][1-DimY/2 GrtCol]}]
        [1-DimX/2 gradient y colour_map{[DimY/2 GrtCol][DimY/2 TilCol][1-DimY/2
TilCol][1-DimY/2 GrtCol]}]
        [1-DimX/2 GrtCol]
      }
      scale <TilSiz.u/BSiz.x/4,TilSiz.v/BSiz.y/3>
}

#declare BoxUV= //Tile pattern for uv box
  pigment{
    uv_mapping
    gradient x
    pigment_map{
      [1/4 PX]  //Xmin
      [1/4 gradient y pigment_map{
                                  [1/3 PY]  //Ymin
                                  [1/3 PZ]  //Zmax
                                  [2/3 PZ]  //Zmax
                                  [2/3 PY]  //Ymax
                                  }]
      [2/4 gradient y pigment_map{
                                  [1/3 PY]  //Ymin
                                  [1/3 PZ]  //Zmax
                                  [2/3 PZ]  //Zmax
                                  [2/3 PY]  //Ymax
                                  }]
      [2/4 PX]  //Xmax
      [3/4 PX]  //Xmax
      [3/4 PZ]  //Zmin
    }
  }

box{0, BSiz pigment{BoxUV}}
//END


Post a reply to this message

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