POV-Ray : Newsgroups : povray.general : Texture mapping issues Server Time
23 Dec 2024 22:30:19 EST (-0500)
  Texture mapping issues (Message 1 to 2 of 2)  
From: jhu
Subject: Texture mapping issues
Date: 13 Sep 2006 11:15:00
Message: <web.45081f521916541c8f9cd9930@news.povray.org>
Is there a good way to have an image_map wrap around an object with
artifact? For example, an putting an image_map on a box using planar
mapping would actually require constructing six boxes, one for each side,
and then placing the texture on each side separately (otherwise just
declaring one box and placeing the texture will result in the sides not
getting textured). But for something like a superellipsoid, how would this
be done?


Post a reply to this message

From: Warp
Subject: Re: Texture mapping issues
Date: 13 Sep 2006 12:37:53
Message: <450833e0@news.povray.org>
jhu <nomail@nomail> wrote:
> For example, an putting an image_map on a box using planar
> mapping would actually require constructing six boxes, one for each side,
> and then placing the texture on each side separately

  No, it doesn't require that, as this simple example demonstrates:

camera { location -z*6 look_at 0 angle 35 }
light_source { <15, 20, -50>, 2 }

box
{ -1, 1
  uv_mapping
  pigment { image_map { jpeg "image" } scale <1/4, 1/3> }
  rotate y*30 rotate x*-30
}

> But for something like a superellipsoid, how would this be done?

  Emulating the box-shaped uv-map with a pattern is certainly not
trivial, but doable. This should do something like that (note that
you can put different pigments at different sides):

camera { location -z*6 look_at 0 angle 35 }
light_source { <15, 20, -50>, 2 }

#declare Pyramid = function { abs(x) < y & abs(z) < y };

#declare CubePattern =
  function
  { Pyramid(x, -z, y)*1/6+
    Pyramid(y, x, z)*2/6+
    Pyramid(x, z, y)*3/6+
    Pyramid(y, -x, z)*4/6+
    Pyramid(x, -y, z)*5/6
  };

#declare Image =
  pigment
  { image_map { jpeg "image" }
    translate -.5
    scale 2
  };

#declare ThePigment =
  pigment
  { function { CubePattern(x, y, z) }
    pigment_map
    { [0/6 Image rotate x*90]
      [1/6 Image]
      [2/6 Image rotate -y*90]
      [3/6 Image rotate -y*180]
      [4/6 Image rotate y*90]
      [5/6 Image rotate -x*90]
    }
  };

superellipsoid
{ <.2, .2>
  pigment { ThePigment }
  rotate y*30 rotate x*-30
}


-- 
                                                          - Warp


Post a reply to this message

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