Lights are enabled in Forward3D instead of putted back to what they were
-
- Kobold
- Posts: 26
- Joined: Tue Sep 05, 2017 10:19 am
- x 7
Lights are enabled in Forward3D instead of putted back to what they were
Hi all,
As the tittle said, in the code of Forward3D::collectLights the lights are setted to invisible for some stuff and putted back to... visible !!!
Instead of setted back to what they were... it brang a problem in my software so i've made a patch.
I upload the patch, it has been made from Ogre 2.1 commit 2dcab1a29414bf53fe25d0b8dad97715064fb07b and the problem also appear in Ogre 2.2...
If some devs agree with that patch it should be pushed...
Cheers
As the tittle said, in the code of Forward3D::collectLights the lights are setted to invisible for some stuff and putted back to... visible !!!
Instead of setted back to what they were... it brang a problem in my software so i've made a patch.
I upload the patch, it has been made from Ogre 2.1 commit 2dcab1a29414bf53fe25d0b8dad97715064fb07b and the problem also appear in Ogre 2.2...
If some devs agree with that patch it should be pushed...
Cheers
You do not have the required permissions to view the files attached to this post.
-
- OGRE Team Member
- Posts: 5446
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1348
Re: Lights are enabled in Forward3D instead of putted back to what they were
Hi!
Great point!!!
Fix pushed.
The fix has also been backported to stable 2.2 and 2.1 branches.
Thanks for the fix!
Great point!!!
Fix pushed.
The fix has also been backported to stable 2.2 and 2.1 branches.
Thanks for the fix!
-
- Kobold
- Posts: 26
- Joined: Tue Sep 05, 2017 10:19 am
- x 7
Re: Lights are enabled in Forward3D instead of putted back to what they were
Ok, nice !
(I haven't seen it was also in ForwardClustered too )
Glad to help !
(I haven't seen it was also in ForwardClustered too )
Glad to help !
-
- Kobold
- Posts: 26
- Joined: Tue Sep 05, 2017 10:19 am
- x 7
Re: Lights are enabled in Forward3D instead of putted back to what they were
Hello again,
I see that a very similar problem occurs in CompositorShadowNode::clearShadowCastingLights/CompositorShadowNode::restoreStaticShadowCastingLights with Light::setCastShadows ...
Is it possible to correct the issue the same way dark_sylinc ?
I see that a very similar problem occurs in CompositorShadowNode::clearShadowCastingLights/CompositorShadowNode::restoreStaticShadowCastingLights with Light::setCastShadows ...
Is it possible to correct the issue the same way dark_sylinc ?
-
- OGRE Team Member
- Posts: 5446
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1348
Re: Lights are enabled in Forward3D instead of putted back to what they were
Actually no.
Those functions you pointed to are for manually managing shadow map/lights and force Ogre to use associate a light with a specific shadow map.
A light that does not cast shadows being forced to be associated with a shadow map is a contradiction.
If you want to turn off shadow casting or disable a light that you manually forced to be associated with a shadow map; either unbind the light from that shadow map; or alternatively set the light power to 0, thus the light will still burn GPU and CPU power, but it will not visually affect the scene; and restore the light power when you need to enable it again.
You can use light->getUserObjectBindings()->setUserAny to save the old light power for later restoring it.
I understand it's not user friendly (quickly flipping setCastShadows is convenient) but the implications of the contradiction are complex to solve (we must skip the shadow map from being processed, there will be holes/gaps in the shadow map, new shaders must be generated which can cause stalls)
Those functions you pointed to are for manually managing shadow map/lights and force Ogre to use associate a light with a specific shadow map.
A light that does not cast shadows being forced to be associated with a shadow map is a contradiction.
If you want to turn off shadow casting or disable a light that you manually forced to be associated with a shadow map; either unbind the light from that shadow map; or alternatively set the light power to 0, thus the light will still burn GPU and CPU power, but it will not visually affect the scene; and restore the light power when you need to enable it again.
You can use light->getUserObjectBindings()->setUserAny to save the old light power for later restoring it.
I understand it's not user friendly (quickly flipping setCastShadows is convenient) but the implications of the contradiction are complex to solve (we must skip the shadow map from being processed, there will be holes/gaps in the shadow map, new shaders must be generated which can cause stalls)
-
- Kobold
- Posts: 26
- Joined: Tue Sep 05, 2017 10:19 am
- x 7
Re: Lights are enabled in Forward3D instead of putted back to what they were
That was the point of my problem, I use the CompositorShadowNode::setLightFixedToShadowMap to reuse existing shadow map from other workspace in order to save CPU/GPU time but when I disable a light (Light::setVisible) it caused visual problems for the other lights.If you want to turn off shadow casting or disable a light that you manually forced to be associated with a shadow map; either unbind the light from that shadow map; or alternatively set the light power to 0, thus the light will still burn GPU and CPU power, but it will not visually affect the scene; and restore the light power when you need to enable it again.
So I tried to use light power but CPU and GPU time were still burned.
Finally I wanted to disable shadow casting when I want to disable a light and here was my actual problem.
Ok so unbinding the light from the shadow map have solved my former issue.
I can reuse shadows from other workspace without any artifact, thanks !