POV-Ray : Newsgroups : povray.general : Shadow on alpha channel? : Shadow on alpha channel? Server Time
1 Aug 2024 12:25:33 EDT (-0400)
  Shadow on alpha channel?  
From: zachrahan
Date: 19 Oct 2005 18:05:01
Message: <web.4356b88f87d51cba35162b020@news.povray.org>
Hi folks,

I'm trying to figure out a good (and easily-automated) way of rendering
images with povray that have an alpha channel and also object shadows on
the (otherwise transparent) background.

This is the same question as forwarded in these threads:
http://news.povray.org/povray.advanced-users/thread/%3Cweb.421342a39456fee4f2a37e710%40news.povray.org%3E/?mtop=3
and
http://news.povray.org/povray.advanced-users/thread/%3C4184d1c3$1@news.povray.org%3E/?ttop=216442&toff=50

The solutions mooted therein seem a bit clumsy for something that I will
eventually need to automate. Based on them, however, I have an idea which
may be workable.

Now, clearly, the best thing would be some special modifier in ITK to make
an object invisible but still "catch shadows" with whatever properties it
would have otherwise. Something like the "no_image" option. Since that's
not something I can do, here's my plan:
(1) Render the scene with an alpha channel.
(2) Re-render the scene with all objects marked "no_image", with no alpha
channel, and with a perfectly white "floor" plane to catch the shadows.

The second rendering is now basically an "alpha channel" for just the
shadows.
I would then recombine them as follows:
(A) Add the shadows to the original image by multiplying the image channel
from (1)
with the shadow image (2), using something like ImageMagick. This will just
add the shadows back without otherwise affecting the image.
(B) Add the shadows to the alpha channel by multiplying the alpha channel
from (1) with the shadow image (2). This again preserves the original alpha
in the white regions of the shadow image, but overlays the shadow alpha
value on the original image alpha in regions where there are shadows.

This process is very easily automated, and I think it is the best way to
deal with this problem (other than adding a new keyword to povray). First,
do others agree?

Second -- and most importantly -- what is the best way to make an image that
is perfectly white except where shadows are cast? A white plane with 100%
ambient? Something doubly-illuminted from behind? There still needs to be
the original light source so that shadows get cast properly, but I need
somehow for the shadows to be the *only* lighting variation in the image.
Is this possible?

Zach Pincus


Post a reply to this message

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