Shadows

Everything about development and the OpenMW source code.
User avatar
damiel
Posts: 27
Joined: 16 Apr 2016, 11:46

Re: Shadows

Post by damiel » 16 Jul 2017, 17:49

@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...

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

Re: Shadows

Post by AnyOldName3 » 23 Aug 2017, 15:57

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?

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

Re: Shadows

Post by raevol » 23 Aug 2017, 20:35

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

User avatar
scrawl
Posts: 2009
Joined: 18 Feb 2012, 11:51
Contact:

Re: Shadows

Post by scrawl » 25 Aug 2017, 11:28

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.

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

Re: Shadows

Post by AnyOldName3 » 19 Sep 2017, 23:07

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests