POV-Ray : Newsgroups : povray.general : Mapping Textures on irregular shapes : Re: Mapping Textures on irregular shapes Server Time
15 Jul 2024 07:46:53 EDT (-0400)
  Re: Mapping Textures on irregular shapes  
From: Bald Eagle
Date: 22 Apr 2020 07:05:01
Message: <web.5ea0245d72e01857fb0b41570@news.povray.org>
"Josh" <nomail@nomail> wrote:
> I am trying to figure out how to map a texture onto 3D shapes that don't
> resemble spheres, cylinders, etc., described by the map_type. Say for example I
> have an asteroid shape that resembles a big baby rattle, where one end bulges
> much more than the other. When I apply an image's texture to the shape, the
> image is very stretched on the parts that bulge and looks shrunk elsewhere. Is
> there a way to map a texture onto an irregular shape where the surface area of
> the texture map is evenly applied to the surface area of the shape?
>
> I'm a beginner at pov-ray, and I don't know if I'm explaining this well. Does
> that make sense?
>
> Maybe another way to say it is that for a given surface area of the shape, I
> want the same surface area of the texture to be used, regardless of the shape
> the texture is being applied to.

Hi Josh -

The short answer is "maybe" and "it depends", and the long answer will probably
constitute the remainder of this thread.  :)

A typical planar pigment pattern is likened to projecting a slide of that
pattern across a room - the 3D space that you're working in.   You can place
your "transparent", unpigmented object into that space, and - voila! - your
shape adopts and reflects the colors and patterns of the projection in the
places where it intersects with it.

If you put a long taper on the side of an object, the pattern will "stretch"
along that just like the projection, because the pattern indeed stretches to
infinity.

You can "map" that planar pigment to a different geometry in 3D space just like
you can map x, y, and z into equations for circles, spheres, tori, etc.

AFAIK (I'm no expert), you can do that implicitly, or parametrically.

What Thomas suggests is using uv-mapping, which is a sort of parametric mapping,
and will likely give you what will work.
It will be a loose parametric mapping, sorta like shrink-wrapping your shape
with a plastic film that was designed for a sphere, and shrinks and stretches to
fit around any deviation from the sphere.
But it usually looks good enough for most purposes.

If your shape (or a new version of it) can be described with a parametric
equation of u and v, then you should be able to get an exact fit: a 1 to 1
mapping of the pigment pattern in rectangular coordinates to the surface of your
object in 3D space.

Optionally, you could use a pigment pattern that is defined in 3D space instead
of just a 2D plane (like crackle solid) and that might look a lot better with no
"stretching".

Hope that helps and isn't too confusing.  :)


- Bill


Post a reply to this message

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