Ogre::PSSMShadowCameraSetup blocky shadowing problem
- zarlox
- Halfling
- Posts: 70
- Joined: Tue Apr 19, 2011 12:32 am
- Location: Canada
- x 2
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Good question and i honestly do not know about this one. But i would like to know as well as i may change my scene later to have more light sources.
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Alright, well thanks for your help! Hopefully someone else who knows how to use multiple lights can come help us!
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Another stupid suggestion from yours truly, how about adding once_per_light to the material pass?
- zarlox
- Halfling
- Posts: 70
- Joined: Tue Apr 19, 2011 12:32 am
- Location: Canada
- x 2
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
To a beginner like me, that is a very good suggestion. Multiple pass might work just finetod wrote:Another stupid suggestion from yours truly, how about adding once_per_light to the material pass?
By the way this post probably should be transferred to the help forum?
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
This must be transferred to the "In grave need of an expert opinion" forum. It's sad that some people know how to get PSSM working and could help a couple of beginners move into the 1% of really rich game developers !
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
It did do something - instead of just being affected by the two directional lights, my meshes with PSSM materials are also being colored by my other two lights, a blue point light and green spot light.tod wrote:Another stupid suggestion from yours truly, how about adding once_per_light to the material pass?
...You know what, it's probably easier just to show you guys.
http://www.mediafire.com/?50rd1huhii327om (6MB)
you'll need .net 4.0 to run it. The materials should be easy enough to tweak without needing to recompile anything.
EDIT: source: http://pastie.org/2725318
EDIT 2: use 1, 2, and 3 to turn on/off the lights. 1 for the red directional, 2 for the blue point, 3 for the green spot. There's also a white directional in there I guess I should've added a disable key. Can do that if it's an issue
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Good news?
Some observations on my part:
1) texture shadows don't work with point lights
2) you still have only one light affecting your shadows at a given time
3) your shadow is modulative
4) the shadow quality is crap, it doesn't look like PSSM, or you are using very small texture sizes for it
5) light should affect your materials, shadows or not
That's about it
Some observations on my part:
1) texture shadows don't work with point lights
2) you still have only one light affecting your shadows at a given time
3) your shadow is modulative
4) the shadow quality is crap, it doesn't look like PSSM, or you are using very small texture sizes for it
5) light should affect your materials, shadows or not
That's about it
- zarlox
- Halfling
- Posts: 70
- Joined: Tue Apr 19, 2011 12:32 am
- Location: Canada
- x 2
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Sorry i am at work and can not really look at it right now...just can see the pastie.
1 x 1024 and 2 x 512 is reasonable for split textures and i have some good result with this but it also can vary a lot depending at which distance you set the split points, and what is the range the shadow covers (shadow far distance).
1 x 1024 and 2 x 512 is reasonable for split textures and i have some good result with this but it also can vary a lot depending at which distance you set the split points, and what is the range the shadow covers (shadow far distance).
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
3) I have it set as additivetod wrote:Good news?
Some observations on my part:
1) texture shadows don't work with point lights
2) you still have only one light affecting your shadows at a given time
3) your shadow is modulative
4) the shadow quality is crap, it doesn't look like PSSM, or you are using very small texture sizes for it
5) light should affect your materials, shadows or not
That's about it
4) I dunno how to change that. I try playing with numbers but it doesn't do much
Last edited by Pyritie on Wed Oct 19, 2011 8:09 pm, edited 1 time in total.
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Maybe it's just an unfortunate camera position, my shadows also degrade from a certain position, but I don't really know. They look very blocky to me though.
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
I vaguely remember that additive lighting uses the ambient color? Not sure, but if your ambient is black, you should try to change it to some gray. Anyway you still have the problem of one light only. When turning light 1 on, the shadows move instead of having 2 of them. Not much use for additive with one light3) I have it set as additive
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
I moved the camera to 50,50,50 instead of 100,100,100, here's what I got:tod wrote:Maybe it's just an unfortunate camera position, my shadows also degrade from a certain position, but I don't really know. They look very blocky to me though.
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
This is what I get:
Note that the borders of the shadow are pretty straight. Not sure what's wrong with your setup, you should try looking real close at the shadows, maybe the split point or far distance is wrong or something. Sorry, not much knowledge here either.
Note that the borders of the shadow are pretty straight. Not sure what's wrong with your setup, you should try looking real close at the shadows, maybe the split point or far distance is wrong or something. Sorry, not much knowledge here either.
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
What numbers are you using in yours, and how many ogre units are a meter?
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
1 Ogre unit = 1 meter. The shadow in the image I guess it's about 4-5 meters. My settings have been posted before.
I'm also pretty sure this is not PSSM proper, but a more simple technique, but it still looks better than what you have. It could be that you camera is too far and it only sees the low resolution texture.
I'm also pretty sure this is not PSSM proper, but a more simple technique, but it still looks better than what you have. It could be that you camera is too far and it only sees the low resolution texture.
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Perhaps. It's using much bigger units than my regular program because I was getting such low-resolution texture shadows earlier before I started trying out PSSM.
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
okay I shrunk everything back down to more usable units. The kart is abooooout 2 units long or so now. Still getting same stuff as before.
I noticed that for whatever reason I need to have the far distance on my shadows to something small like 150 otherwise the shadows go all screwy. Is this normal?
I noticed that for whatever reason I need to have the far distance on my shadows to something small like 150 otherwise the shadows go all screwy. Is this normal?
Code: Select all
void SetupShadows() {
sceneMgr.ShadowTechnique = ShadowTechnique.SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED;
sceneMgr.SetShadowTextureCountPerLightType(Light.LightTypes.LT_DIRECTIONAL, 3);
sceneMgr.ShadowTextureCount = 3;
sceneMgr.SetShadowTextureConfig(0, 1024, 1024, PixelFormat.PF_FLOAT32_R);
sceneMgr.SetShadowTextureConfig(1, 512, 512, PixelFormat.PF_FLOAT32_R);
sceneMgr.SetShadowTextureConfig(2, 512, 512, PixelFormat.PF_FLOAT32_R);
sceneMgr.ShadowTextureSelfShadow = true;
sceneMgr.ShadowCasterRenderBackFaces = false;
sceneMgr.ShadowFarDistance = 150;
sceneMgr.SetShadowTextureCasterMaterial("PSSM/shadow_caster");
sceneMgr.SetShadowTextureFadeStart(0.3f);
PSSMShadowCameraSetup pssm = new PSSMShadowCameraSetup();
pssm.SplitPadding = 1f;
pssm.CalculateSplitPoints(3, 0.0000001f, sceneMgr.ShadowFarDistance);
pssm.SetOptimalAdjustFactor(0, 2);
pssm.SetOptimalAdjustFactor(1, 1);
pssm.SetOptimalAdjustFactor(2, 0.5f);
pssm.UseSimpleOptimalAdjust = false;
sceneMgr.SetShadowCameraSetup(new ShadowCameraSetupPtr(pssm));
}
- zarlox
- Halfling
- Posts: 70
- Joined: Tue Apr 19, 2011 12:32 am
- Location: Canada
- x 2
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
I think it is. The more distant you put the shadow, the bigger the area that your shadow textures must cover. And of course, bigger area means less resolution per unit. But again, it depend what you means by screwyPyritie wrote:I noticed that for whatever reason I need to have the far distance on my shadows to something small like 150 otherwise the shadows go all screwy. Is this normal?
The main things that affect quality are :
1. split distance of each PSSM texture
2. shadow far distance
3. number of shadow texture (better leave this to 3 or maybe 4)
4. size of each PSSM texture.
Now i said earlier that my 3 PSSM textures are 1024, 512, 512 like you but after coming home and looking at it, i see they are set to 2048, 1024, 1024.
You should try to just adjust the texture size and shadow far distance
- Pyritie
- Gnome
- Posts: 363
- Joined: Wed Feb 25, 2009 6:15 pm
- Location: UK
- x 8
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
I made a help thread here: http://www.ogre3d.org/forums/viewtopic.php?f=2&t=67275
-
- Goblin
- Posts: 299
- Joined: Mon Aug 25, 2008 2:50 pm
- Location: Germany
- x 6
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Just as I asked before, is the size of the mesh relevant, when it comes to self shadowing, cause some variables are "only" on 10000 (extrusion distance of directional light) and my mesh is about 20.000 units large and gets strange self shadowing.
This is right now the only problem I have, self shadowing looks shit and I dont know why...
This is right now the only problem I have, self shadowing looks shit and I dont know why...
http://www.espadon-online.eu/ MMORPG using Ogre3D
-
- Goblin
- Posts: 260
- Joined: Tue Feb 02, 2010 6:25 pm
- x 2
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
I have implemented the code on page 2.
Is this suppose to work with directional light as well as spots, cause I can only get shadow with spot.
Also when I get close shadow is good from all angles but when I move away shadow disappears. My texture turns green, light blue, dark blue and then black when moving away from texture. And shadow is ok in green and light blue. I guess it is the planes.
How can I fix distance for shadows and can directional light cast shadows as well?
Is this suppose to work with directional light as well as spots, cause I can only get shadow with spot.
Also when I get close shadow is good from all angles but when I move away shadow disappears. My texture turns green, light blue, dark blue and then black when moving away from texture. And shadow is ok in green and light blue. I guess it is the planes.
How can I fix distance for shadows and can directional light cast shadows as well?
-
- Gremlin
- Posts: 153
- Joined: Tue Jun 09, 2009 9:31 am
- Location: Russia
- x 12
- Contact:
Re: Ogre::PSSMShadowCameraSetup blocky shadowing problem
Good old topic.
One of the main goals is to use DefaultShadowCameraSetup instead of LiSPSMShadowCameraSetup (the last one is shacking in motion, that don't look realistic). It was working perfect in 1.7, but now, when I try to set PSSMShadowCameraSetup to be inherited from DefaultShadowCameraSetup, the shadows dissapear...
One of the main goals is to use DefaultShadowCameraSetup instead of LiSPSMShadowCameraSetup (the last one is shacking in motion, that don't look realistic). It was working perfect in 1.7, but now, when I try to set PSSMShadowCameraSetup to be inherited from DefaultShadowCameraSetup, the shadows dissapear...