Shadows

Everything about development and the OpenMW source code.
Post Reply
User avatar
raevol
Posts: 2501
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Shadows

Post by raevol » 23 Sep 2017, 05:12

Keep up the good work @AnyOldName3, glad to hear you are making progress!

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 03 Oct 2017, 03:36

I was hoping to upload one brilliant commit that magically fixed everything in one go, but between me not having as much time to work on this as I'd like (which I don't understand as I've finished my degree and not got a job yet) and it being complicated (which I do understand) this looks to have been a silly idea.

I've therefore actually put some of the progress I've had made into my OpenMW fork instead of a miniature test program. It's not particularly impressive as the bug it fixes seems to be harder to replicate in OpenMW than I expected (either that, or it just looks like one of the other bugs).

The notes I've written for myself (which therefore might make no sense to anyone else) regarding what to do next are as follows:
  • Casts shadow and receives shadow masks are ignored.
    • I need to work out how to exclude nodes without a mask matching the shadow casting mask when rendering shadow maps.
      • Investigate what the cull traversal thingy is doing with its mask
      • I should investigate what happens here for the working shadow techniques
    • I need to disable shadow receiving on things that shouldn't receive shadows.
      • One possible solution would be to get the shadow receiving mask when rendering nodes and pass an appropriate uniform to the shader.
      • I should investigate what happens here for the working shadow techniques.
  • The calculation of frustums and bounding boxes is broken in some way(s).
    • The camera should always be within the shadow frustum to avoid singularities according to the original paper, but things sometimes work even when it isn't.
      • AABBs are used, and I think including the camera in these would waste a bunch of shadow map.
    • Sometimes the maths appears to fail completely at some point, and the light frustum isn't calculated.
      • This may be because of the projection matrix creation failing.
      • This may be because of the light view matrix creation failing.
Hopefully, someone will enjoy reading that, as it was a bit of a nuisance adding all the list tags to make the indentation stay.

JohnMaster
Posts: 30
Joined: 09 Aug 2017, 05:32

Re: Shadows

Post by JohnMaster » 03 Oct 2017, 04:21

AnyOldName3 wrote:
03 Oct 2017, 03:36
Hopefully, someone will enjoy reading that, as it was a bit of a nuisance adding all the list tags to make the indentation stay.
I enjoyed reading it. Impressive formatting. Thank you for continued effort. Good luck on the job hunt!

User avatar
raevol
Posts: 2501
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Shadows

Post by raevol » 03 Oct 2017, 07:25

Thank you for your hard work on this! Fingers crossed that we can still see this finished soon.

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 07 Oct 2017, 02:12

I might have decided that ViewDependentShadowMap works better than LightSpacePerspectiveShadowMap now I'm in a position where I have a better idea about what various things are actually doing. While I've got it sort-of working in mini-experiments, I haven't implemented the shader changes OpenMW would need for it to work, and it crashes my graphics driver when I let OSG set up the shaders for me. It also looks like the aforementioned shader changes may be a little bit very complicated in term of making the uniforms and attributes used compatible with what OpenMW needs to use itself. It's probably going to require me to stab the C++ instead of just the GLSL.

User avatar
raevol
Posts: 2501
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Shadows

Post by raevol » 07 Oct 2017, 07:17

AAAAAH so excited! I know I keep posting useless encouraging posts, but I can't resist!!

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 27 Oct 2017, 00:24

So here's my current status:
  • VDSM definitely works better... theoretically.
  • The shader changes were maybe trivial after all, but I can't tell because something's not working.
  • VDSM doesn't have a complete implementation of a debug HUD, but I attempted to hack one together.
  • As of a few hours ago, I figured out why the debug HUD kept disappearing and figured out how to properly fix it (which was far simpler than any of the bizarre workarounds I've been trying for the last two weeks.
  • The debug HUD suggests that the shadow map is blank in OpenMW. If that is the case, it would certainly explain the other issues I'm seeing.
  • The debug HUD appears to work fine when I put it in OSG itself for a test, suggesting that my findings in OpenMW are accurate.
  • Either I'm doing something weird, or AMD's Vega drivers are weird, as I'm seeing lots of OpenGL errors get spammed to the console on my desktop, but not on my laptop. I have no idea if these are even related to the shadow map not rendering, though, because it doesn't render on the laptop either, but that could just be a case of NVidia's drivers shittily not reporting errors properly.

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 20:50

Hey, guess what:
OpenMW-Shadow-VDSM.png
VDSM Shadow

User avatar
raevol
Posts: 2501
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: Shadows

Post by raevol » 30 Oct 2017, 21:00

AnyOldName3 wrote:
30 Oct 2017, 20:50
Hey, guess what:

OpenMW-Shadow-VDSM.png
:shock: :shock: :shock: :shock: :shock: :shock: :shock: :shock:

Whaat! Nice~! How does it run? How "complete" is it? How ready for merging? Could it make it into 0.43??

User avatar
AnyOldName3
Posts: 566
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 21:05

I just added shadow support to the water shader, too, but I'm not exactly sure if this is what shadows striking water looks like because it feels weird. It's quite possible that the convenient 'shadow' variable in the water shader doesn't actually mean what I think it means, so changing its value from a constant 1.0 to what I read from the shadow map may be incorrect.
OpenMW-Shadow-Water.png
Water

Post Reply

Who is online

Users browsing this forum: Raziel and 1 guest