POV-Ray : Newsgroups : povray.general : Tiling an image map with non-zero map_type Server Time
25 Dec 2024 02:14:00 EST (-0500)
  Tiling an image map with non-zero map_type (Message 1 to 4 of 4)  
From: Tom York
Subject: Tiling an image map with non-zero map_type
Date: 25 Jun 2006 07:50:00
Message: <web.449e781d66a2ccd77d55e4a40@news.povray.org>
I have a torus that I would like to wrap a bitmapped texture around. So, I
have something like

torus {
  1, 0.05

  pigment {
    image_map {
      png "image_for_torus.png"
      map_type 5 // or even just uv_mapping, since torus {} has it
      // ...
    }
  }
}

Well, this works as advertised. The problem is that the texture image would
need to be 20 times as long as it is high to maintain an equal resolution
in both the U and V directions. if I use a texture 256 pixels high this
implies that I need to make it over 5000 pixels across to get constant
resolution, which seems a bit excessive. I'm using a torus instead of a
mesh to save memory, and using such a large texture means more memory use.
It would be nice to be able to tile it, but the toroidal mapping explicitly
prevents this. Is there a way to do this while keeping the toroidal mapping?

Tom


Post a reply to this message

From: Tom York
Subject: Re: Tiling an image map with non-zero map_type
Date: 25 Jun 2006 09:50:00
Message: <web.449e9442c80c6d017d55e4a40@news.povray.org>
Never mind, this seems to work well enough for my purpose:

pigment {
  image_map {
    png "image_for_torus.png"
    map_type 0
    interpolate 2
  }
  scale 0.02 // produces the tiling effect
  warp {
    toroidal
    orientation y // default torus is oriented with the X-Z plane
  }
}


Post a reply to this message

From: PM 2Ring
Subject: Re: Tiling an image map with non-zero map_type
Date: 26 Jun 2006 10:00:01
Message: <web.449fe6edc80c6d011bd1c060@news.povray.org>
"Tom York" <alp### [at] zubenelgenubi34spcom> wrote:
> I have a torus that I would like to wrap a bitmapped texture around. So, I
> have something like
>
> torus {
>   1, 0.05
>
>   pigment {
>     image_map {
>       png "image_for_torus.png"
>       map_type 5 // or even just uv_mapping, since torus {} has it
>       // ...
>     }
>   }
> }
>
> Well, this works as advertised. The problem is that the texture image would
> need to be 20 times as long as it is high to maintain an equal resolution
> in both the U and V directions. if I use a texture 256 pixels high this
> implies that I need to make it over 5000 pixels across to get constant
> resolution, which seems a bit excessive. I'm using a torus instead of a
> mesh to save memory, and using such a large texture means more memory use.
> It would be nice to be able to tile it, but the toroidal mapping explicitly
> prevents this. Is there a way to do this while keeping the toroidal mapping?

You can use a tiled image map, but you have to do it in stages. The trick is
to use a function image (3.5.11.16 in the 3.6 docs), also referred to as the
function internal bitmap, in the index.

First, create a pigment from your image using map_type 0. Then create the
pigment for the torus, using the first pigment as the function for the
function image. Something like this (untested!):

#declare PFlat =
pigment {
  image_map {
    png "image_for_torus.png"
  }
}

#declare PTorus =
pigment {
  image_map {
    function 2000,100 {
      pigment {PFlat}
    }
    map_type 5
  }
}

You'll also need to do some scaling (somewhere) to get the 20 repetitions.

I don't know how this will affect memory requirements or rendering speed -
it might work out better to just tile your image first with another
program.


Post a reply to this message

From: Tom York
Subject: Re: Tiling an image map with non-zero map_type
Date: 26 Jun 2006 18:40:00
Message: <web.44a06176c80c6d017d55e4a40@news.povray.org>
"PM 2Ring" <nomail@nomail> wrote:
> You can use a tiled image map, but you have to do it in stages. The trick is
> to use a function image (3.5.11.16 in the 3.6 docs), also referred to as the
> function internal bitmap, in the index.

I think the principle here is similar to what I came up with, but yours
looks more direct for images. Thanks!

> I don't know how this will affect memory requirements or rendering speed -
> it might work out better to just tile your image first with another
> program.

Oh, very little for this sort of size. I just objected on philosophical
grounds to having to tile a texture by hand! And the advantage of tiling it
in POV is that I could (should the madness take me) easily layer several
copies of the same texture, each with different numbers of repetitions, to
create a more complicated surface.

Thanks,

Tom


Post a reply to this message

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