Occlusion Lighting

Oct 6, 2011 at 1:13 AM

I've been playing around with Krypton for a few hours now, and I would love to implement it into my current project, but I really need the occluded shadows.  I know easy access wasn't going to be implemented until 2.1, and I'm assuming the project is either dead or on a hiatus, but how would I go about enabling occluded shadows in 2.0?


Thank you for your time,

Timothy S.

Oct 6, 2011 at 3:13 PM

Ah - built from the latest source and it was set up, my mistake.  This is looking incredible!  I've got a lot on my plate today, but if I get the chance, I'll see about getting a basic implementation into my game, and post some screenshots.  Out of curiosity, what sort of license have you released this under?  Being in college, the chances of my little pet-project ever getting big enough to merit a commercial release is fairly small, but I'd like to know, just in case.


Thank you for your time,

Timothy S.

Oct 6, 2011 at 4:06 PM

Hi Timothy,

We haven't had much time to introduce new features, but we have been keeping up with any bug reports that are opened. Hopefully once school quiets down we can jump in on this again.

In terms of licensing, before we've only requested that you include our logo as some credit in your game. I'll let Xixonia correct me if I'm wrong.

Hope you enjoy the engine!


Oct 6, 2011 at 9:19 PM

Thank you for the update!  I can completely understand the school stuff, and I'm rather excited to hear you're still planning on further development - you've done excellent work with this.

Would a splash-screen when the game is starting suffice?  A-la the Havok or Nvidia sorts of animations leading into most AAA titles?  Also, where would I find your logo?

Thank you once again, I'm looking forward to exploring the engine further!


Timothy S.

Oct 6, 2011 at 9:30 PM

Well, a few people have used our logo that is located at the top of this page for a splash-screen. It's alpha transparent l, but if you need a larger one I can email Xixonia for a higher res file. More branding images would be a good thing, huh? :)

Well I'm glad that you are enjoying it! Let us know if you run into anything along the way, and good luck with your classes.

Oct 7, 2011 at 5:28 PM
Edited Oct 7, 2011 at 7:27 PM

Having a small problem... I'm using a slightly altered version of the camera class outlined here, and I'd like to apply that matrix, so that the lighting will zoom, rotate and pan with the rest of the level, but when I apply the matrix all I get is my ambient light.  The matrix reads at run time as:

{ {M11:0.6666667  M12:0          M13:0  M14:0}
  {M21:0          M22:0.6666667  M23:0  M24:0}
  {M31:0          M32:0          M33:1  M34:0}
  {M41:576.0      M42:296.0      M43:0  M44:1} }

M11 and M22 are zoom factors (below 1 at this point because everything is rendered at 1080p, then zoomed to fit any resolution), M33 and M44 are, I think, scaling factors (not sure...), and M41 and M42 are translation distances.

Any hints here would be much appreciated as well.  I'm assuming it's translating the light clean off the screen, but the projection matrix is working great for the spriteBatches, so I'm assuming there must be some difference between that and the way it works for primitives?

[EDIT]:  For what it's worth, here's how the camera's matrix is generated:

transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
     Matrix.Identity * 
     Matrix.CreateRotationZ(Angle) *
     Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
     Matrix.CreateTranslation(new Vector3(Viewport.X * 0.5f, Viewport.Y * 0.5f, 0));


And here's how it's applied to the SpriteBatch for drawing:

sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, cam.GetTransform(Game1.Resolution));

Game1 stores a Vector2 holding the width and height of the screen in Resolution. 

Oct 7, 2011 at 9:02 PM

Aaaannnndddd... I made a stupid mistake again :P

After reading through the forums some, updating the code to (basically) match the following template worked perfectly.  Going to see about getting the hulls setup for my walls, and perhaps doing two renders with different hull sets so my walls aren't casting shadows on each other, and I'll try and get something in the way of at least a screenshot up on the appropriate topic.

    this.krypton.Matrix = final;
    this.krypton.CullMode = CullMode.None;
    this.krypton.SpriteBatchCompatiblityEnabled = true;


    this.spriteBatch.Begin(..., final);


Oct 11, 2011 at 6:48 PM

Well you sure are making it easy for us by solving your own issues :)

Let us know if you run into any further bumps, or you have any suggestions! I'm looking into some more cross platform stability at the moment, but any bugs you find would be nice to tackle.