Members - Reputation: 116
Posted 23 May 2012 - 12:47 PM
That's a second project that I'm posting in this forum.
I was searching for more efficient ways to generate and draw lighting or shadow layers.
However, I never came up with a way that I can apply to both, OpenGL and DirectX.
Note: I've also attached two demos. (High Quality Set)
1. Day lighting demo, just sun shadow generation which has a lot of options. Daylighting Demo.rar 205.01KB 144 downloads
2. Room and day lighting demo. Room Lighting Demo.rar 205.46KB 138 downloads
1. Static Lighting Generation (OpenGL & DirectX 7/9)
At first, I programmed static lighting tool that allows you to generate lighting layer and export it as an image.
I even made some use out of it. I used it to generate shadow mapping for a game called CS2D.
You can check a short preview of it. Just in case, it is available to download.
2. Real-Time Methods and Improvements (OpenGL & DirectX 7/9)
I felt like it's not enough, so I tried going further.
The main problem I had, the slow calculation of light and the process to record it in the image.
So, I came up with several improvements.
I saved every pixel of light source that was recorded in main pixel map.
This way I just had to remove only the pixels that are necessary in the update - light moving or map changing.
Later on, I changed all the pixel map drawing to scaled image on the screen.
All that was left, to overwrite buffer image only when necessary, that is when player or light is moving, or walls appearing/disappearing.
In the end, I managed to create an algorithm that generates light pixels way damn faster, that was the last step till now.
3. Practical Use
Finally, my lighting library was finished. I searched for the ways to use it. The library was written in BlitzMax and C++Languages.
Surprisingly, it was applied on new CS2D version (0.1.2.0)
Don't mind that daylight shadows shows up in room, that was decided by the creator of the game.
The original library disabled day lighting in the rooms ;}
Comparison between new with Lighting and old CS2D.
Video Preview Of The Engine
4. Open Source 2D Lighting Library
I didn't intend to release it to public, however I think I could share it if someone ask it privately :}
I'm also searching for the people whom I could use this engine for!
I could also create a tutorial, that will depend on interest and feedback.
Crossbones+ - Reputation: 13521
Posted 23 May 2012 - 11:56 PM