This project is read-only.

Krypton XNA

Krypton allows users of the XNA framework to easily add 2D lighting to their games. Krypton is fast, as it utilizes the GPU and uses a vertex shader to compute 2D shadows, relieving additional stress from the CPU to compute more game-like tasks.

Krypton v2.0
  • XNA Game Studio 4.0
  • Shader Model 2 compatible graphics device

Krypton v1.0
  • XNA Game Studio 3.1
  • Shader Model 2 compatible graphics device

Please take a moment to view my Stack Overflow Careers 2.0 profile.


Donations are greatly appreciated. If you find Krypton useful, or are otherwise just of the generous nature, and would like to make a donation to this project, we accept donation's via PayPal :)


Many thanks to the following people who donated!


Have an idea that expands upon Krypton's goal? Have a better / faster way of implementing Krypton's techniques? Send us a message, or hit us up on the discussion board. If you've made something you think would be a great addition to Krypton, let us know! Contributions are another great way to help out the Krypton project and team.

Rate Krypton

If donating or contributing isn't really your thing, or you've already donated and contributed but cant help but do more, the next easiest way to help out is to rate Krypton and leave a review. We appreciate moral support almost as much as we appreciate financial and code support. :)

Spread The Love

If you've mentioned Krypton in your blog or website, let us know and we'll provide a link here!

Other 2D Light Engines

Recent News


Until further notice, we have decided to halt our own development of Krypton. If the community would like to submit patches to the engine, we would be more than happy to add them to the official source. We've greatly enjoyed working with everyone and getting the engine to it's current state, and we wish you all the best in your coding journeys. If you would like to change anything on the Codeplex site (example: adding documentation :D or patches) please post a new discussion thread.


Busy: Even on spring break. I haven't had the time to commit to Krypton as of late. I know krypton means a lot to some of you. It means a lot to me too. I'm hoping to continue work on it as soon as possible, adding the most requested features. But, for now, I've got school, work, work, and a fiancee to concern myself with. I have 7 weeks of school left this semester, and I'll be changing to a more flexible job in May working as a web application developer. I haven't been working on Krypton since before Christmas, but I hope to start soon. You may feel neglected and alone, but you are never forgotten. I'll be back soon. :)


Krypton v3.0 is in the works. The idea behind v3 (and the reason it's not called 2.1 or 2.2) is a full refactor. Krypton v3.0 will more easily integrate into your games, but will still keep the same performance that Krypton is known for. Krypton 3.0 will easily support multiple viewports, line-of-sight/fog-of-war, and illumination testing. These features have been requested, and will be implemented for v3. However, we're still taking feature requests for v3, so please feel free to talk about it on the discussion board, and if the need arises, open an issue. :) Krypton 3 will also have comprehensive documentation and tutorials, so getting started with Krypton will be a piece of cake. We'll even show you how to integrate Farseer with Krypton for some "realistic 2d" visuals. :) School is almost out for winter, so I'll be working on getting Krypton 3.0 ready for release in January, with documentation to follow shortly (I promise there will be documentation!).

Hope to see you guys on the discussion board! :)


It's Sunday! I hope everyone enjoyed church. I did :). Krypton v2.0 will be released tomorrow, and it's faster than ever! You won't need to worry about the number of lights in your scene, as Krypton will cull and crop as rendering as possible to reduce the amount of CPU and GPU cycles it takes to draw a light map. With as little as just two render target swaps per frame (four is using blur), Krypton blazes through numerous shadow hulls and lights faster than any other 2D lighting engine (I claim, but I await you to prove me wrong). This video demonstrates some of the techniques used to reduce the load on Krypton, as well as gives an implicit demonstration of how Krypton generates it's shadows.

Krypton uses the following methods to reduce required processing:
  • Krypton only generates shadow hulls once, and those hulls are then stretched (not generated) per light to cast shadows
  • Shadow hulls are culled per light, so that no hull will cast shadows unless it is in range of a light
  • Lights are culled if they are off screen, thus reducing the number of lights and hulls rendered per frame
  • When drawing lights, Krypton sets scissor rectangles to ensure only the effected area of the render target is drawn to, reducing the number of pixel-shader hits per light
  • Krypton uses a single render target to draw shadows, unlike most engines which need to swap between render targets each time a light is drawn.

I haven't the time to record audio for this video, as I'm still writing Krypton's documentation, so see if you can spot the different methods I've listed above in the video below!

Krypton v2.0 Shadow Generation and Culling



Krypton V2 will be released Monday, February 14th and will support XNA 4.0 with the HiDef profile. With a few minor adjustments (16-bit indices), the Reach profile can be achieved, but Krypton will not be able to run on Windows Phone 7, as it does not support custom shaders. Perhaps we'll add a software shadow generator later?

New features will include:
  • XNA 4.0 support
    • Completely rewritten to support XNA 4 (wow, that's a bunch of garbage. we rewrote it because we didn't know anything about XNA 4 rendering ;) )
  • New Light2D interface for custom lights
    • Standard PointLight included
    • DirectionalLight included
  • Procedural Light Texture factory
    • Allows you to create point lights with optional FOV, so you can get Krypton up and running without creating your own light textures

I'll post more features when I know they'll be included. We're still brainstorming some ideas :)


Tonight I am beginning the port of Krypton to XNA 4. Prior versions of XNA will no longer be supported, however the code should be generally the same and easy to port back. This version will be V2.0, as changing the API on which it runs denotes a major change, in my way of thinking. I will keep you posted with the progress of this port, as well as any new features that may be added along the way.


Krypton v2.0 Speed Test

Krypton v1.0 Demo 1

Krypton v1.0 Demo 2

Last edited Jun 11, 2013 at 1:14 AM by djdindak, version 62