monogame framework

sandygast  asked:

A silly question, but what engine do you use? How did you achieve that lighting effect?

I built my own engine upon the Monogame framework (formally XNA, but I’ve since ported over). The lighting is fairly simple:

First I draw all Lights additively on the screen on a black background to a RenderTarget as gradated white circles that are tinted to the color of the light.

Then I convert the RGB to HSV and posterize just the value to have the tiered darkness effect, while still maintaining smooth color blending. Finally I do some Tonemapping (you have to use HDR) which unfortunately washes out the colors, but ensures that colors adding up beyond (255,255,255) are actually displayed correctly (this is a bit too lengthy to fully explain here).

Finally I draw this texture over the game using multiply blend mode.

That’s it! It might be a bit overwhelming at first, but once you learn shader basics, some terminology, and google some stuff it’s really pretty simple. @sstrandberg helped me out a bunch with it.