PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
User avatar
petrocket
Gremlin
Posts: 178
Joined: Tue Mar 20, 2007 3:29 am
x 10
Contact:

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by petrocket »

If you have a directional light I'm not sure how the PSSM camera setup works. The shadow camera for PSSM is placed at the origin of the light and then the shadow maps are rendered from the perspective of the shadow camera. I don't know where the shadow camera origin is set when you have a directional light, but you could use the distance from the shadow camera as the distance to the directional light when comparing depths in the final material shader.

You might have to dig into the Ogre PSSM camera source code to figure out where the camera is placed for a directional light.
Ogre API & Manual | Ogre Wiki

blog | website | work

Follow me on twitter @ twitter.com/petrocket
ndoxx
Kobold
Posts: 31
Joined: Tue Mar 11, 2008 4:54 pm

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by ndoxx »

Hi petrorocket,

Thanks for your explanation.
So if I have 3 pssm splits, all three shadow cameras are positioned at the same light position, but shadow camera direction differs? Is this right?
Then i have to search how ogre pssm setup place the shadow cameras position for directional light to calculate surface depth from light.

ndoxx
User avatar
petrocket
Gremlin
Posts: 178
Joined: Tue Mar 20, 2007 3:29 am
x 10
Contact:

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by petrocket »

I think that is correct about the shadow camera being set at the origin of the light for all 3 pssm splits - but the frustum is changed for each of the splits.
lukeneorm
Halfling
Posts: 61
Joined: Wed Apr 01, 2009 12:03 am

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by lukeneorm »

al2950 wrote:I have gone back to the pssm code from the playpen, and i am slowly going to try and turn it into VSM and see where the problem creeps in. (Its working fine now).
Unfortuantley I am going on holiday soon and so as always work is getting busy so that is taking up most of my time. BUT I WILL SOLVE THIS, when i get back!!
Angus
Hi al2950,
do you solve the PSSM + VSM issues? I'd like to use that approach in my project with directional lights, but I'm stuck at the beginning yet.. :(
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by al2950 »

No not yet, i have only just got back.

I am also using direction lights (using caelum), and i have had to go back to basics to understand them! I have been trawling through the source code to find out how a directional light is represented in a shader (ie the position given in the shadow caster). I beleive the code the shows this is in the OgreShadowCameraSetup.cpp;

What i am currently doing, when i have time, is creating a shadows system from scratch using my own theories and ideas so i actually understand stuff instead of just thinking i do!! I currently have created a PSSM shadow system with PCF, but i am having precision problems with the range compression in the caster when i get far away from 0 which is causing flickering. This down to how the direction light is represented in the caster, and is where i am at now.

When i get things working/actually understand everything, i will post here, but i cant give you any promisies on when!!
shenjoku
Gremlin
Posts: 193
Joined: Sat Aug 06, 2011 11:02 pm
x 6

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by shenjoku »

Is this method supposed to only be used with terrain or something? I just finished setting it up and there are no shadows being cast on anything but stuff is shaded.
screenshot09272011_170147302.jpg
kowinis
Gnoblar
Posts: 7
Joined: Fri Mar 20, 2015 10:39 pm

Re: PSVSM (PSSM + VSM) Shadow Material + GLSL Shader

Post by kowinis »

hi ,
https://www.youtube.com/watch?v=kq-_Tub ... e=youtu.be
i have this problem with this shader, as seen in the video, at some camera angles shadow seems to be culled, i use the scene setup code as provided atr the start of the thread, only changes the light position to 0,20,0. Has somebody encountered same provblem? or maybe knows ho to fix it?
Post Reply