|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |