This project is read-only.

[Solved]Lights and Shadows not showing

Jun 8, 2011 at 12:13 PM
Edited Jun 8, 2011 at 3:49 PM


Im trying to get Krypton up and running in my 4.0 project, and ive kinda hit a snag... there are no lights or shadows being drawn, and my frame rate goes from a steady 60fps to about 29fps. I have a camera Matrix that i pass to spritebatch, i enabled the spritebatchCombatiblity, ive initialized Krypton, added a light and hull, and set my camera view matrix to Kryptons matrix.

my draw method looks like this:


kryptonEngine.Matrix = cameraManager.View;



batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, cameraManager.View);


            fps.Draw(gameTime, ref batch, -cameraManager.Position);






my cameraManager View Matrix (Update Method):

            positionTranslation.X = position.X - centerOfScreen.X;
            positionTranslation.Y = position.Y - centerOfScreen.Y;
            positionTranslation.Z = 0f;

            scaleTranslation.X = zoom;
            scaleTranslation.Y = zoom;
            scaleTranslation.Z = 0;

            screenTranslation.X = centerOfScreen.X;
            screenTranslation.Y = centerOfScreen.Y;
            screenTranslation.Z = 0f;

            view = Matrix.CreateTranslation(positionTranslation) *
                   Matrix.CreateRotationZ(rotation) *
                   Matrix.CreateScale(scaleTranslation) *

im really lost with this one :'( Ive reorder the draw method 50 times with no success. Also, im running this game on the reach profile, and im using FarseerPhysics (with a seperate View matrix (using the camera View matrix), and a Projection matrix that creates a OrthographicOffcenter matrix whatever for the Debug View O_O;), not sure if that has anything to do with this...

the Light2D AABB and the Hull AABB ARE showing when i debug draw.

Any ideas what is causing this??


 EDIT: Never mind, i fixed it! looks awsome :D. It was the cullmode, the light texture was being drawn behind my scene... i made the light radius like 5000 and saw the light and shadow when i zoomed my camera out.

Jun 9, 2011 at 4:25 PM

I was reading your post, and immediately thought "It's probably the cull mode."

It's pretty easy to forget. :)

Glad you got it working!