discosultan / penumbra

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

[bug] Occluded shadows aren't working in the DesktopGL port #16

Closed kobdak closed 5 years ago

kobdak commented 5 years ago

For some time now, I've been trying to implement lighting to my game. I found this library, and I think it's a great resource, however, I have an issue regarding the "Occluded" ShadowType.

I want to develop a cross-platform game using OpenGL, but the Occluded shadows act just as "Illuminated" ones in DesktopGL. I tested every single version of the DesktopGL builds (1.3.0 - 1.4.0) - none of them worked for me.

When I added a hull and changed the ShadowType of the light to Occluded in the example/demo project "HelloPenumbra", it worked (since the example project is using DirectX). Then I made a new OpenGL project, copied the code from the original example, and added the DesktopGL reference - it didn't work.

image

discosultan commented 5 years ago

Thanks for raising the issue @kobdak. I will look into it in the coming days.

discosultan commented 5 years ago

I was able to successfully reproduce the problem on DesktopGL.

A potential issue with MonoGame that might be related: https://github.com/MonoGame/MonoGame/issues/5441

Unfortunately, it's quite an old one with not much information.

kobdak commented 5 years ago

A big thanks to you, @discosultan and @Jjagg! The problem was solved by adding just one line of code to the Game1 constructor; graphics = new GraphicsDeviceManager(this){ PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8 };