POV-Ray : Newsgroups : povray.binaries.images : Textured block pattern problem Server Time
14 Nov 2024 16:24:13 EST (-0500)
  Textured block pattern problem (Message 1 to 10 of 44)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Jörg 'Yadgar' Bleimann
Subject: Textured block pattern problem
Date: 24 Mar 2009 20:51:36
Message: <49c98018$1@news.povray.org>
High!

While playing around with procedurally generated countries' flags, I 
tried to use them in patterns... and to make it simple in the beginning, 
I started with a checker pattern containing the flags of Palau and 
Trinidad and Tobago:

The include file containing the texture definitions (I plan to program 
all sovereign countries' flags of the world later on):

// beginning of procflags.inc

#declare F_NoLights =
finish
{
   ambient 1
   diffuse 0
}

#declare P_Flag_Palau =
pigment
{
   spherical
   color_map
   {
     [0 rgb <0, 0.75, 1>]
     [0.0001 rgb <0, 0.75, 1>]
     [0.0001 rgb <1, 1, 0>]
   }
   // translate <-0.1, 0, 0.03>
}

#declare T_Flag_Palau =
texture
{
   pigment { P_Flag_Palau }
   finish { F_NoLights }
}

#declare P_Flag_TrinidadAndTobago =
pigment
{
   gradient x
   triangle_wave
   color_map
   {
     [0.87 rgb <1, 0, 0>]
     [0.87 rgb 1]
     [0.92 rgb 1]
     [0.92 rgb 0]
   }
   rotate y*45
}

#declare T_Flag_TrinidadAndTobago =
texture
{
   pigment { P_Flag_TrinidadAndTobago }
   finish { F_NoLights }
}

// end of procflags.inc

And the actual test scene:

// beginning of procflagstest.pov

#include "procflags.inc"

plane
{
   y, 0
   texture
   {
     pigment
     {
       checker
       pigment { P_Flag_Palau }
       pigment { P_Flag_TrinidadAndTobago }
     }
     finish { ambient 1 diffuse 0 }
   }
}

camera
{
   location <0, 10, 0>
   look_at 0
   angle 40
}

// end of procflagstest.pov

...but the textures continue through the checker pattern rather than 
being "copied" into each checker cell (see attached picture) - is this a 
general shortcoming of the checker pattern, or are there ways to avoid this?

See you on www.khyberspace.de!

Yadgar


Post a reply to this message


Attachments:
Download 'procflagstest.png' (4 KB)

Preview of image 'procflagstest.png'
procflagstest.png


 

From: clipka
Subject: Re: Textured block pattern problem
Date: 24 Mar 2009 21:40:00
Message: <web.49c98a9e143ba0c5ee2312a30@news.povray.org>
=?ISO-8859-1?Q?J=F6rg_=27Yadgar=27_Bleimann?= <yaz### [at] gmxde> wrote:
> ...but the textures continue through the checker pattern rather than
> being "copied" into each checker cell (see attached picture) - is this a
> general shortcoming of the checker pattern, or are there ways to avoid this?

All the checker pattern does is "weave" two textures (or pigments or whatever)
together in an alternating fashion. It does no transformations whatsoever on
the textures themselves.

This is not a "shortcoming" - it's just the way the checker pattern works.
Having the pattern repeat for each tile is not always desired, so that requires
an additional operation, a so-called warp (more precisely, a repeat warp in this
case; you probably need two of them). See "3.5.12.6.2  Repeat Warp" in the POV
3.6 documentation.


Post a reply to this message

From: Jörg 'Yadgar' Bleimann
Subject: Re: Textured block pattern problem
Date: 24 Mar 2009 22:16:19
Message: <49c993f3@news.povray.org>


clipka wrote:

> This is not a "shortcoming" - it's just the way the checker pattern works.
> Having the pattern repeat for each tile is not always desired, so that requires
> an additional operation, a so-called warp (more precisely, a repeat warp in this
> case; you probably need two of them). See "3.5.12.6.2  Repeat Warp" in the POV
> 3.6 documentation.

Oh, it's legal to use more than one warp in each pattern? Then here we 
go! But there's still one problem: almost all countries' flags are 
rectangles (usually at a 3:2 ratio) rather than squares, so I need to 
scale the checker cells *before* I insert the defined textures...

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'procflagstest.png' (5 KB)

Preview of image 'procflagstest.png'
procflagstest.png


 

From: Jörg 'Yadgar' Bleimann
Subject: Re: Textured block pattern problem
Date: 24 Mar 2009 22:30:33
Message: <49c99749@news.povray.org>
High!


>But there's still one problem: almost all countries' flags are 
> rectangles (usually at a 3:2 ratio) rather than squares, so I need to 
> scale the checker cells *before* I insert the defined textures...

I got it... scaling the checker pattern and then reciprocally rescaling 
the textures does the trick!

plane
{
   y, 0
   texture
   {
     scale x*1.5
     pigment
     {
       checker
       pigment { P_Flag_Palau scale 0.3 scale <2/3, 0, 0> translate 
<0.42, 0, 0.5> warp { repeat x } warp { repeat z } }
       pigment { P_Flag_TrinidadAndTobago scale <2/3, 0, 0> translate 
x*0.65 warp { repeat x } warp { repeat z } }
     }
     finish { ambient 1 diffuse 0 }
   }
}

See you in Khyberspace!

Yadgar


Post a reply to this message


Attachments:
Download 'procflagstest.png' (15 KB)

Preview of image 'procflagstest.png'
procflagstest.png


 

From: Bill Pragnell
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 05:30:00
Message: <web.49c9f976143ba0c56dd25f0b0@news.povray.org>
"clipka" <nomail@nomail> wrote:
> an additional operation, a so-called warp (more precisely, a repeat warp in this
> case; you probably need two of them). See "3.5.12.6.2  Repeat Warp" in the POV
> 3.6 documentation.

Dang, I completely forgot about repeat warps. Looks like I reinvented the wheel
again... ;-)


