Page 2 of 32

Re: Shadows

Posted: 16 Jul 2017, 17:49
by damiel
@scrawl

I had some time to play around with your implementation but made some different observations, for example the terrain is not white for me but it seems the textures are mixed up or so, like there is a stone texture where before there was a sand textures and such. Also i seem to rarely find any shadows, atleast there are no shadows in interiors and i only see shadows in some exterior cells. But when i see shadows it seems they are independent of the view angle, they are just black blobs basically.

One thing i found in the terminal output was this:

Code: Select all

FRAGMENT glCompileShader "" FAILED
FRAGMENT Shader "" infolog:
0:9(39): error: unsized array index must be constant
0:10(78): error: unsized array index must be constant

glLinkProgram "" FAILED
Program "" infolog:
error: linking with uncompiled shader
I gonna continue to play around with this but it would be nice to know if there is anything i might have overlooked there...

Re: Shadows

Posted: 23 Aug 2017, 15:57
by AnyOldName3
I'm having a look at this right now, and don't seem to be seeing any shadows at all. When you say "Drawables not attached to Geodes (such as OpenMW's) are not considered for the shadow frustum" is this the problem. Also, does this issue mean that the shadow frustum ends up too small, that the objects just don't end up in the shadow map, or that something else happens?

Finally, doesn't something need adding to the shader to allow shadows to show up? I'm not seeing anything that does that.

Is this code actually supposed to be doing anything?

Re: Shadows

Posted: 23 Aug 2017, 20:35
by raevol
AnyOldName3 wrote: 23 Aug 2017, 15:57 I'm having a look at this right now
*giddy with excitement!*

Re: Shadows

Posted: 25 Aug 2017, 11:28
by scrawl
Is this code actually supposed to be doing anything?
Yes.
Finally, doesn't something need adding to the shader to allow shadows to show up? I'm not seeing anything that does that.
If you have OpenMW's shaders enabled, then yes, that addition would be needed. But the shaders are off by default.

If there aren't shaders used, the shadows should show correctly (apart from the flickering back-faces issue) as there is a texture unit set up with the projective texturing and depth test.

There's also a feature in osgShadow that makes it decorate the scene graph with a basic shader for shadow receivers. I can't remember if I had enabled that in the branch.
Also, does this issue mean that the shadow frustum ends up too small, that the objects just don't end up in the shadow map, or that something else happens?
I have no idea what would actually happen in that case, as I already submitted the fix before testing the shadows, but I suspect it would be along the lines of shadows not showing at all, or everything being in shadow.
The fixed commit is fdf6d55b9da38e7a77b8557c4562767e89b8e33b.
I gonna continue to play around with this but it would be nice to know if there is anything i might have overlooked there...
The shader compile error seems like a starting point.

Re: Shadows

Posted: 19 Sep 2017, 23:07
by AnyOldName3
So it looks like I managed to miss the last post from Scrawl here somehow, which might have helped test some things. For example, I'd completely forgotten that OpenMW supported fixed-function mode as I've had it off for so long.

Anyhow, after much experimentation, I've managed to achieve the following things:
  • I've experimented with which shadow techniques seem to work and which don't with osgShadow and figured out workarounds to some caveats. So far, I've found LISPSMDB to be the most effective in my experiments, but none of those experiments were actually OpenMW, so that doesn't necessarily mean it's the best fit for us. VDSM just seemed to have lower shadow resolution, and PSSM is unfinished.
  • I've got LispSM shadows working with shaders in my non-OpenMW experiments.
Now I've read Scrawl's post and know that I can use fixed-function mode, I can take a look at actually seeing something in OpenMW, despite spending quite a bit of time looking for a way to use shaders. This means that if I can get any shadow technique to not suck, I'll be able to make it not suck whether or not shaders are used.

If I could get a screenshot to happen, this is where I'd post a picture of a T72 tank, but made out of bricks, with a shadow on it.

Re: Shadows

Posted: 19 Sep 2017, 23:41
by AnyOldName3
This looks like a shadow to me:
OpenMW-Shadow.png
I'm seeing only a couple of issues with LispSM using the settings I lifted from the osgShadow example:
  • Some shadows seem to end up rendered on the skybox, but I can probably solve this really easily once I know how far the skybox is.
  • Some shadows seem to disappear when they fall on something close to the camera. This is probably just a constant that needs changing.
  • Some shadows have holes or bits missing. I think this is because some triangles are being incorrectly culled when the shadow map is rendered. I had this issue in the osgShadow example, and it went away when I made all primitives face in both directions. There's probably a simpler solution which is to change an '#IF 1' to an '#IF 0' in part of OSG, as it looks like someone's had a similar issue before and made it so that OSG can be compiled with shadow maps having no backface culling.
  • The shadow on the door to Indrele Rathryon's Shack looks like it might be the wrong colour at a very specific time of day. That's probably just Bethesda's fault for setting up a material weirdly.

Re: Shadows

Posted: 19 Sep 2017, 23:49
by AnyOldName3
Oh, also, the branch with LispSM is here: https://github.com/AnyOldName3/openmw/t ... hadow-test

Re: Shadows

Posted: 20 Sep 2017, 02:29
by raevol
!!! So exciting! Great work!

Re: Shadows

Posted: 20 Sep 2017, 09:07
by psi29a
This is great news! How can others help you?

Re: Shadows

Posted: 20 Sep 2017, 14:11
by Deltaxus
This looks great ! I can't wait to test this out in game. I wish I could help with graphics.