POV-Ray : Newsgroups : povray.general : Overlaying object over an image Server Time
21 Dec 2024 23:59:01 EST (-0500)
  Overlaying object over an image (Message 1 to 10 of 11)  
Goto Latest 10 Messages Next 1 Messages >>>
From: 6digit
Subject: Overlaying object over an image
Date: 23 Jul 2022 08:35:00
Message: <web.62dbea13c23a6d94eb0f47cfb08dd02@news.povray.org>
Good evening

I have implemented the codes belonging to the 2 and 3 messages in this
threadhttp://news.povray.org/povray.general/thread/%3Cweb.62d84daeafca4da4d8145616fb08dd02%40news.povray.org%3E/

what the codes basically do is import an image to fit the output screen.

all I want to do is overlay a line over the image that was imported into povray.
when I use povrays primitive objects they seem not to be behind the imported
image. I say this because they are not coming up at all.



so how do I make the object show over the imported image
thank you


Post a reply to this message

From: 6digit
Subject: Re: Overlaying object over an image
Date: 23 Jul 2022 08:45:00
Message: <web.62dbec6e8506b8624eb0f47cfb08dd02@news.povray.org>
"6digit" <eob### [at] gmailcom> wrote:
> Good evening
>
> I have implemented the codes belonging to the 2 and 3 messages in this
>
threadhttp://news.povray.org/povray.general/thread/%3Cweb.62d84daeafca4da4d8145616fb08dd02%40news.povray.org%3E/
>
> what the codes basically do is import an image to fit the output screen.
>
> all I want to do is overlay a line over the image that was imported into povray.
> when I use povrays primitive objects they seem to be behind the imported
> image. I say this because they are not coming up at all.
>
>
>
> so how do I make the object show over the imported image
> thank you


sorry had to rewrite the question


Post a reply to this message

From: jr
Subject: Re: Overlaying object over an image
Date: 23 Jul 2022 09:25:00
Message: <web.62dbf6528506b8621be3cd4b6cde94f1@news.povray.org>
hi,

"6digit" <eob### [at] gmailcom> wrote:
> ...
> all I want to do is overlay a line over the image that was imported into povray.
> when I use povrays primitive objects they seem not to be behind the imported
> image. I say this because they are not coming up at all.
>
> so how do I make the object show over the imported image

conceptually:

    +--------------------+
    | box w image_map    |
    +--------------------+

    +--------------------+
    | "box" for line(s)  |
    +--------------------+

         -+---+-
           \ /  camera
            *

(where I'm "looking" down the Y axis.  the quoted "box" is not a primitive, but
simply to highlight the space.

if you posted a (simplified) version of your code, I/we could, likely, provide
better advice.


regards, jr.


Post a reply to this message

From: jr
Subject: Re: Overlaying object over an image
Date: 23 Jul 2022 15:45:00
Message: <web.62dc4efa8506b8621be3cd4b6cde94f1@news.povray.org>
"jr" <cre### [at] gmailcom> wrote:
> ...
> conceptually:
> ...

a simple example (I did have a little time on my hands :-)):

-----<snip>-----
#version 3.7;

global_settings {assumed_gamma 1}

#declare pigment_ = pigment {
  image_map {
    png "tinai.png"
    once
    map_type 0
    interpolate 2
  }
  scale <2.048,1.519,1>
};

#declare box_ = box {
  0, <2.048,1.519,.1>
  texture {
    pigment {pigment_}
    finish {ambient 0}
  }
};

#declare line_ = cylinder {0,<2.048,0,0>,.05 no_shadow};

light_source {<-1,1,-1>*1e3 color srgb 1 parallel}

camera {
  location <1,.75,-5>
  right x * (4/3)
  up y
  angle 35
  look_at <1,.75,0>
}

object {box_ translate <0,0,1>}

object {line_ pigment {color rgb x} translate <0,.5,0>}
-----<snip>-----

note that the image dimension (2048x1519) and such should all be stored in
variables, "magic numbers" in the code invariably lead to more work)


regards ,jr.


Post a reply to this message


Attachments:
Download '6digit.png' (16 KB)

Preview of image '6digit.png'
6digit.png


 

From: m@b
Subject: Re: Overlaying object over an image
Date: 23 Jul 2022 15:46:02
Message: <62dc4ffa$1@news.povray.org>
On 23/07/2022 1:31 pm, 6digit wrote:
> Good evening
> 
> I have implemented the codes belonging to the 2 and 3 messages in this
>
threadhttp://news.povray.org/povray.general/thread/%3Cweb.62d84daeafca4da4d8145616fb08dd02%40news.povray.org%3E/
> 
> what the codes basically do is import an image to fit the output screen.
> 
> all I want to do is overlay a line over the image that was imported into povray.
> when I use povrays primitive objects they seem not to be behind the imported
> image. I say this because they are not coming up at all.
> 
> 
> 
> so how do I make the object show over the imported image
> thank you
> 
> 

ghere is mt previous anwser rotated into the x, z, plane:

/////////////////////////////////////////////////////////////////////////

#declare image_width = 2592;
#declare image_height = 1944;


