Another per pixel lighting system :)
BlitzMax Forums/BlitzMax Programming/Another per pixel lighting system :)
| ||
Hi, As mentioned in the other thread: http://www.blitzbasic.com/Community/posts.php?topic=49403 You can use the accumulation buffer for lighting as well. It should be a lot faster on newish graphics cards, but maybe not on older ones? Anyway, it's OpenGL only. If someone can do it in DX then show us! Here's some simple code: [edit]Screenie of how it should look with an image, instead of the boxes... ![]() |
| ||
Works great ... *somehow beeing a little shocked that it can be done "that simple" ...* |
| ||
How is it supposed to look? I imadgine it doesnt look like it should on my computer here at work. awfully slow and colors that doesnt seem to be correct. ascreenshot of a working one pls :) |
| ||
Looks a bit of a mess here as well (on my old machine at least - GF4 MX 440). |
| ||
ditto slow mess, ermmmmmm o_O |
| ||
It's probably dog slow on GeForce 4 and older. It will need a hardware accumulation buffer to work properly, otherwise it will chug along and probably not work correctly. |
| ||
Nice effect from the king of lightmapping! :) Runs very fast here, I'm on what's probably an average card these days FX5600. |
| ||
Great job fredborg! Very fast! WinXP SP1, AMD-XP 2400+, 512 MB, GF-FX5200 |
| ||
Hi Fredborg, very nice but how can you stop the lights 'blobbing' together? If I have two lights and shine them on the same wall the result is a light equal to the brightest of the two not the sum of them (if you know what I mean). I'm guessing this is what the accum buffer does. |
| ||
Um, I would think decreasing the brightness of the individual lights, while pumping up the overall light intensity would do the trick. It happens because the values the accum buffer can store are limited (from -1 to 1)... |
| ||
I think you'll find two lights together equals their sum, tonyg. |
| ||
Surely not! Shine a very bright light on a wall and then a dim torch. The result is the same very bright light and not a bright light with a brighter section where the torch is shining. e.g. A 'force 5' torch shining with a 'force 6' torch makes a force 6 light not a force 11 light.... surely? |
| ||
perhaps using alphablend with Alpha instead of LightBlend works? *haven't tried as I am trying to kick my windows system ;-)* |
| ||
If you scale your light colors so that the sum of them will not exceed 255,255,255 and then increase the Intensity, you shouldn't have any problems. Example: As you can see this results in some artifacts, but if you tweak it, it'll look fine. |
| ||
wow, great work fredborg ! |
| ||
Wow! Its cool! ...how use it in DX 7? ;) Please... |
| ||
Accumulation Buffer Techniques with DirectX® 7 http://www.ati.com/developer/sdk/RadeonSDK/Html/Samples/Samples.html |