Hi,
I know this may be really simple to achieve, but how can I correctly set shadows to not update every frame?
Let's say I want to update the shadows every 5 frames, or a finite number of times every second.
Updating the shadows every frame is an overkill for my specific purpose.
Btw I'm using Cascaded Shadow Mapping & Poisson Disk filtering, located here http://ogre3d.org/forums/viewtopic.php?f=11&t=71142.
Thank you.
shadows update/refresh rate
-
- Halfling
- Posts: 91
- Joined: Mon Jan 07, 2013 4:24 am
- x 13
shadows update/refresh rate
Ludoria now on Kickstarter! Ludoria is now on KickStarter! https://www.kickstarter.com/projects/17 ... g-rpg-game
Ludoria's official website http://www.Ludoria.com
On Facebook https://www.facebook.com/pages/Ludoria/644733108967479
On Twitter https://twitter.com/LudoriaGame
Ludoria's official website http://www.Ludoria.com
On Facebook https://www.facebook.com/pages/Ludoria/644733108967479
On Twitter https://twitter.com/LudoriaGame
- tod
- Troll
- Posts: 1394
- Joined: Wed Aug 02, 2006 9:41 am
- Location: Bucharest
- x 94
- Contact:
Re: shadows update/refresh rate
I think the you could modify the shadow camera set-up to skip some frames.
-
- OGRE Expert User
- Posts: 1119
- Joined: Sat Jan 01, 2011 7:57 pm
- x 216
Re: shadows update/refresh rate
You can get the RenderTextures used for shadows with the SceneManager::getShadowTexture method. I use this to set the visibility mask on its viewport so I can better control which objects are casting shadows:
Perhaps you can set the RenderTarget to setAutoUpdated(false) and then update it manually every couple of frames?
Code: Select all
TexturePtr shadowTexture = mSceneMgr->getShadowTexture(i);
Viewport* vp = shadowTexture->getBuffer()->getRenderTarget()->getViewport(0);
vp->setVisibilityMask(visibilityMask);
-
- Halfling
- Posts: 91
- Joined: Mon Jan 07, 2013 4:24 am
- x 13
Re: shadows update/refresh rate
I tried to disable shadow texture auto updating, but it doesn't work.
I'm using cascaded shadows.Ogre 1.9.
Code: Select all
for (int i = 0; i < 4; i++)
{
TexturePtr shadowTexture = mSceneMgr->getShadowTexture(i);
RenderTexture* rt = shadowTexture->getBuffer()->getRenderTarget();
rt->setAutoUpdated(false);
}
Ludoria now on Kickstarter! Ludoria is now on KickStarter! https://www.kickstarter.com/projects/17 ... g-rpg-game
Ludoria's official website http://www.Ludoria.com
On Facebook https://www.facebook.com/pages/Ludoria/644733108967479
On Twitter https://twitter.com/LudoriaGame
Ludoria's official website http://www.Ludoria.com
On Facebook https://www.facebook.com/pages/Ludoria/644733108967479
On Twitter https://twitter.com/LudoriaGame
- areay
- Bugbear
- Posts: 819
- Joined: Wed May 05, 2010 4:59 am
- Location: Auckland, NZ
- x 69
Re: shadows update/refresh rate
You can use this on your viewport file:///usr/share/doc/ogre-devel-doc-1.8.1/api/classOgre_1_1Viewport.html#ab71a4790d66e3cddd3b36b3c1b4fd23c
Not sure about the runtime cost or whether it actually saves you any rendering horsepower. It might just stop the shadow casting pass. However, all of your shadow receiving entities would still be executing shadow code in their shaders, it would just be using blank (or undefined?) shadow textures. I think...
Not sure about the runtime cost or whether it actually saves you any rendering horsepower. It might just stop the shadow casting pass. However, all of your shadow receiving entities would still be executing shadow code in their shaders, it would just be using blank (or undefined?) shadow textures. I think...