discosultan / penumbra

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

Support MonoGame 3.8 #30

Closed MichalKubik closed 3 years ago

MichalKubik commented 3 years ago

As the title says, currently using penumbra with monogame 3.8 throws exception: System.Exception: 'This MGFX effect is for an older release of MonoGame and needs to be rebuilt.'

spiercey commented 3 years ago

Hey @MichalKubik , if you are using .NET Core and OpenGL you can grab working versions for Monogame 3.8.0.1641 here: https://github.com/spiercey/penumbra.core/tree/master/Source/obj

You should be able to just drop one of those dlls into your project and add it as a reference, then everything will work.

You could also compile the Source Project yourself. It's set up for Monogame 3.8.0.1641 right now.

This is only for OpenGL, I can't support DirectX at the moment so I've removed all references from my fork. If you need DirectX you could consider updating the project yourself as I did.

MichalKubik commented 3 years ago

Hi @spiercey , it works good, thank you very much :)

discosultan commented 3 years ago

@spiercey Thanks for sharing the fork! I haven't had time to upgrade to MonoGame 3.8 yet but am planning to sometime this month. Your work definitely helps me speed things up.

spiercey commented 3 years ago

Just a note, looks like there have been some changes to the GraphicsDevice setup in 3.8 which results in the RenderTarget2Ds in Penumbra Component getting the default 480x360 resolution if you set up Penumba in the Game constructor as in the docs. (Even if you set your backbuffer and viewports on Graphics and GraphicsDevice correctly).

I've had to switch all of my resolution setup and penumbra creation to the Game.Initialize() method (after base.Initialize();).

It also seem like you now need to call graphics.ApplyChanges(); manually after setting up the GraphicsDeviceManager.

Everything seems to work fine after moving the GraphicsDeviceManager and Penumbra setup out of the constructor though.

discosultan commented 3 years ago

I've upgraded the projects to netstandard and netcore3.1 where suitable. New 2.0.0 nugets are also available.

@spiercey I didn't run into the resolution issue you mentioned. Perhaps the issue you're referring to is related to any of the following:

Would be nice to get a sample project that reproduces the issue.

Please raise a new issue if you notice any regressions ☺