2
\$\begingroup\$

I am trying to make a simple 2D game engine using Monogame and the Krypton 2.0 lighting engine. So far I have succeeded in rendering a light but I am unable to generate any shadows from any hull's. Does anyone know if this can be done using Krypton with Monogame? If this cannot be done does anyone know of any other lighting engines that work with Monogame. I just need to draw one light from the center of the view port.

As a side note I was able to get proof that the hull is in the correct position because I can see a grey outline of the hull at the correct position. My creation code for the light and the hull is the following:

        var texture = LightTextureBuilder.CreatePointLight(this.GraphicsDevice, 512);

        Light2D light = new Light2D()
        {
            Texture = texture,
            Range = 700,
            Color = Color.White,
            Intensity = 0.5f,
            Angle = MathHelper.TwoPi * 1f,
            X = 0,
            Y = 0,
        };

        var hull = ShadowHull.CreateRectangle(new Vector2(1,1));
        hull.Scale = new Vector2(50, 50);
        hull.Position = new Vector2(75,0);

        _krypton.Lights.Add(light);
        _krypton.Hulls.Add(hull);

As for drawing krypton I use the following code:

            _krypton.Matrix = ActiveRoom.Camera.GetTransformation();
            _krypton.SpriteBatchCompatablityEnabled = true;
            _krypton.CullMode = CullMode.None;
            _krypton.Bluriness = 1;
            _krypton.LightMapPrepare();

            _spriteBatch.Begin(/*camera transform and blending. Nothing special*/);
           //draw code is here
            _spriteBatch.End();

            _krypton.Draw(gameTime);

The only changes that I made to krypton itself was to replace the XNA references with Monogame and I had to comment out all of the ColorWriteEnable lines from the KryptonEffect.fx file so that the Monogame content pipeline would compile the shader. Is there something that I have missed or will I have to find a new lighting engine?

Thanks for your help in advance. Any advice is much appreciated.

\$\endgroup\$
  • \$\begingroup\$ Posting a screenshot might help. \$\endgroup\$ – craftworkgames Aug 23 '13 at 11:30
  • \$\begingroup\$ @craftworkgames I would but I do not have the necessary reputation to post screen shots. \$\endgroup\$ – Fudg40 Aug 24 '13 at 11:39
  • \$\begingroup\$ Did you manage to find a solution for this? \$\endgroup\$ – Gareth Sep 7 '13 at 13:29
  • 1
    \$\begingroup\$ This question appears to be off-topic because it is about debugging and porting a 3rd party library. This is likely too broad for a Q&A site. \$\endgroup\$ – Vaughan Hilts Apr 15 '14 at 23:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.