POV-Ray : Newsgroups : povray.newusers : Semi-transparent photograph overlaid an image Server Time
24 Nov 2024 02:46:14 EST (-0500)
  Semi-transparent photograph overlaid an image (Message 1 to 5 of 5)  
From: gregjohn
Subject: Semi-transparent photograph overlaid an image
Date: 16 Sep 2010 20:35:01
Message: <web.4c92b6faac5cfc7634d207310@news.povray.org>
I was trying to overlay a semi-transparent PNG over my image. I came up with a
very inelegant solution for the textured box.  (I have the box and image
positioning down pat.)

Can anyone offer up a simple solution for texturing a semi-transparent box
overlaid on a scene, one that is relatively independent of the SDL lighting that
hits it?

thanks.


Post a reply to this message

From: M a r c
Subject: Re: Semi-transparent photograph overlaid an image
Date: 17 Sep 2010 02:37:27
Message: <4c930ca7@news.povray.org>
I'm not sure I understand well what you mean but to get your box independent 
from scen lighting, finish{ambient 1 diffuse 0} is a good start :)
BTW did you try screen.inc ?
Marc


web.4c92b6faac5cfc7634d207310@news.povray.org...
>I was trying to overlay a semi-transparent PNG over my image. I came up 
>with a
> very inelegant solution for the textured box.  (I have the box and image
> positioning down pat.)
>
> Can anyone offer up a simple solution for texturing a semi-transparent box
> overlaid on a scene, one that is relatively independent of the SDL 
> lighting that
> hits it?
>
> thanks.
>
>


Post a reply to this message

From: gregjohn
Subject: Re: Semi-transparent photograph overlaid an image
Date: 17 Sep 2010 11:35:01
Message: <web.4c938a61a32ab61da00085090@news.povray.org>
Thanks, but I know how to get a PNG image in front of the camera, and I see this
as the main benefit of screen.inc.

What I want is to place semi-transparent image in front of the camera, such that
what I see is generally X% my PNG, 100-X% the regular camera.  I came up with a
very inelegant way to do this, but it was so clunky and sensitive to the room
lighting.

I am wondering what would be the way to **texture** a box so it is a
semi-transparent overlay on top of my scene.



"M_a_r_c" <jac### [at] wanadoofr> wrote:
> I'm not sure I understand well what you mean but to get your box independent
> from scen lighting, finish{ambient 1 diffuse 0} is a good start :)
> BTW did you try screen.inc ?
> Marc
> >


Post a reply to this message

From: clipka
Subject: Re: Semi-transparent photograph overlaid an image
Date: 17 Sep 2010 15:41:15
Message: <4c93c45b$1@news.povray.org>
Am 17.09.2010 17:33, schrieb gregjohn:
> Thanks, but I know how to get a PNG image in front of the camera, and I see this
> as the main benefit of screen.inc.
>
> What I want is to place semi-transparent image in front of the camera, such that
> what I see is generally X% my PNG, 100-X% the regular camera.  I came up with a
> very inelegant way to do this, but it was so clunky and sensitive to the room
> lighting.
>
> I am wondering what would be the way to **texture** a box so it is a
> semi-transparent overlay on top of my scene.


     #declare P=0.6;
     plane { z, 0
       clipped_by { box { <0,0,-0.1>, <1,1,0.1> } }

       texture {
         pigment { image_map { png "foo.png" once filter all 1-P } }
         #if (version < 3.7)
           finish { ambient 1 diffuse 0 specular 0 phong 0 }
         #else
           finish { ambient 0 emission 1 diffuse 0 specular 0 phong 0 }
         #end
       }
       no_reflection
       no_shadow
       no_radiosity
       no_photons

       transform { ... }
     }

This gives a neat semi-transparent square image stretching from <0,0,0> 
to <1,1,0>, which isn't affected by scene lighting in any way, nor does 
it affect the scene in any way - ready to be translated, scaled, 
rotated, sheared or otherwise transformed to be positioned right in 
front of the camera. P=0.0 gives you only the scene, P=1.0 gives you 
only the image, P=0.5 gives you an 50%:50% blend.

Depending on what effect you're /really/ aiming for, you may want to use 
yet some different voodoo though. For instance, you might actually want 
to "add" the image rather than blend it with the scene. For that purpose 
you could use something like:

   #declare P=0.6;
   #declare E=0.001;
   texture {
     pigment { image_map { png "foo.png" once filter all 1-E } }
     #if (version < 3.7)
       finish { ambient P/E diffuse 0 specular 0 phong 0 }
     #else
       finish { ambient 0 emission P/E diffuse 0 specular 0 phong 0 }
     #end
   }

Here, P=0.0 gives you the scene + 0% of the image, while P=1.0 gives you 
the scene + 100% of the image. E is just a very small value (what 
mathematicians would call "epsilon") that governs how well the whole 
construction really matches an "add" operation - the smaller the better 
(note that E=0.0 unfortunately doesn't work).


Post a reply to this message

From: gregjohn
Subject: Re: Semi-transparent photograph overlaid an image
Date: 17 Sep 2010 16:25:01
Message: <web.4c93ce7ca32ab61da00085090@news.povray.org>
Thanks greatly. Will try out.


Post a reply to this message

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