POV-Ray : Newsgroups : povray.newusers : image as a background? Server Time
30 Jul 2024 00:21:26 EDT (-0400)
  image as a background? (Message 1 to 4 of 4)  
From: dave
Subject: image as a background?
Date: 18 Nov 2004 10:40:00
Message: <web.419cc19d2b24a31b5a5e05860@news.povray.org>
how can you use an arbitrary image as a background in a pov file? i want to
put a photograph as the background, then generate my image over top of it.
any ideas?

as i am very new, the script would be helpful.

cheers,

dave


Post a reply to this message

From: Slime
Subject: Re: image as a background?
Date: 18 Nov 2004 12:53:06
Message: <419ce182$1@news.povray.org>
> how can you use an arbitrary image as a background in a pov file? i want
to
> put a photograph as the background, then generate my image over top of it.
> any ideas?

You should use the screen.inc include file ("3.7.20.3 screen.inc" in the
documentation). Then you can use the Screen_Plane (Texture, Scaling,
BLCorner, TRCorner) macro to place a plane in front of the camera, but use a
large value for Scaling so that it's farther away than the rest of your
scene.

This can all be done like this:

#include "screen.inc"

Set_Camera_Location(<1,2,3>) // use your camera's location
Set_Camera_Look_At(<4,5,6>) // use your camera's look at point

#declare backgroundImage = texture {
 pigment {
  image_map {
   tga "your_image.tga"
  }
 }
 finish {
  // ignore light sources
  ambient 1
  diffuse 0
 }
}

Screen_Plane (backgroundImage, 10000, <0,0>, <1,1>)

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: image as a background?
Date: 18 Nov 2004 15:03:32
Message: <tunjXEADAQnBFwA7@econym.demon.co.uk>
Wasn't it dave who wrote:
>how can you use an arbitrary image as a background in a pov file? i want to
>put a photograph as the background, then generate my image over top of it.
>any ideas?
>
>as i am very new, the script would be helpful.

An easy way to do it is to use "screen.inc". Look at the demo file
incdemo/screen.pov that came with the POV distribution for lots of
comments on how the system works.

To use screen.inc, you replace your camera statements by a call to
Set_Camera(), and then you can place your background by calling
Screen_Plane().


#include "screen.inc"
Set_Camera(<25,15,-33>, <2,2,0>, 70) // set location, look_at and angle
#declare MyScreenTexture =
texture {
   pigment { image_map { png "test.png" interpolate 2 } }
   finish {ambient 1 diffuse 0} // Don't want any shadows on it
   scale 0.5 translate <0.5,0.5,0> // move it into the <0,0><1,1> region
}
// Make screen plane with the texture MyScreenTexture and scale
// it by 1000 to move it far from the camera.
// Place the bottom corner of the photo
//          at the bottom corner of the screen <0,0>
// Place the top corner of the photo
//          at the top corner of the screen <1,1> 
Screen_Plane ( MyScreenTexture, 100000, <-1,-1>, <1,1> )


If your photo isn't in the correct aspect ratio it will get stretched to
fit.

If you want more complicated camera settings you can call things like
Set_Camera_Sky() and Set_Camera_Aspect_Ratio().

[It's possible to take a bit of a short cut by omitting the scale and
translate and then using
Screen_Plane ( MyScreenTexture, 100000, <0,0>, <1,1> )
but I thought I'd show the calls being used in the way that they're
documented].

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: dave
Subject: Re: image as a background?
Date: 18 Nov 2004 16:50:00
Message: <web.419d18df8a78a9435a5e05860@news.povray.org>
You guys are stars. It worked almost perfectly the first time.


Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it dave who wrote:
> >how can you use an arbitrary image as a background in a pov file? i want to
> >put a photograph as the background, then generate my image over top of it.
> >any ideas?
> >
> >as i am very new, the script would be helpful.
>
> An easy way to do it is to use "screen.inc". Look at the demo file
> incdemo/screen.pov that came with the POV distribution for lots of
> comments on how the system works.
>
> To use screen.inc, you replace your camera statements by a call to
> Set_Camera(), and then you can place your background by calling
> Screen_Plane().
>
>
> #include "screen.inc"
> Set_Camera(<25,15,-33>, <2,2,0>, 70) // set location, look_at and angle
> #declare MyScreenTexture =
> texture {
>    pigment { image_map { png "test.png" interpolate 2 } }
>    finish {ambient 1 diffuse 0} // Don't want any shadows on it
>    scale 0.5 translate <0.5,0.5,0> // move it into the <0,0><1,1> region
> }
> // Make screen plane with the texture MyScreenTexture and scale
> // it by 1000 to move it far from the camera.
> // Place the bottom corner of the photo
> //          at the bottom corner of the screen <0,0>
> // Place the top corner of the photo
> //          at the top corner of the screen <1,1>
> Screen_Plane ( MyScreenTexture, 100000, <-1,-1>, <1,1> )
>
>
> If your photo isn't in the correct aspect ratio it will get stretched to
> fit.
>
> If you want more complicated camera settings you can call things like
> Set_Camera_Sky() and Set_Camera_Aspect_Ratio().
>
> [It's possible to take a bit of a short cut by omitting the scale and
> translate and then using
> Screen_Plane ( MyScreenTexture, 100000, <0,0>, <1,1> )
> but I thought I'd show the calls being used in the way that they're
> documented].
>
> --
> Mike Williams
> Gentleman of Leisure


Post a reply to this message

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