POV-Ray : Newsgroups : povray.general : How to display image? Server Time
31 Jul 2024 08:19:19 EDT (-0400)
  How to display image? (Message 1 to 7 of 7)  
From: Pahidla
Subject: How to display image?
Date: 17 Sep 2007 19:40:01
Message: <web.46ef104ae7dfafdd3ccd3f470@news.povray.org>
Hi,

What's the easiest way to display a 2D image, like a phtograph hanging on a
wall. I've tried something like

box {
    < 10, 20, 5 >
    < 10, 22, 7 >
    pigment {
      image_map {jpeg "puppy.jpg"}
      scale 2
    }
}

but the box shows gibberish.

Thanks in advance!

Pahidla


Post a reply to this message

From: Leroy
Subject: Re: How to display image?
Date: 17 Sep 2007 23:23:58
Message: <46EF4523.6010706@joplin.com>
Pahidla wrote:
> Hi,
> 
> What's the easiest way to display a 2D image, like a phtograph hanging on a
> wall. I've tried something like
> 
> box {
>     < 10, 20, 5 >
>     < 10, 22, 7 >
>     pigment {
>       image_map {jpeg "puppy.jpg"}
>       scale 2
>     }
> }
> 
> but the box shows gibberish.
> 
> Thanks in advance!
> 
> Pahidla
> 
> 

  By default, the image is mapped onto the x-y-plane. The image is 
projected onto the object as though there were a slide projector 
somewhere in the -z-direction. The image exactly fills the square area 
from (x,y) coordinates (0,0) to (1,1) regardless of the image's original 
size in pixels.

What is mostly done is something like this:
  box {
      < 0, 0, 0 >
      < 1, 1, 1 >
      pigment {
        image_map {jpeg "puppy.jpg"}
      }
     scale 2
     rotate (if needed)
     translate (if needed)
    }

Have Fun!


Post a reply to this message

From: Pahidla
Subject: Re: How to display image?
Date: 18 Sep 2007 03:05:01
Message: <web.46ef777c6a46897c3ccd3f470@news.povray.org>
Thanks!

Is there such a thing as a "rectangle", rather than a "box"?

Thanks again!

Pahidla


Post a reply to this message

From: M a r c
Subject: Re: How to display image?
Date: 18 Sep 2007 03:58:28
Message: <46ef8524$1@news.povray.org>

web.46ef777c6a46897c3ccd3f470@news.povray.org...
> Thanks!
>
> Is there such a thing as a "rectangle", rather than a "box"?
just scale your box (after the pigment has been applied)to fit your image 
ratio

Say for a 800x600 image

//Camera to fit your wish of z up, y forward
camera {
  location  <      0,     -12,       0>
  sky       z
  up        z
  right     x* 1.33
  angle          7
  look_at   <      0,      0,       0>
}

//
// *******  L I G H T S *******
//

light_source {
  <0.0, 0.0, 0.0>
  color rgb <1.000, 1.000, 1.000>
  photons {
  }
  translate  <0, -15, 0>
}



#declare Image =
      texture
      {
         pigment {image_map{jpeg   "Your_image.jpg"}}
         finish {diffuse 0.8}
      }


box {
  0, 1
   texture {Image}
   translate<-.5,-.5,-.5>// to center the box around 0rigin
  scale <1.333, 1.0, 0.01> //to fit image ratio (800/600 almost =  1.333)
  //  you can multiply   by the amount you want, like : scale <1.333, 1.0, 
0.01>*10
  rotate 90.0*x  //to face camera
}


Post a reply to this message

From: M a r c
Subject: Re: How to display image?
Date: 18 Sep 2007 04:07:38
Message: <46ef874a$1@news.povray.org>

46ef8524$1@news.povray.org...
>  scale <1.333, 1.0, 0.01> //to fit image ratio (800/600 almost =  1.333)

Even better

scale<Your_image_width / You_image_height, 1, 0.01>  //replace 
"Your_image_width" by the actual width of you image , same for the height

Marc


Post a reply to this message

From: Tim Attwood
Subject: Re: How to display image?
Date: 18 Sep 2007 16:18:59
Message: <46f032b3$1@news.povray.org>
> Is there such a thing as a "rectangle", rather than a "box"?
There's polygons.

polygon {
   4,
   <0, 0>, <0, 1>, <1, 1>, <1, 0>
   texture {
      pigment { image_map { png "plasma2.png"  } }
      finish { ambient 1 diffuse 0 }
   }
    //scale and rotate as needed here
}


Post a reply to this message

From: Zeger Knaepen
Subject: Re: How to display image?
Date: 18 Sep 2007 18:04:48
Message: <46f04b80$1@news.povray.org>
"Pahidla" <dol### [at] yahoocom> wrote in message 
news:web.46ef777c6a46897c3ccd3f470@news.povray.org...
> Thanks!
>
> Is there such a thing as a "rectangle", rather than a "box"?

there are polygons, and triangles.  If I want to create a rectangle, I use 
this macro:

#macro Quad(P1,P2,P3,P4)
 triangle {P1,P2,P3} triangle {P1,P3,P4}
#end

(you'll have to put this inside a mesh, like this:

mesh {
    Quad(<0,0,0>,<0,1,0>,<1,1,0>,<1,0,0>)
}

You could even add uv-coordinates, like this: (untested code!!!)

#macro Quad(P1,P2,P3,P4)
    triangle {P1,P2,P3 uv_vectors <0,0>,<0,1>,<1,1>}
    triangle {P1,P3,P4 uv_vectors <0,0>,<1,1>,<1,0>}
#end

mesh {
    Quad(<0,0,0>,<0,1,0>,<1,1,0>,<1,0,0>)
    texture {
        uv_mapping pigment {image_map {jpeg "puppy.jpg" interpolate 2}}
        finish {ambient 0 diffuse 1}
    }
}


cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

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