POV-Ray : Newsgroups : povray.binaries.images : Bathtub - take 2 : Re: Bathtub - take 2 Server Time
1 Aug 2024 14:32:42 EDT (-0400)
  Re: Bathtub - take 2  
From: Trevor G Quayle
Date: 20 Dec 2008 17:45:01
Message: <web.494d74666655db18c67b294d0@news.povray.org>
"alphaQuad" <alp### [at] earthlinknet> wrote:
>
> when you said "The 1/7 value is the grout width value." , a light sort of went
> on ... but there is y grout and and x grout.
>
> the math for the correct y-grout-[scale] due to y-scaling is ... ? puzzling
>  ".5" value which I guessed at, since it looked 2 times too big.
>
> In the real Lego world this is what worked:
>
> #declare TilSiz= <6/7,12/7,1>;  //tile offsetting (tile size plus grout line)
> #declare GrtSiz= 1/7; //grout width
> //0.142857
> echof(GrtSiz/(TilSiz.x+GrtSiz))     // 0.14286
> cr()
> echof(GrtSiz/(TilSiz.y+GrtSiz))     // 0.07143
> cr()
> #declare tileplaid =
> #if (10)
> texture {
>     pigment { uv_mapping
>       gradient x
>       pigment_map{
>         [GrtSiz/(TilSiz.x+GrtSiz) rgb 1]
>         [GrtSiz/(TilSiz.x+GrtSiz) gradient y
>           colour_map{
>             [GrtSiz/(TilSiz.y+GrtSiz) rgb 1]
>             [GrtSiz/(TilSiz.y+GrtSiz) rgb <.6,.6,1> ]
>           }
>         ]
>       }
>       //scale TilSiz*.01
>       scale <1/160,1/20,1>*.7
>     }
>     finish { basic_finish }
> }
> #else
> texture {
>     pigment { uv_mapping
>       gradient x
>       pigment_map{
>         [1/7 rgb 1]
>         [1/7 gradient y
>           colour_map{
>             [(1/7)*.5 rgb 1]
>             [(1/7)*.5 rgb <.6,.6,1> ]
>           }
>         ]
>       }
>       scale <1/160,1/20,1>*.7 // ==  0.00625 / .05 = 0.125 1/8
>     }
>     finish { basic_finish }
> } #end
>
>
> still had to scale by something else not TilSiz
> scale by TilSiz = a grout line half the pool's width and tiles with a greater
> xdim


x grout and y grout should be handled just fine the way I showed, as long as you
want it the same tickness for both.

I'm not sure how you are applying the texture, but it's likely the uv mapping
that is causing you an issue as the pattern is not getting scaled as expected
(or rather as wanted...).  The scale you are using is 1/160 x 1/20 which is an
8:1 ratio, whereas you are getting the pattern to work by misscaling by a 2:1
ratio.  You need to determine how the uv mapping is effecting the pattern and
scale both the x/y of the tiles and have a separate x&y grout scaling that is
based on the proportional scaling that the uv mapping is applying.

-tgq


Post a reply to this message

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