POV-Ray : Newsgroups : povray.advanced-users : Transparent plane with non-transparent shadows? : Re: Transparent plane with non-transparent shadows? Server Time
29 Jul 2024 22:23:33 EDT (-0400)
  Re: Transparent plane with non-transparent shadows?  
From: Mike Williams
Date: 8 Dec 2001 13:27:22
Message: <VIsSNCArpjE8Ew70@econym.demon.co.uk>
Wasn't it Anders K. who wrote:
>Is it possible to create a plane that is transparent in the light but
>becomes slightly non-transparent in shadow? I know this isn't physically
>accurate, but I'm basically trying to create a transparent image that casts
>a shadow on its background. I'm using version 3.5 beta.

Here's my attempt at the task. It nearly works. The process requires two
scene files to be rendered, the first one creates the shadows and the
second one puts them into the scene. I include three scenes here. 

The first one is the scene with ordinary shadows.

The second one is an orthographic view of the scene with all the objects
set no_image, and the lights turned up. Convert the output of this scene
into a GIF (or other paletted image format) and take a note of the
correspondence between palette numbers and colours.

The third scene creates the final image.

// one ---------------------------------------------------

/* This is a simple scene with normal shadows */

#version 3.5;

camera { location  <2, 4, -6> look_at <2, 1, 0>}

sky_sphere { pigment {
    function{abs(y)}
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] } 
  }
}

light_source {<-100,200,-100> colour rgb 1}

#declare Stuff = union {
  box {-1,1 translate y*3 pigment {rgb <1,1,0>}}
  sphere {<3,3,0>,1 pigment {rgb <1,0,0>}}
}

object {Stuff}

plane {y, 0 pigment {rgb 1}}

// two ----------------------------------------------------
/* This scene file observes the shadow orthograpically

The significant changes are:-

   The scene is viewed from an orhtographic camera
   placed vertically above the ground plane.
   
   The light is made much brighter,
   so all points on the plande are fully white or black

   The objects cating the shadows are no_image
*/   

#version 3.5;

camera { location y*10 look_at 0 orthographic}

light_source {<-100,200,-100> colour rgb 10}

#declare Stuff = union {
  box {-1,1 translate y*3 pigment {rgb <1,1,0>}}
  sphere {<3,3,0>,1 pigment {rgb <1,0,0>}}
}

object {Stuff   no_image}

plane {y, 0 pigment {rgb 1}}

// three ----------------------------------------------------
/* This is the final scene

The changes from the first scene are

   The objects are now no_shadow
   
   The plane is now painted (once) with the image_map

   The image from the second scene file has been converted
   into a GIF, so that it has a palette, since only
   paletted images work with image_map transmit
   
*/   

#version 3.5;

camera { location  <2, 4, -6> look_at <2, 1, 0>}

sky_sphere { pigment {
    function{abs(y)}
    color_map { [0.0 color blue 0.6] [1.0 color rgb 1] } 
  }
}

light_source {<-100,200,-100> colour rgb 1}

#declare Stuff = union {
  box {-1,1 translate y*3 pigment {rgb <1,1,0>}}
  sphere {<3,3,0>,1 pigment {rgb <1,0,0>}}
}

object {Stuff no_shadow}

plane {y,0
   pigment {image_map {gif "shadow2.gif" once 
   transmit 1,1    // bright bits become 100% transparent
   transmit 0,0.8  // dark bits partially transparent
   }
     rotate x*90 scale <11,10,10>
     translate <-5,0,-5>
     }
   }
/*
-- 
Mike Williams
Gentleman of Leisure*/


Post a reply to this message

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