This project is read-only.

Adding Lighting to Hulls

Apr 14, 2012 at 2:36 AM

Firstly let me say thanks for sharing your Krypton lighting engine.

I am wondering what is the best way to get lighting information on hulls that is not completely black or white. So that the lightmap from krypton could be used to give 2D sprites spherical lighting direction?


Apr 16, 2012 at 9:02 PM

I'm not entirely sure what you're asking. Can you provide an example, or rephrase the question?

Apr 17, 2012 at 1:06 AM


Instead of a hull being a solid color, is it possible to get gradients on the shadow hulls from light to dark? I would like to use this effect with normal mapped sprites.


Apr 20, 2012 at 12:01 AM

No, currently it is not possible for a hull to cast a gradient shadow.

Apr 29, 2012 at 12:39 AM
Edited Apr 29, 2012 at 12:42 AM

I want to clarify this - having looked at the documentation:

I want to light hulls like this:

With the lighter side facing the light etc. I want the shadow from the hull to occlude other hulls also.

I played around with the fx file to try to get the lighting effect I wanted but I have not yet managed to to complete the effect.

In this video

How did you visualise the projection of the hulls vertices?




May 22, 2012 at 9:32 PM

I believe the solution may be simple. For the sample video you linked, the light used was simply a png file with the gradient graphic you see.

The projections of the hull vertices was done through some testing code for Krypton. I don't have that code anymore, but I'll see if Xixonia does. The method used was simply by reducing the shadow length (from relative infinity), drawing lines between the vertices, and altering the shadow color.