POV-Ray : Newsgroups : povray.general : Tiling an image map with non-zero map_type : Re: Tiling an image map with non-zero map_type Server Time
1 Aug 2024 00:16:23 EDT (-0400)
  Re: Tiling an image map with non-zero map_type  
From: PM 2Ring
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

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