POV-Ray : Newsgroups : povray.general : Overlaying object over an image : Re: Overlaying object over an image Server Time
8 Aug 2022 21:53:02 EDT (-0400)
  Re: Overlaying object over an image  
From: m@b
Date: 27 Jul 2022 16:24:33
Message: <62e19f01$1@news.povray.org>
On 25/07/2022 7:01 pm, Cousin Ricky wrote:
> On 2022-07-24 05:55 (-4), m@b wrote:
>> It has been pointed out that "image_width" and "image_height" are
>> built-in POV-Ray variables.
>>
>> Here is a corrected version of my answer:
>>
>>>
>>> here is mt previous answer rotated into the x, z, plane:
>>>
>>> /////////////////////////////////////////////////////////////////////////
>>
>>
>> #declare Image_W = 2592;
>> #declare Image_H = 1944;
> 
> Also, in POV-Ray 3.7 and later, you can read the dimensions directly
> from the pigment:
> 
>    #declare P = pigment
>    { image_map
>      { jpeg "D:/Files/Photos/Historic boats/027.JPG"
>        once map_type 0 interpolate 2
>      }
>    }
>    #declare Image_W = max_extent (P).x;
>    #declare Image_H = max_extent (P).y;
> 

That's useful, thanks.

>> [snip]
>>
>>      pigment {image_map {"D:/Files/Photos/Historic boats/027.JPG" once
>> map_type 0 interpolate 2 } }
>>      finish {ambient 1 diffuse 0}
> 
> Did you omit the #version at the top of the scene deliberately?  POV-Ray
> 3.7 and POV-Ray 3.6 render it differently; if you include #version 3.7,
> the image turns out too pale.  Also, you omitted the jpeg keyword in the
> image_map; POV-Ray 3.7 renders it to completion, but 3.6 halts, looking
> for PNG image.
> 
> If the scene is intended for POV-Ray 3.7 or later, then the finish
> statement should be:
>    finish {ambient 0 diffuse 0 emission 1}
> This will be important if 6digit decides to use radiosity.
> 
> If the scene is intended for POV-Ray 3.6, the finish statement must
> remain as you wrote it, 

6digit wrote it :-)

and the image dimensions cannot be read from the
> file; but the jpeg keyword needs to be included in the image_map statement.

Good point re the jpeg keyword.

I answered as I did because I was trying to keep my answer as close to 
the original question as possible. As I didn't know what version 6digit 
might be using I thought is best not to include a version number 
assuming he would post my code into his programme.


Post a reply to this message

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