摘要 |
The invention concerns a method for generating shadows in an image (10) comprising the steps of:
- Computing (E2) a depth-map (6) that comprises an array of pixels, wherein pixels in the depth-map (6) have a depth value (d sm ) that indicates a depth from the light source (2) to a portion of the nearest occluding object (4) visible through the pixel,
- projecting (E6) each point (P ix ) visible from a virtual camera (1) into the light space,
- calculating (E7) the distance (d p ) between the said visible projected point (P) and the light source (2),
- fetching (E8) the depth value (d sm ) in the depth-map (6) corresponding to the light ray from the light source to said visible projected point (P), The method further comprises the steps of
- computing (E9), for each pixel, an adaptive bias (b) as a function of a predetermined base bias (b base ) and the orientation of the surface (3) on which the said visible point is located,
- comparing (E10) for each pixel (P ix ) in the image, the distance (d p ) between said visible projected point (P) and the light source (2) with the sum of the corresponding depth map value ((d sm ) and said adaptive bias (b base ),
- labelling (E11, E12) said pixel (P ix ) as lit or shadowed according to said comparison. |