POV-Ray : Newsgroups : povray.newusers : Images on Cube Faces? Server Time
6 Nov 2024 10:25:45 EST (-0500)
  Images on Cube Faces? (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: Richard Butler
Subject: Images on Cube Faces?
Date: 9 Dec 1998 16:16:44
Message: <366EE7E9.5CCB@phly.com>
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

From: Julius Klatte
Subject: Re: Images on Cube Faces?
Date: 9 Dec 1998 18:07:11
Message: <366f029f.0@news.povray.org>
Place image_maps and rotate and scale them to fit your
needs.
That's all there is to it.

Happy tracing.

Julius


Post a reply to this message

From: Andrew Cocker
Subject: Re: Images on Cube Faces?
Date: 9 Dec 1998 18:17:54
Message: <366f0522.0@news.povray.org>
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
 //  apply the image
                                    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
 //  apply the image
                                    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
 //  apply the image
                                    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
 //  apply the image
                                    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
 //  apply the image
                                    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
 //  apply the image
                                    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

From: Andrew Cocker
Subject: Re: Images on Cube Faces?
Date: 9 Dec 1998 18:23:24
Message: <366f066c.0@news.povray.org>
Oops, the pov-code looked a hell of a lot neater at my end! Does anyone 
know what I'm doing wrong? (Outlook Express)

    Cheers,
Andy C.


Post a reply to this message


Attachments:
Download 'iso-8859-1' (1 KB)

From: Andrew Cocker
Subject: Re: Images on Cube Faces?
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

From: Spider
Subject: Re: Images on Cube Faces?
Date: 9 Dec 1998 19:49:09
Message: <366F19DE.4B109313@bahnhof.se>
Still looks like hell...
Try using Attach..

//Spider


Post a reply to this message

From: Spider
Subject: Re: Images on Cube Faces?
Date: 9 Dec 1998 19:50:12
Message: <366F1A1E.23B5BFA9@bahnhof.se>
As for the cube and planes...
I posted a macro here a few days ago, it is in binaries.scenefiles...

It can do just the thing you want it to... Create a cube from planes...

//Spider


Post a reply to this message

From: Nathan Kopp
Subject: Re: Images on Cube Faces?
Date: 10 Dec 1998 00:16:34
Message: <366F5974.24EBEA86@Kopp.com>
Richard Butler wrote:
> 
> 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?
> 

There is a way to make a texture wrap around the box instead of going
through the box.  Check out UVPov, which does uv mapping (surface mapping)
of textures.  You can read about it at (and get it from) my website:
http://nathan.kopp.com/patched.htm

The superpatch also contains my uv-mapping patch.  You can get it at:
http://www.twysted.net/PatchStation/suppatch.htm

If you try this and you have further questions about how exactly to do
uv mapping on the box, send me an email.

-Nathan Kopp


Post a reply to this message

From: Nieminen Mika
Subject: Re: Images on Cube Faces?
Date: 10 Dec 1998 06:49:34
Message: <366fb54e.0@news.povray.org>
A simpler way to make a side of the cube with an image would be:

polygon
{ 4,0,x,x+y,y
  pigment { image_map { tga "whatever.tga" } }
}

  5 more of these properly rotated and translated and you are done.

-- 
main(i){char*_="BdsyFBThhHFBThhHFRz]NFTITQF|DJIFHQhhF";while(i=
*_++)for(;i>1;printf("%s",i-70?i&1?"[]":" ":(i=0,"\n")),i/=2);} /*- Warp. -*/


Post a reply to this message

From: Ron Parker
Subject: Re: Images on Cube Faces?
Date: 10 Dec 1998 08:35:40
Message: <366fce2c.0@news.povray.org>
On Wed, 09 Dec 1998 16:13:13 -0500, Richard Butler <rbu### [at] phlycom> 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

Goto Latest 10 Messages Next 1 Messages >>>

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