|
![](/i/fill.gif) |
On Wed, 09 Dec 1998 16:13:13 -0500, Richard Butler <rbu### [at] phly com> wrote:
>Hi,
>I just ended up pestering someone before finding this
>newsgroup. I hope someone here is willing to help a
>basic user! I have three questions:
>
>My three questions are:
>
>1. I wish to map separate images to the faces
> of a cube object. Is this possible or do I
> need to contruct a group object of planes/thin
> polygons?
This question was asked on cgrr in October, and Chris Colefax
posted what I consider the definitive answer, quoted below for
your edification:
+-----------------------
Solution 1, as previously recommended:
#declare Face = plane {-z, .5
pigment {image_map {tga "Image"} translate -.5}}
#declare Box = intersection {
object {Face} object {Face rotate y * 90}
object {Face rotate y * 180} object {Face rotate y * 270}
object {Face rotate x * 90} object {Face rotate x * -90}}
The box is created from <-.5, -.5, -.5> to <.5, .5, .5>, which you can
transform as you like. You can also use the Box object in CSG
operations, but the texture itself is not actually solid, which brings
us to solution 2:
#macro cube_map (base_pigment)
#local I = pigment {base_pigment translate <-.5, -.5, -.5>}
#local I2 = pigment {radial pigment_map {
[.125 I rotate <90, 0, -90>]
[.125 I rotate <0, 0, -90>] [.375 I rotate <0, 0, -90>]
[.375 I rotate <-90, 0, -90>] [.625 I rotate <-90, 0, -90>]
[.625 I rotate <0, 180, -90>] [.875 I rotate <0, 180, -90>]
[.875 I rotate <90, 0, -90>]}
rotate z * 90}
#local I3 = pigment {radial pigment_map {
[.125 I rotate <-90, 0, 90>] [.125 I] [.375 I]
[.375 I rotate <-90, 0, 270>] [.625 I rotate <-90, 0, 270>]
[.625 I rotate <180, 0, 0>] [.875 I rotate <180, 0, 0>]
[.875 I rotate <-90, 0, 90>]}
rotate x * 90}
radial pigment_map {
[.125 I3] [.125 I2] [.375 I2] [.375 I3]
[.625 I3] [.625 I2] [.875 I2] [.875 I3]}
#end
Save this macro to a file, and then include that file into your scene.
Now you can create a genuinely solid texture with the image arranged in
a cube, eg:
box {-.5, .5
pigment {cube_map (pigment {image_map {tga "Image"}} ) }
scale <1, 2, 3> rotate <15, -35, 0> translate <-5, 10, 3>}
The advantage of this method is that you're not restricted to boxes -
you can apply the pigment to any object (including CSG differences and
intersections), and you can actually use *any* pigment in place of the
image_map. The pigment is basically like six pyramids with their apexes
(or apices, if you prefer) stuck together to form the cube.
The image covers the base of each pyramid, but note that the joins
between the diagonal sides of each pyramid will be visible if you apply
the pigment to a non-cube surface - so we turn to Carl Perkins'
suggestion, ie. to use a warped image with spherical mapping. Start by
creating a scene containing only a cube created using either of the
above methods, and given a finish {ambient 1} (eg. add the finish to the
Face plane above, and create a scene with object {Box}). Now, add this
camera to the scene:
camera {panoramic angle 180 right x up y rotate y * clock * 180}
and render a two frame animation at a square resolution (eg.
Final_Frame=2 Width=300 Height=300). Join the resulting two frames
together, side by side (using DTA, or another image manipulation
program), and you will have a suitable, spherically-warped image, eg:
box {-1, 1
pigment {image_map {tga "Joined" map_type 1 interpolate 2}}
rotate <45, -45, 0>}
+---------------------
Post a reply to this message
|
![](/i/fill.gif) |