Shadows

Everything about development and the OpenMW source code.
User avatar
AnyOldName3
Posts: 1479
Joined: 26 Nov 2015, 03:25

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 21:07

You can try this for yourself now as it's just been pushed to my experimental branch.
AnyOldName3, Master of Shadows

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

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 21:15

The next things to do:
  • Add support for cascaded or parallel split shadow maps (I still haven't exactly worked out the difference) using the existing implementation in osgShadow::ViewDependentShadowMap by attacking the shaders further.
  • Tidy things up.
  • Maybe add support for more cascades/splits if it turns out that things aren't good enough with the hard cap of two that osgShadow::VDSM currently has.
  • Stop the sky from receiving shadows.
  • Find an efficient way to have VDSM support objects that don't receive shadows so we don't have to rearrange the scene graph and don't have to put up with my current workaround of rendering non-receivers twice, once with shadows, and then a second time without, which draws over the first.
  • Potentially change how non-translucent shadow casters are rendered so unnecessary alpha testing is skipped.
  • Probably a bunch of other stuff I haven't thought of.
AnyOldName3, Master of Shadows

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

Re: Shadows

Post by raevol » 30 Oct 2017, 22:25

AnyOldName3 wrote:
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


I'm not sure, but doesn't look right to me based on:

Image

Image

User avatar
lysol
Posts: 1296
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: Shadows

Post by lysol » 30 Oct 2017, 22:40

!!!!!! This looks huge. I need to build this tomorrow, seriously.
raevol wrote:
30 Oct 2017, 21:00
Could it make it into 0.43??
The thing, I guess, is that this would more or less transform OpenMW 0.43 into OpenMW 1.0, which would be kinda dumb to do in the middle of a release phase. That said, I would like to see this in a release NOW as much as anybody.

We still have nightlies and the possibility to build from master though

EDIT: Oh, and regarding the shadow on water surface; I guess it depends on how clear the water is. If it's super clear, like raevol's examples, then there's nothing to cast a shadow on, but if the water is not that clear, then it might look like this or this. Seems like it also depends on if the sun's highlights is directly reflecting from the water to you or not.
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

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

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 22:51

I was hoping that all it would do was turn off the highlights. I might try some experimentation to see what's actually affected by the variable.
AnyOldName3, Master of Shadows

magamo
Posts: 106
Joined: 28 May 2016, 17:28

Re: Shadows

Post by magamo » 30 Oct 2017, 22:53

I would think, Lysol, that it would be even more prudent to get shadows into at least one 0.XX release before 1.0

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

Re: Shadows

Post by AnyOldName3 » 30 Oct 2017, 23:28

I think I'm probably assigning to the value correctly, but in the old OGRE version where the variable originated, there was some shadow fading stuff going on (which I don't think we need), making things a little less clear.

Scrawl authored commit https://github.com/OpenMW/openmw/commit ... 3c126cfa74, which is the last thing that ever discussed water shadows, so he might be able to weigh in.
AnyOldName3, Master of Shadows

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

Re: Shadows

Post by AnyOldName3 » 31 Oct 2017, 00:41

I've found myself another thing to investigate. For whatever reason, the terrain isn't making it into the shadow map, so hills and the like don't cast shadows.
AnyOldName3, Master of Shadows

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

Re: Shadows

Post by raevol » 31 Oct 2017, 00:58

lysol wrote:
30 Oct 2017, 22:40
if the water is not that clear, then it might look like this or this. Seems like it also depends on if the sun's highlights is directly reflecting from the water to you or not.
Thank you! I wasn't completely sure about what I posted, but I was having a hard time finding examples hahaha.

magamo
Posts: 106
Joined: 28 May 2016, 17:28

Re: Shadows

Post by magamo » 31 Oct 2017, 11:30

I've also noticed that this branch seems to break terrain texture blending, making the entire world a massive patchwork of seams everywhere. That should probably be resolved down the line before this is merged. This is a FANTASTIC start, AON3! Great work!

Post Reply