discosultan / penumbra

2D lighting with soft shadows for MonoGame
MIT License
315 stars 32 forks source link

Can't figure out transform matrix Please help. #8

Closed Ivaylo-Korakov closed 7 years ago

Ivaylo-Korakov commented 7 years ago

Hi i am working on a side project of mine. A 2d game way in the beginning of development. The main problem I have is with the transform matrixes. To be honest I don't know how they work at all but somehow i managed to get them working with a camera and UI where i can render stuff and not be effected by the movement of the camera in the world. Here is what I have:

            // Draw world
            SpriteBatch.Begin(transformMatrix: DisplayManager.GetMatrixScaleWorld());
            StateManager.DrawWorld(spriteBatch: SpriteBatch);
            SpriteBatch.End();

And:

            // Draw GUI<br>
            SpriteBatch.Begin(transformMatrix: DisplayManager.GetMatrixScaleGui());
            StateManager.DrawGui(spriteBatch: SpriteBatch);
            SpriteBatch.End();`

With this type of setup I have it perfect and it scales with different resolutions etc. Here is how it looks: Image But when I add " penumbra.BeginDraw();": Image Here is how the code:

            penumbra.Transform = DisplayManager.GetMatrixScaleWorld();
            penumbra.BeginDraw();

I don't know how to do it. Also how to separate the UI from the world so that the lighting only effects the world but not the uni itself. Sorry if this is not the right place to post this but please help.

discosultan commented 7 years ago

Hey! Could you share your project or provide the code for your main drawing methods? You can contact me through email which is available on my profile.

discosultan commented 7 years ago

I've pushed a 1.1.3 update to Nuget. Can you confirm it fixed your scaling issues?

https://github.com/discosultan/penumbra/commit/84ec93cc6dc74e52dabcc1e640baf299eee4b0a0

Ivaylo-Korakov commented 7 years ago

Hi, I typed Update-package MonoGame.Penumbra.WindowsDX then pressed cntrl-F5 and at that moment my life changed. It works. Tried with different resolutions and everything is perfect now. Thanks Thanks Thanks !!! The best dev ever :D I don't have anything more to say. Brilliant. I hope some day I will be able to be a wizard like you. Best of luck from me! And again thanks!!

On Sun, Oct 9, 2016 at 11:01 PM, Jaanus Varus notifications@github.com wrote:

I've pushed a 1.1.3 update to Nuget. Can you confirm it fixed your scaling issues?

84ec93c https://github.com/discosultan/penumbra/commit/84ec93cc6dc74e52dabcc1e640baf299eee4b0a0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/discosultan/penumbra/issues/8#issuecomment-252512397, or mute the thread https://github.com/notifications/unsubscribe-auth/ANmoCQkEmfSyJ-Ophh_uAuDD876UKMduks5qyVYXgaJpZM4KSDDa .