SolarSystem scenario PSSM shadows artifacts

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Lax
Orc Shaman
Posts: 715
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 80

SolarSystem scenario PSSM shadows artifacts

Post by Lax »

Hi all,

I'm working on a solar system component in Ogre-Next. Planets and moons orbit a sun at huge distances (orbital radii in the hundreds of thousands of units, farClip 1,000,000 in space).

When the player lands on a planet or moon, I freeze it. I snap farClip down to 5000 and enable PSSM shadows with lambda=0.95 for tight cascade coverage on the surface.

The problem: the scene's overall AABB is enormous (the whole solar system), and the shadow camera frustum seems to be influenced by that even though the player is only ever within a 5000 unit radius of the frozen body's surface.

Questions:

  1. Is there a way to explicitly constrain the PSSM shadow camera's focus region to a specific world-space AABB (e.g. centred on the frozen planet, radius 5000) so it ignores the rest of the solar system geometry entirely?
  2. Should I be using a dedicated shadow-only compositor workspace for the surface, or is tuning the ShadowTextureDefinition (pssmLambda, split points, etc.) the right approach?
  3. Is there anything in the CompositorShadowNodeDef or SceneManager I should set to exclude out-of-range objects from shadow caster culling when farClip is small but the scene AABB is huge?

Thanks a lot!

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5571
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1405

Re: SolarSystem scenario PSSM shadows artifacts

Post by dark_sylinc »

The best flexibility would be to derive from PSSMShadowCameraSetup and inject it (though CompositorShadowNode::CompositorShadowNode doesn't have a way to inject them... mmm)

Is there anything in the CompositorShadowNodeDef or SceneManager I should set to exclude out-of-range objects from shadow caster culling when farClip is small but the scene AABB is huge?

Yes. CompositorShadowNodeDef::mMinRq and CompositorShadowNodeDef::mMaxRq control that.
Put all "space" non-shadow casting objects outside of that render queue range. Visibility masks should also work (see SceneManager::_calculateCurrentCastersBox). IIRC objects with setCastShadows(false) should already be getting ignored though. If you're already doing that an your caster box is still huge, you may want to debug internally to see why it gets so big (you probably forgot to call setCastShadows on an object on the other side of the galaxy).

However I wouldn't rule out the possibility some of that math somewhere is using the whole scene's AABB, causing floating point issues.

For example in FocusedShadowCameraSetup::getShadowCamera it calls:

Code: Select all

cam->getCustomWorldSpaceCorners( corners, farDistance );

Which I believe is on the normal camera. Thus whether that number goes crazy will depend on your far distance parameters on the regular camera.

Lax
Orc Shaman
Posts: 715
Joined: Mon Aug 06, 2007 12:53 pm
Location: Saarland, Germany
x 80

Re: SolarSystem scenario PSSM shadows artifacts

Post by Lax »

Hi,

ok thanks! Then i know what to adapt.

Best Regards
Lax

http://www.lukas-kalinowski.com/Homepage/?page_id=1631
Please support Second Earth Technic Base built of Lego bricks for Lego ideas: https://ideas.lego.com/projects/81b9bd1 ... b97b79be62