|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |