POV-Ray : Newsgroups : povray.newusers : Images on Cube Faces? : Re: Images on Cube Faces? Server Time
6 Sep 2024 06:23:26 EDT (-0400)
  Re: Images on Cube Faces?  
From: Andrew Cocker
Date: 9 Dec 1998 18:38:51
Message: <366f0a0b.0@news.povray.org>
I posted again in HTML

Hi Richard,
    Whilst I'm not a 'new-user', I still don't know a great deal about using
POV, so my answers may not be the most elegant solution. Anyway:

     You may have worked out that if you map an image onto one face of a
cube, it also shows up on the opposite face (it's gone all the way through),
therefore you are right in assuming that the best way of achieving what you
want is to create a cube from six seperate sides. This actually makes the
mapping of each image easier.
Now, I'm aware that this can be done by using infinite planes, but I don't
know how, so I would personally create six very thin boxes ( I find this
easier to visualise.)

When you map an image, it is by default mapped along the z axis ( into the
screen), and appears from <0,0,0> to <1,1,0>. The map is always a square,
regardless of the aspect ratio of the image being used. It is up to you to
scale it further if you desire.

First create a 'side' .Create it in the same position that the image map
projects

#declare SIDE_LEFT=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                     image_map {
                                        gif "image1.gif"
                                        once                             //
use this keyword to stop tiling
                                            }
                                            }
                                            }
                       translate <-.5,-.5,0>             // centre about
origin
                                    rotate y*90                //    face
the side left
                                    translate x*-0.5        //   move into
position
                                }

#declare SIDE_RIGHT=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                        image_map {
                                        gif "image2.gif"
                                        once
//use this keyword to stop tiling
                                            }
                                            }
                                            }
                                    translate <-.5,-.5,0>
//centre about origin
                                    rotate y*-90             //    face the
side right
                                    translate x*0.5        //   move into
position
                                }

#declare SIDE_TOP=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                        image_map {
                                        gif "image3.gif"
                                        once
//use this keyword to stop tiling
                                            }
                                            }
                                            }
                                    translate <-.5,-.5,0>             //
centre about origin
                                    rotate x*90                        //
face the side up
                                    translate y*0.5                 //
move into position
                                }
#declare SIDE_BOTTOM=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                        image_map {
                                        gif "image4.gif"
                                        once                             //
use this keyword to stop tiling
                                            }
                                             }
                                            }
                                    translate <-.5,-.5,0>             //
centre about origin
                                    rotate x*-90
//    face the side down
                                    translate y*-0.5
//   move into position
                                }
#declare SIDE_FRONT=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                        image_map {
                                        gif "image5.gif"
                                        once                             //
use this keyword to stop tiling
                                            }
                                             }
                                            }
                                    translate <-.5,-.5,0>             //
centre about origin
                                    translate z*-0.5                    //
move into position
                                }

#declare SIDE_BACK=box {<0,0,0>, <1,1,0.0001>          //  very thin
                                     texture {
                                    pigment {
                                        image_map {
                                        gif "image1.gif"
                                        once                             //
use this keyword to stop tiling
                                            }
                                             }
                                                }
                                    translate <-.5,-.5,0>             //
centre about origin
                                    translate z*0.5                    //
move into position
                                }


#declare IMAGE_CUBE=
union {
object {SIDE_LEFT}
object {SIDE_RIGHT}
object {SIDE_TOP}
object {SIDE_BOTTOM}
object {SIDE_FRONT}
object {SIDE_BACK}
//   rotate and scale etc as required
}


    Use the keyword  ONCE to stop an image repeating.

    Apologies for the messy code. This is the first time I've felt confident
with my own Pov-ability to offer help.

All the best,
Andy C.
Richard Butler wrote in message <366### [at] phlycom>...
>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?
>
>2. In either case, how do I accomplish this?
>
>3. How do I map an image to a face so that there
>   is no tiling and the image covers the face entirely
>   (assume I'm referring to a cube face of equal sides
>   and an image of square dimensions).
>
>
>Thanks in advance for any help you may be able to
>offer!
>
>Rich


Post a reply to this message

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