Hello everyone, so this is my first post for this blog. My name is Luis Lairet and I am one of the programmers that is working on developing MEDUSA. One of my most interesting goals for the initial development of MEDUSA during the first sprint was to find a way of incorporating lighting onto the game engine.
The first thing we tried was simply, manually rendering every sprite as a plane and applying shaders effects. It was beginning to get complicated because we would basically have to re-make DX9 SpriteLib to fit our needs. It was then that we realized that it would be better to have someone with more experience in graphics programming to help us evaluate the problem and guide us through the process.
We decided to get in contact with Lari Norri, the teacher that had recently taken over the DirectX course at Full Sail University. Our first meeting with him had us arguing about the problem and what we would have to overcome while developing our idea. It didn't take him long to think of a solution. The solution was to do lighting through post processing. Basically we would render the whole scene to a texture and then apply lighting to that texture through the shader. This opened a lot of possibilities for us and MEDUSA. I already had a system working where you could display lighting on sprites using shaders but it wasn't nearly as optimized as this method could be. So I decided to scrap what was already done and take up the challenge of researching rendering to textures, post processing and then how to incorporate those two concepts onto rendering lights to a scene.
The final product is this(rendering on our Map Editor):

You have up to 7 lights on a scene plus the ambient light at any given time. The engine will calculate which lights are currently used on the scene and send them to the shader for processing. The concept for this is:

- Loop through the lights that are in the scene
- If the light is on screen, then take it's position and radius from screen space to texture space.
- Upload the array onto the GPU's memory
- Render the final color of a pixel by seeing how much each light colors each pixel
It was a fun process researching this topic, I hope you enjoyed it.
Until next time,
Luis Lairet
0 comments:
Post a Comment