POV-Ray : Newsgroups : povray.newusers : image as a background? : Re: image as a background? Server Time
30 Jul 2024 02:22:55 EDT (-0400)
  Re: image as a background?  
From: Mike Williams
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

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