Hulls and sprites -- drawing fully lit walls?

Feb 11, 2011 at 11:01 PM

I just integrated Krypton into my current game, replacing my own POS lighting.  Very happy.

A quick question.  I have "walls" in my room, and shadow hulls which sit on top of those walls.  To that end, my walls are always drawn as if they are in shadow.  Imagine I have ambient lighting set to completely black... my beautiful wall sprites would never actually be seen!

Is there a way to exclude the hulls from being "in shadow"?  Or conversely, how do I draw things that aren't affected by the shadows or "on top" of the shadows?  (UI elements, etc)...


Feb 11, 2011 at 11:20 PM
Edited Feb 11, 2011 at 11:21 PM

I had some awesome code pseudo-ed up to show you how to do this, but then I closed it. KryptonTestbed actually draws on top of Krypton's light map. You can take a look at that to see what it's actually doing, but here's a quick explaination:

Right now I assume you're adding krypton to the game's list of components. You have two options:

  1. Don't do that, and take care of initializing and drawing krypton on your own terms
  2. Draw another component AFTER krpyton that will thus draw ON TOP of krypton.

I use the first method for the test bed. You can see that I'm not adding krypton to the list of game components, and that I'm initializing it manually in the Initialize override of the game, and drawing it manually in the Draw override of the game.

In your draw call, you will need to

  1. prerender krypton's lightmap - krypton.LightMapPrepare();
  2. clear the backbuffer
  3. draw your content under the lightmap
  4. draw krypton - krypton.Draw(...);
  5. draw your content on top of krypton

Hope this is helpful, but if it's far to vague I'll post some literal code.

Feb 11, 2011 at 11:23 PM

IN ADDITION, there are some different shader effects in the effect file you can use instead of the standard one (one that illuminates the hulls, rather than shading them). I haven't made these easily accessible yet, but I shall. I'll also post pics and such, but the above should get you off to a good start.

Feb 11, 2011 at 11:28 PM

Funny, I was just coming back to report that I had a solution... don't add Krypton to the Components, and call everything yourself.  I did this and it worked perfectly (adding the draw calls for my walls after the Krypton.draw.  :)

So, yes... I did the exact thing you describe.

I like your "in addition" note.  Krypton appears pretty straightforward, but a manual or release document alongside v2.0 might be worthwhile.


Jun 13, 2011 at 2:48 PM

Hi! I just started putting Krypton into my game and this far it's really impressive!

I just bumped into the same problem as adman, but I need a bit different solution (or at least I think so). I'm building a top-down game, where I'd like the character/walls to lit up near a light source AND make a shadow. Now I've gotten only one or the other. I'm drawing Krypton with my own code (with testbeds example).

I've been reading this forum a bit and I'm glad to see that in the future there might be an option to use Krypton in lighting AND line-of-sight in the same time :) That would be very useful to me also.


Aug 6, 2011 at 7:11 PM


Krypton's light type settings may be of use to you. Let me know how it works out:

Sep 3, 2011 at 2:31 AM

I don't see how we can use the light settings in the current release version of v2.0.

It says they will be available in v2.1.  We can we expect 2.1 to use this? I also am in need of drawing lit hulls (my walls) that are being lit by the light source.

Oct 21, 2011 at 6:18 PM


I'm so sorry it's taken so long to get back to you. Krypton 2.0 does not support this. Correct. However, if you go to the "source code" link, you can see that ShadowType is now supported in the latest release of Krypton. This should probably be the official release, honestly.

Dec 12, 2011 at 4:20 PM

This is the official release for Krypton 2.0 now. Sorry about that.


Were you able to get the desired effect?