"I'm completely in favor of the separation of Church and State. My idea is that these two institutions screw us up enough on their own, so both of them together is certain death."
- George Carlin
More pages: 1 2 3 4 5
Soft shadows demo
Tuesday, July 13, 2004 | Permalink

Another demo sees the light of the day.

Enjoy!

Name

Comment

Enter the code below



ViLiO
Thursday, August 12, 2004

Ok i see that it definitely does make the lightmaps.

Humus, if I asked very nicely would you explain the lightmap generation algorithm to me?

Thanks,
ViLiO

Humus
Friday, August 13, 2004

It's fairly simple. Just make a BSP tree of the geometry to be able to do fast "collision detection". Then from each point you're evaulating the light, check if the line between the point and the light intersects any geometry. If it doesn't, you're in light, otherwise you're in shadows. Repeat for a few hundred samples within the light volume and you have a soft shadow.

ViLiO
Friday, August 13, 2004

Hmmm,

Yea that is what I currently have in my own engine and the shadows are working fine. I haven't tried implementing soft shadows yet because I am still ironing out some bugs (namely texture bleeding). I plan to completely rework my model format as I currently just work with a triangle pool and create a lightmap for each triangle (this results in 2 identical lightmaps if the triangles make up a rectangle).

I was mainly interested in the way in which you packed the lightmaps. I can't find any wasted space. I have read a couple of articles on similar forms of packing, but never seen any code which does it.

Looks like I will be reading your code for many days to come

Again I must say, great demo.
Also, your finding of such a performance boost in the doom 3 shaders, but only for ati cards is hilariously ironic as you have previously stated that you didn't get a job at nvidia (shadows that don't suck) and went to ati. Oh how nvidia must be regreting not employing you

Thanks,
ViLiO

(apologies for the butt kissing lol)

Humus
Saturday, August 14, 2004

Look in TexturePacker.cpp for the code. It's very simple. Sort of the idea behind a BSP tree. To make it work the best with as little wasted space as possible, don't pass it all sorts of widths and heights, but round to closest multiple of four or to the closest power of two or something like that, and sort your polygons for size first.

Artem
Thursday, August 26, 2004

Humus:
In your demo I see bad precision in shadows.
I have a similar problem, then use shadow buffer, and can't solve this problem.
Problem is disappear then I use ObjectID buffers.

Sorry my bad engligh

Artem
Thursday, August 26, 2004

Humus:
Sorry, wrong topic

More pages: 1 2 3 4 5