PDA

View Full Version : Soft Shadows using alpha buffer



tfpsly
10-14-2002, 03:50 AM
Hi,
I tried to implement soft shadows on GF2mx, and here is the result: http://tfpsly.planet-d.net/img/3d/Screenshots/Bump/Q3BumpSoftShadows0.jpg
more screens on http://tfpsly.planet-d.net/img/3d/Screenshots/Bump/

While computing the shadow volume in the stencil buffer, I also compute a blending value that I am storing in the alpha buffer. Then while displaying the big fat dark quad on the death, I activate glblending, and here it is.

PRO: fast
CON: crappy when many shadows displayed at the same place, some strips may appear, depending on the triangulation complexity...

gaby
10-14-2002, 06:03 AM
This is not soft shadows : "soft shadow" is a shadow effect that take care of the light size (in most case, like in OGL, light are infitly small, as a point), wich mean that you have a penumbra area between the fully lit parts of object and the part wich in the shadow, and this penumbra area is variable with the distance between the surface and the ocluder edge.

Regards

Gaby

tfpsly
10-14-2002, 08:14 AM
I know that.
The way I want to simulate it is : http://tfpsly.planet-d.net/Files/SoftShad.gif

So on the triangles on the border, the edges of the volume would get blurred after some distance, simulating the fact that the farther we are from the occluder, the less sharp the borders are: I want the alpha interpolation to take care of this.

In the middle of the volume, and near the occluder, A=0 so the shadow is very dark, with sharp edge.
On the further borders, edges are used by triangles that have Alpha>0 on the volume edge, Alpha=0 in the volume.

As I said, this can work only with the proper triangulation... which is obviously not the case here: if there are not enough triangles, we might not have vertex with alpha=0, so the result will only look like a distance attenuation.

EDIT: removed crappy ascii art, and put a gif instead

[This message has been edited by tfpsly (edited 10-14-2002).]