POV-Ray : Newsgroups : povray.advanced-users : alpha shadow Server Time
31 Oct 2024 16:15:42 EDT (-0400)
  alpha shadow (Message 1 to 6 of 6)  
From: Elias Pschernig
Subject: alpha shadow
Date: 16 Feb 2005 08:10:01
Message: <web.421342a39456fee4f2a37e710@news.povray.org>
Hm, hard to explain.. basically, I'm trying to create a transparent picture,
which contains a shadow. The scene is just an object, which casts a shadow
to the (invisibe) floor. The object should be fully opaque in the output
(except anti-aliasing at the edge), and the shadow should be translucent
(and have a soft edge). Now - I tried around a bit with no_image and
no_shadow, but no success so far. The closest I could get was to use a
translucent plane, and cast the shadow onto it - but then the result will
nowhere be fully transparent.

Any hints?


Post a reply to this message

From: Slime
Subject: Re: alpha shadow
Date: 16 Feb 2005 09:09:33
Message: <4213541d$1@news.povray.org>
Your best bet may be to make the plane white (with brilliance .00001 so that
the angle of the light source doesn't affect it) and the light source white,
so that you get a greyscale image. Then use a 2D image editor to use this
image as the alpha channel (in Photoshop, as a mask) to a fully black image.

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

From: Mike Williams
Subject: Re: alpha shadow
Date: 16 Feb 2005 10:33:54
Message: <cBw0fBAvd2ECFwQQ@econym.demon.co.uk>
Wasn't it Elias Pschernig who wrote:
>Hm, hard to explain.. basically, I'm trying to create a transparent picture,
>which contains a shadow. The scene is just an object, which casts a shadow
>to the (invisibe) floor. The object should be fully opaque in the output
>(except anti-aliasing at the edge), and the shadow should be translucent
>(and have a soft edge). Now - I tried around a bit with no_image and
>no_shadow, but no success so far. The closest I could get was to use a
>translucent plane, and cast the shadow onto it - but then the result will
>nowhere be fully transparent.
>
>Any hints?

I have a tutorial for something similar but with a hard edged shadow.

<http://www.econym.demon.co.uk/shadowtut/index.htm>

I suggest you experiment with that first, before reading on. The rest of
this post won't make much sense until after you've read that page.


To get soft shadows, you have to use an area light when creating the
shadow, but you will need to reduce the brightness of the light to the
lowest value that gives pure white in all the illuminated areas,
otherwise the soft shadows don't look too good. In my scene a value of
rgb 2 worked, but it can be different depending on things like the
position of the light source.

Then you have to convert the shadow image to 256-colour gif rather than
2-colour. But now there are 256 possibilities for the palette number of
pure white, and you have to use a palette editor to find it. In my case
the palette number was 230, but I guess it could be anything depending
on what software you used to convert it to gif.

Then, in the final render, use 

   pigment {image_map {gif "shadow2.gif" once 
       transmit all 0.3   // dark bits partially transparent 
       transmit 230,1     // bright bits become 100% transparent
     }

[replace "230" by whatever palette number you found]

this sets all the colours other than white to be partially transparent,
and the white bits to be invisible.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Snell
Subject: Re: alpha shadow
Date: 16 Feb 2005 15:28:45
Message: <4213acfd@news.povray.org>
Using Mike's technique you can also experiment with something like:

pigment {
  image_map {
    png "Shadow.png" once interpolate 2
    #local i = 0;
    #while (i <= 255)
      #local T = minT + ((maxT-minT)/255)*i;
      transmit i, T
      #local i = i + 1;
    #end
  }
  translate <-1/2, -1/2, 0>
  scale <4/3*CameraHeight, CameraHeight, 1>
  rotate x*90
}

Where "Shadow.png" is your objectless shadow scene
converted to grayscale and minT/maxT are the range
variables for the amount of transparency (generally
0 to 1). CameraHeight is the distance of the orthographic
camera from the shadow plane when rendering the shadow.

Gilles Trans has another techique using an image_pattern
that can be adapted to making soft alpha shadows.
See http://www.oyonale.com/ressources/english/mkofdark2.htm.


Post a reply to this message

From: Elias Pschernig
Subject: Re: alpha shadow
Date: 16 Feb 2005 17:30:01
Message: <web.4213c86cf7e7b06b5b62e1c0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
[..very useful info..]
>
> Then, in the final render, use
>
>    pigment {image_map {gif "shadow2.gif" once
>        transmit all 0.3   // dark bits partially transparent
>        transmit 230,1     // bright bits become 100% transparent
>      }
>
> [replace "230" by whatever palette number you found]
>
> this sets all the colours other than white to be partially transparent,
> and the white bits to be invisible.
>

Great, this seems to be just what I was looking for!

Oh, and the site says "With the official version of POVRay, you can only
cast shadows onto backgrounds that are visible" - does this imply, there's
an inofficial version which lets me do this in another way?


Post a reply to this message

From: Elias Pschernig
Subject: Re: alpha shadow
Date: 16 Feb 2005 17:30:01
Message: <web.4213c8f3f7e7b06b5b62e1c0@news.povray.org>
"Snell" <skl### [at] optonlineorg> wrote:
> Using Mike's technique you can also experiment with something like:
>
> pigment {
>   image_map {
>     png "Shadow.png" once interpolate 2
>     #local i = 0;
>     #while (i <= 255)
>       #local T = minT + ((maxT-minT)/255)*i;
>       transmit i, T
>       #local i = i + 1;
>     #end
>   }
>   translate <-1/2, -1/2, 0>
>   scale <4/3*CameraHeight, CameraHeight, 1>
>   rotate x*90
> }
>
> Where "Shadow.png" is your objectless shadow scene
> converted to grayscale and minT/maxT are the range
> variables for the amount of transparency (generally
> 0 to 1). CameraHeight is the distance of the orthographic
> camera from the shadow plane when rendering the shadow.

I see, looks like this can reduce the amount of hand-work required, and I
definitely will need to automate the process.

> Gilles Trans has another techique using an image_pattern
> that can be adapted to making soft alpha shadows.
> See http://www.oyonale.com/ressources/english/mkofdark2.htm.

Yes, image_pattern looks useful. Must play around with it.


In any case, thanks everyone who replied. This newsgroup is still as helpful
as the last time I was here some years ago. I think I must start some more
poving again :)


Post a reply to this message

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