Post a reply to this message

From: Jaime Vives Piqueres
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 09:17:28
Message: <49ca2ee8@news.povray.org>

> Dang, I completely forgot about repeat warps. Looks like I reinvented the
> wheel again... ;-)

  I always thought that POV-Ray was specially crafted for people who like to
reinvent the 3D wheel... :)

--
Jaime


Post a reply to this message

From: Bill Pragnell
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 09:30:00
Message: <web.49ca31b7143ba0c56dd25f0b0@news.povray.org>
Jaime Vives Piqueres <jai### [at] ignoranciaorg> wrote:

> > Dang, I completely forgot about repeat warps. Looks like I reinvented the
> > wheel again... ;-)
>
>   I always thought that POV-Ray was specially crafted for people who like to
> reinvent the 3D wheel... :)

It's often quicker to do so than go hunting through docs and resources...!

I was making some textures the other day by drawing pictures with spherical and
boxed pigments, then tessellating them. Because I was using pigment functions
to combine the various shapes, it seemed obvious to call them as

fn(x-floor(x), 0, z-floor(z)).x

to get the repetition...


Post a reply to this message

From: clipka
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 11:05:00
Message: <web.49ca4724143ba0c5c1f399840@news.povray.org>
"Bill Pragnell" <bil### [at] hotmailcom> wrote:
> >   I always thought that POV-Ray was specially crafted for people who like to
> > reinvent the 3D wheel... :)
>
> It's often quicker to do so than go hunting through docs and resources...!
>
> I was making some textures the other day by drawing pictures with spherical and
> boxed pigments, then tessellating them. Because I was using pigment functions
> to combine the various shapes, it seemed obvious to call them as
>
> fn(x-floor(x), 0, z-floor(z)).x
>
> to get the repetition...

Yeah. It seems that most things are actually quite trivial in POV - at least in
the original latin sense, literally meaning "having three ways" ;)

In this case, another one would be to use the pattern as a function image (see
3.5.11.16) without the "once" keyword ;) (didn't test it, but I guess it should
tile like any proper image would)


You know you've been raytracing too long when...
    ... you know every little trick the POV SDL has to offer ;)


Post a reply to this message

From: Darren New
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 11:53:20
Message: <49ca5370$1@news.povray.org>
Jaime Vives Piqueres wrote:
>  I always thought that POV-Ray was specially crafted for people who like to
> reinvent the 3D wheel... :)

Or at least the sphere.

-- 
   Darren New, San Diego CA, USA (PST)
   My fortune cookie said, "You will soon be
   unable to read this, even at arm's length."


Post a reply to this message

From: clipka
Subject: Re: Textured block pattern problem
Date: 25 Mar 2009 12:30:00
Message: <web.49ca5af3143ba0c5c1f399840@news.povray.org>
Darren New <dne### [at] sanrrcom> wrote:
> Jaime Vives Piqueres wrote:
> >  I always thought that POV-Ray was specially crafted for people who like to
> > reinvent the 3D wheel... :)
>
> Or at least the sphere.

Yeah, those are "tri-vial" as well: You can use POV's standard sphere{}, but
occasionally you are better off with a sperical blob element. And occasionally
you may have reason to model it as an isosurface - or a mesh, for that
matter...

Using bicubic patches to approximate a sphere seems to be a bit difficult
though...

;)


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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