-
-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shadow glitches #5
Comments
This is a known issue and is regardless of the OpenGL version. There's a bug in the shadow calculation. Some brainstorming:
I've spent lots of time in shadow debugging in the past. Any help would be great. Nut sure, but as I remind this occurs only in DirectionLightning (shadow Map). Try PointLight (shadow Cube) here: |
Just a notice: in Marbles ( https://github.com/AximoGames/AxMarbles ) and in this Sample ( https://www.aximo.games/samples/shadows/ ) only PointLight is used and there are no shadow glitches. So, it seems it happens only with DirectionalLight. Any help in fixing the shadow bug would be great. |
I'm afraid I will not be able to help. I've just started to learn OpenGL and OpenTK as a hobby and came across your engine as a real-word usage example :) |
There are no isolated shader tests, but some render tests: https://github.com/AximoGames/AxEngine/tree/master/Tests/RenderTests They work in the following way:
Generally, even the render tests are a life and time saver :-) |
Greate work! Just some ideas:
I know for shadows, cull mode = front shuld be used. But with that cull mode, the shadows seems to be less accurate. You can test it here: https://github.com/AximoGames/AxEngine/blob/master/Render/Objects/SimpleVertexObject.cs#L266 |
It was the near plane intersecting with the sphere, that caused the issue. I changed in the LightObject.cs the nearplane to 0.1f But the shadow of rotating directional still disappears and reappears. |
amazing! thx very much for tracking down the problem. Regarding the missing shadows that are far away: I have no idea how to solve this in a perfect manner. One idea is to move the directional shadow light with the player. But even in this case, the map needs to be bigger: More memory, more computing time or shadow have more artifacts. So, what do you think is a good/acceptable way to render shadows that are far away? |
Sadly no :/ |
Did you found out why the shadows are not correctly rendered if cull mode is changed? |
I did not check that, but I can look later |
Hm it's really weird. This is the shadows when I enable Cullmode Front: GraphicsDevice.Default.CullFaceMode = CullFaceMode.Front;
//GL.CullFace(CullFaceMode.Front);
//GL.Disable(EnableCap.CullFace);
mat.Vao.Draw();
//GL.Enable(EnableCap.CullFace);
//GL.CullFace(CullFaceMode.Back);}
GraphicsDevice.Default.CullFaceMode = CullFaceMode.Back; The weird part, is that the shadowmaps seem to be fine I have currently no clue, where the problem can be. |
@LevYas wrote in #3:
There are some glitches with shadows though

But this could be because of OpenGL ver 3.3. Even the freshest Nvidia drivers did not bring me 4.
Originally posted by @LevYas in #3 (comment)
The text was updated successfully, but these errors were encountered: