This project is read-only.

I love it!!

Jul 14, 2010 at 6:40 AM


Thank you xixonia, thank you!!

I have been looking for a lighting engine like this for ages!

Here is a humorous story.  After years of waiting around for something like this, I gave up and decided to do my own.  So, back in early May (AFTER this got posted!!), I wrote the beginnings of a 2d tile engine, and let me tell you, my attempts to light it were just terrible.  Here is the lighting technique I knew how to do:

  • Pass a Color object to the sprite draw constructor, to essentially tint an entire sprite with a color.
  • Hey, were you expecting more?

The result, as you might expect, was laughable.  I had to zoom way, way out on my game world AND make each light have a very wide radius or else adjacent tiles would be drastically different color shades (which looks like crap).  In fact, it still looks like crap, see for yourself:

Free image hosting powered by

Obviously, to try to implement shadows with such a lighting engine would be asinine, so I didn't even try.  Fortunately, I am not as bad with programming in general as I am with graphics drawing and trigonometry, so this code was at least very efficient CPU-wise.


I am hoping that Krypton will be as easy to insert into my engine as it looks.  The API is intuitive, clean, simple, and on top of that it has Intellisense comments!

As for further development, like the other poster said, a flashlight-style light with a definable angle of projection would be awesome.  To expand on that idea, it would be interesting if a flag could be set for individual lights so that when a light with this flag struck a hull and cast a shadow, a smaller light source would appear at the edge of the hull to 'reflect' some light back, kind of creating a light scattering effect.

Also, it may be in the engine already - I haven't dug very deep, but the ability to turn on and off the shadow fix and occlusion for individual lights and/or hulls would be sweet.  As well as the ability to make a light not cast shadows (i.e. an overhead light).


Anyway, great job.  Do you have any other XNA goodies us poor, mathematically retarded game developers might find useful/interesting?



Oct 26, 2010 at 10:49 PM

Hey Brian,

Thanks for all of your awesome feedback!

I've been quite busy with school and work lately. I've actually changed my major from CS to Business (but that is besides the point).

I would like to start working on this project again, and fulfilling the requests of Krypton's fans, but as of right now I've still got a lot on my plate. However, I had no idea of the small following I had created with this project.

I will check my schedule for next semester and try to fit in some coding time for Krypton. Most of your suggestions are new to me, and I haven't thought of individual light settings yet! I'd love to add rotational flashlight-like lights. :)

The reflective lighting, on the other hand, has to do more with intersection detection than it does with lighting effects. Right now I believe it would be best left (faster CPU-wise) to leave the more logic based effects to the game engine itself, However, I'll keep it in mind and add it to the list of things to do!

Again, thank you for the suggestions, and I'll be keeping a closer eye on Krypton from now on :)


 - Chris, Aka Xixonia (or cDub)

Oct 27, 2010 at 1:53 AM

Hi.  Here's a follow-up.

I recently got back into playing with XNA for a new project ( It was actually built out of the above mentioned tile engine project (though little of the original project remains). Basically it is an automatic real-time map generator for Minecraft. Krypton isn't being used yet as we haven't had time to worry about dynamic or even static lighting.

Speaking of static lighting... I know Krypton does dynamic lighting well, but I do not remember if it can do static lights in such a way that hundreds or even thousands of lights could be calculated every half second or so (on a separate thread) without a huge impact on speed. Minecraft's light is more or less static, so if I was to use Krypton for a lighting engine in this project, I wouldn't want to be doing all the light calculations on every draw. In fact I would want as much of the work as possible to be on a separate thread so it ran smoothly. Is such a thing possible with the way Krypton works?

Oct 27, 2010 at 6:26 AM
Edited Oct 27, 2010 at 6:56 AM

With the way krypton works now, no. Static lights are not possible. However I have thought about it, and it's in the plans for sure. Static hulls vs static lights should only be rendered once, but even static lights will need to render shadows for non-static hulls. There's definitely room for improvement here. We could even have a default state for lights as to if they are static or dynamic, and automatically make them static if they don't move/change over a certain period of time. All of this could certainly be added to the project.

As to the separate thread, if you recall, Krypton is mainly drawn using the graphics card. Most of the shadow calculations have been handed off to the GPU to leave the CPU more time to calculate physics, and other game logic. I doubt multi-threading this portion of the rendering will result in any increases in performance, as the application would just be locking itself until the GPU is complete, anyways.

If you have any suggestions for static lighting, feel free to let me know :)

I'm curious, however... How does Minecraft play in to this? I believe that's 3D :)


Ahh! Glorious. It looks like you're making a "radar-like" top-down map view for minecraft? If so, that's awesome.