// perspective (default, not required) camera
camera {
   orthographic
   location  <image_width/2, 10000, image_height/2,>
   look_at   <image_width/2, 0, image_height/2>
   right     x*image_width/1944   // aspect
   //direction<3129.6857,3102.3533,0>
   focal_point < 563.2927, 0, 1366.9001>
   aperture 3.6171875
   // direction z                        // direction and zoom
   angle 16                           // field (overrides direction zoom)
}


box{<0,0,0>,<1,1,0.001>
     pigment {image_map {"D:/Files/Photos/Historic boats/027.JPG" once 
map_type 0 interpolate 2 } }
     finish {ambient 1 diffuse 0}
     scale <image_width, image_height, 1>
     rotate<90,0,0> // Rotate into the x,z plane
}

box{<0,0,0>,<900,2,-80>        // Size
     pigment{rgb<1,0,1>}           // Colour
     finish {ambient 1 diffuse 0}  // Make it visible
     translate<88,1,88>          // Move it about (the y*1 puts it above 
the image box)
}


////////////////////////////////////////////////////////////////////////


Post a reply to this message

From: m@b
Subject: Re: Overlaying object over an image
Date: 24 Jul 2022 05:55:42
Message: <62dd171e@news.povray.org>
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;


// perspective (default, not required) camera
camera {
   orthographic
   location  <Image_W/2, 10000, Image_H/2,>
   look_at   <Image_W/2, 0, Image_H/2>
   right     x*Image_W/1944   // aspect
   //direction<3129.6857,3102.3533,0>
   focal_point < 563.2927, 0, 1366.9001>
   aperture 3.6171875
   // direction z                        // direction and zoom
   angle 16                           // field (overides direction zoom)
}


box{<0,0,0>,<1,1,0.001>
     pigment {image_map {"D:/Files/Photos/Historic boats/027.JPG" once 
map_type 0 interpolate 2 } }
     finish {ambient 1 diffuse 0}
     scale <Image_W, Image_H, 1>
     rotate<90,0,0> // Rotate into the x,z plane
}

box{<0,0,0>,<900,2,-80>        // Size
     pigment{rgb<1,0,1>}           // Colour
     finish {ambient 1 diffuse 0}  // Make it visible
     translate<88,1,88>          // Move it about (the y*1 puts it above 
the image box)
}



> ////////////////////////////////////////////////////////////////////////


Post a reply to this message

From: Cousin Ricky
Subject: Re: Overlaying object over an image
Date: 25 Jul 2022 14:01:18
Message: <62deda6e$1@news.povray.org>
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;

> [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, and the image dimensions cannot be read from the
file; but the jpeg keyword needs to be included in the image_map statement.


Post a reply to this message

From: m@b
Subject: Re: Overlaying object over an image
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

From: 6digit
Subject: Re: Overlaying object over an image
Date: 30 Jul 2022 18:00:00
Message: <web.62e5a8d88506b86234c05824fb08dd02@news.povray.org>
"m@b" <sai### [at] googlemailcom> 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;
>
>
> // perspective (default, not required) camera
> camera {
>    orthographic
>    location  <Image_W/2, 10000, Image_H/2,>
>    look_at   <Image_W/2, 0, Image_H/2>
>    right     x*Image_W/1944   // aspect
>    //direction<3129.6857,3102.3533,0>
>    focal_point < 563.2927, 0, 1366.9001>
>    aperture 3.6171875
>    // direction z                        // direction and zoom
>    angle 16                           // field (overides direction zoom)
> }
>
>
> box{<0,0,0>,<1,1,0.001>
>      pigment {image_map {"D:/Files/Photos/Historic boats/027.JPG" once
> map_type 0 interpolate 2 } }
>      finish {ambient 1 diffuse 0}
>      scale <Image_W, Image_H, 1>
>      rotate<90,0,0> // Rotate into the x,z plane
> }
>
> box{<0,0,0>,<900,2,-80>        // Size
>      pigment{rgb<1,0,1>}           // Colour
>      finish {ambient 1 diffuse 0}  // Make it visible
>      translate<88,1,88>          // Move it about (the y*1 puts it above
> the image box)
> }
>
>
>
> > ////////////////////////////////////////////////////////////////////////

Good evening im hoping any one can see this message i notice something when
scrolling through this code.
location  <Image_W/2, 10000, Image_H/2,>
>    look_at   <Image_W/2, 0, Image_H/2>

i notice the predefined width and height were divided by 2. why ? and what does
it do exactly. thank you


Post a reply to this message

From: Cousin Ricky
Subject: Re: Overlaying object over an image
Date: 31 Jul 2022 11:50:57
Message: <62e6a4e1$1@news.povray.org>
On 2022-07-30 17:55 (-4), 6digit wrote:
> 
> Good evening im hoping any one can see this message i notice something when
> scrolling through this code.
> location  <Image_W/2, 10000, Image_H/2,>
>>    look_at   <Image_W/2, 0, Image_H/2>
> 
> i notice the predefined width and height were divided by 2. why ? and what does
> it do exactly. thank you

Because we want the camera over the middle of the image.  If we don't
divide by 2, we end up over the upper right corner.


Post a reply to this message

Goto Latest 10 Messages Next 1 Messages >>>

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