Lighting

Still a few hours before I turn in, but I've just got to the point of having diffuse light, ambient and shadows in our game. I've been working pretty hard on this over the last few days, and failed to write a diary entry, so it's nice that it has taken shape.


On Monday I started programming (in C/C++) against trylock/visibility:



By yesterday I had that wrapped up as a library with CFFI bindings, which I've uploaded to PyPI as lightvolume.

I then plugged that into our engine (which is just rendering a TMX map with Pyglet) and added a simple shader to fade it:


Then I changed to rendering the map (and everything else) into a texture, which means I can now do lots of very cheap lighting passes. This is with one light and a little blue-ish ambient lighting. Starting to feel atmospheric!:

 

(log in to comment)

Comments

Awesome! I once knew such knowledge from /r/bitcraft and the link http://www.redblobgames.com/articles/visibility/. But I never implement it becaus I know I can not hold it :) well it is pure python? or have to use C/C++ ? I mean the python calculation should be slower.
I went to the Red Blob Games site, which linked me to a C++ implementation. This is just that implementation, wrapped up in a library that draw the volume using OpenGL, with Python bindings generated by CFFI. It is fast.