POV-Ray : Newsgroups : povray.advanced-users : Fake shadows in 32-bit images? : Re: Fake shadows in 32-bit images? Server Time
24 Apr 2024 15:23:21 EDT (-0400)
  Re: Fake shadows in 32-bit images?  
From: Bald Eagle
Date: 4 May 2021 14:25:00
Message: <web.609191017599ad521f9dae3025979125@news.povray.org>
There might be a way to do this with functions, aoi, slope, or some other
method...

But a quick and dirty cheat like this works:

Take your object(s) and put all of the parts in a merge.

Define a vector location LS for your light source.
Define a second vector location LS2 that is -vnormalize(LS) so that it is
mirrored across the origin.
Define a matrix transform with LS2 as your new y basis vector.


Put your object in the scene with the no_shadow keyword.

Put your object in the scene again, apply the matrix transform, and scale it
really small in the y direction, and apply your semi-transparent texture to it.


#version 3.8;
global_settings {assumed_gamma 1}

camera {
 location <0, 5, -9>
 look_at 0
 right x*image_width/image_height
}

sky_sphere {pigment {rgb 1}}

#declare LS = <5, 15, -10>;

light_source {LS color rgb 1}
#declare E = 0.000001;

#declare LS2 = -vnormalize (LS);

#declare ShadowTrans = transform {
 matrix < 1, 0, 0,
   LS2.x, LS2.y, LS2.z
   0, 0, 1,
   0, 0, 0
 >
}

#declare Object =
merge {
 cylinder {0, y, 0.05}
 sphere {y, 0.25}
}

object {Object pigment {rgb z} no_shadow}

object {Object
 transform {ShadowTrans}
 scale <1, 0.001, 1>
 pigment {rgbt <0, 0, 0, 0.5>}
}


Post a reply to this message

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