POV-Ray : Newsgroups : povray.newusers : Using alpha transparency Server Time
27 Dec 2024 02:57:29 EST (-0500)
  Using alpha transparency (Message 1 to 3 of 3)  
From: John Allers
Subject: Using alpha transparency
Date: 23 Apr 2002 12:46:32
Message: <3cc58fe8@news.povray.org>
Is there any way to project a shadow onto an invisible plane?

Here's what I'm trying to do:
I've created an "alien" for our graphics class.  I want to be able to put
the alien into a real image.  Ex. I may want to show the alien walking
behind me in a photograph.  The only problem I'm having is being able to
project shadows.  If I put a white box under the alien for the shadow to
fall on, the white box gets included in the alpha channel.

Has anyone tried this?  Any advice would be greatly appreciated.

Thanks
John


Post a reply to this message

From: Jérôme Grimbert
Subject: Re: Using alpha transparency
Date: 24 Apr 2002 02:40:52
Message: <3CC653D2.59EE6620@atosorigin.com>
John Allers wrote:
> 
> Is there any way to project a shadow onto an invisible plane?
> 
> Here's what I'm trying to do:
> I've created an "alien" for our graphics class.  I want to be able to put
> the alien into a real image.  Ex. I may want to show the alien walking
> behind me in a photograph.  The only problem I'm having is being able to
> project shadows.  If I put a white box under the alien for the shadow to
> fall on, the white box gets included in the alpha channel.

So, you want the shading due to the shadow with alpha < 1,
while alpha should be = 1 where there is no shadow and no alien...

You may want to put a plane (not a box) with a transmit value near 1 (such as
.9) so that the shadow can somehow manifest itself while keeping some alpha.
But it won't help you to extract the silhouette for the composition...
 (but then, this is a problem of 2D images software)

I'm afraid you're taking a wrong route for your problem.
it seems that you want to get the perception of the flux of light in the environnement
of the alien. So instead of trying to show the shadow on a support, why not
try to use a media (scattering type), so that the part of the air in shadow
looks dimmer than the part in full light. 
Or you should model more of the original photograph (at least the wall & floor)
into the alien scene... 
But anyway, no automatic silhouette...
-- 
Non Sine Numine
http://grimbert.cjb.net/
Puis, s'il advient d'un peu triompher, par hasard,






Post a reply to this message

From: Mike Williams
Subject: Re: Using alpha transparency
Date: 24 Apr 2002 16:01:31
Message: <1iom1DAg5wx8Ewlx@econym.demon.co.uk>
Wasn't it John Allers who wrote:
>Is there any way to project a shadow onto an invisible plane?
>
>Here's what I'm trying to do:
>I've created an "alien" for our graphics class.  I want to be able to put
>the alien into a real image.  Ex. I may want to show the alien walking
>behind me in a photograph.  The only problem I'm having is being able to
>project shadows.  If I put a white box under the alien for the shadow to
>fall on, the white box gets included in the alpha channel.
>
>Has anyone tried this?  Any advice would be greatly appreciated.

One trick would be to make two renders.

One render has just the alien against a transparent background.

Render number two has a plain bright white floor onto which the alien
casts a shadow. The background colour should also be pure bright white.
The alien is set "no_image" (needs Pov 3.5 or MegaPOV), or, with more
difficulty, is placed or bounded in such a way that the camera can't see
it and yet it still casts the same shadow. Set the lights so bright that
the resulting image is 100% white except where the shadow falls. I used

        global_settings {assumed_gamma 1.0}
        background {rgb 1}
        light_source {<-10,60,-50> colour rgb 1.5}
        box { <-10,-1,-10>,<10,0,10> pigment {color rgb 1.5}}
        #declare ALIEN = #include "alien.inc"
        object {ALIEN no_image}

so that all that the resulting image shows is the shadow. Hint: try not
to use an infinite plane as the floor, since it's hard to light it so
that the shadow is visible and the horizon is pure white.


How you merge the three images depends on what paint program you are
using. In Paint Shop Pro, I made sure that all three images were the
same size, and adjusted the contrast on the shadow image so that the
shadow was completely black. I then set them up as three layers:
(Use ^C to copy and ^L to paste as new layer). The layer parameters
looked like this:
        Background      Photo   100%    normal
        Layer 1         Shadow   50%    multiply
        Layer 2         Alien   100%    normal
Finally, with "Layer 2" active, I used "Masks -> Load from Alpha
Channel" to make PSP take notice of the alpha transparency.

The "50% multiply" layer affects the background photo like this:
wherever there's a white pixel in layer 1, the pixel from the background
is unchanged (any colour multiplied by 1 is itself) but wherever there's
a dark pixel, the background pixel is darkened by 50%. 

You can lighten or darken the shadow by changing the percentage until it
matches the darkness of the real shadows in the photo.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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