I have a problem with integrated texture shadow mapping after upgrading to RenderSystemGL3+.
This is running under RenderSystemGL, works as expected:
https://www.youtube.com/watch?v=wsZ3yZ3DWYo
Now under RenderSystemGL3+ with NVidia GPU:
https://www.youtube.com/watch?v=CvvijOARbrI
looks like the shadow texture is updated correctly when the program starts but the pose of the shadow camera is not updated when the light is moving.
Under RenderSystemGL3+ with AMD GPU:
https://www.youtube.com/watch?v=TJZ7HWOquVw
looks like the shadow texture is updated from the user's perspective instead of the light's.
any ideas?
thank you
Edit: No errors in ogre.log. I'm using the default shadow camera setup.
[1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue Topic is solved
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact:
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
this could be a problem with the RTSS. Can you try to add the line
"mEnableFixedPipeline = false;"
at
https://github.com/OGRECave/ogre/blob/v ... m.cpp#L164
and see whether the Problem also occurs with RenderSystemGL.
"mEnableFixedPipeline = false;"
at
https://github.com/OGRECave/ogre/blob/v ... m.cpp#L164
and see whether the Problem also occurs with RenderSystemGL.
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
Thank you for the suggestion. I added the line and recompiled the Ogre libraries. The RenderSystemGL shadows are still correct.paroj wrote:this could be a problem with the RTSS. Can you try to add the line
"mEnableFixedPipeline = false;"
at
https://github.com/OGRECave/ogre/blob/v ... m.cpp#L164
and see whether the Problem also occurs with RenderSystemGL.
Please note that I'm not using the RTSS component.
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
could you provide a minimal reproducer test with your shaders and your materials?emc wrote: Please note that I'm not using the RTSS component.
If the RTSS is disabled, then the difference must be in the GLSL shader or how the parameters are passed.
Are you by chance reading some fixed function state in the shader? (things starting with gl_) This would be still available in GL legacy but not with GL3+. Also are you forcing a specific GLSL version via "#version XXX"?
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
I created a minimal test using my shaders and materials. I modified the "Lighting sample" and as you can see in the video it works fine:paroj wrote:could you provide a minimal reproducer test with your shaders and your materials?emc wrote: Please note that I'm not using the RTSS component.
If the RTSS is disabled, then the difference must be in the GLSL shader or how the parameters are passed.
Are you by chance reading some fixed function state in the shader? (things starting with gl_) This would be still available in GL legacy but not with GL3+. Also are you forcing a specific GLSL version via "#version XXX"?
https://youtu.be/cM0e6e5aDDo
I'm not reading fixed function state variables but I'm forcing a specific GLSL version via "#version330".
Back to my application now. I forgot to mention that the application supports multiple RenderWindows. On startup it creates a dummy RenderWindow and uses it to initialize Ogre. No viewports are created, and it is kept hidden during the lifetime of the application. During runtime, when the user loads a Scene a new RenderWindow is created and added to a notebook style widget.
This design works great with the legacy OpenGL rendersystem. With OpenGL3+ it seems to mess up the RenderWindow rendering in general, not just the shadows. For example when I load a new scene I see this:
Looks like the camera matrix used for rendering is no longer the correct one.
One final remark. I modified my application, I removed the dummy window. Ogre now is initialized after the first RenderWindow is created (when the user loads a scene). Everything works perfectly (shadows etc):
..until the user loads another scene and a new RenderWindow is created:
Both RenderWindows are messed up.
Seems like GL3+ does not like creating RenderWindows after Ogre initialization.
Any insight is really appreciated. Meanwhile I'm trying to reproduce the problem on the modified sample so I can give you some code to look at.
Thank you
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
do you re-use the GL context or create a new one for each window?
this works on linux at least:
https://github.com/OGRECave/ogre/blob/m ... #L349-L352
this works on linux at least:
https://github.com/OGRECave/ogre/blob/m ... #L349-L352
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
I create a new one for each window. Using currentGLContext = true raises an exception:paroj wrote:do you re-use the GL context or create a new one for each window?
this works on linux at least:
https://github.com/OGRECave/ogre/blob/m ... #L349-L352
Code: Select all
18:20:33: GL3PlusRenderSystem::_createRenderWindow "eb80778d-5285-4cbb-a8c2-9ea3d6e3efdb", 800x600 windowed miscParams: FSAA=4 FSAAQuality=0 currentGLContext=true externalWindowHandle=657516
18:20:33: RenderingAPIException: wglMakeCurrent in Win32Window::create at E:\Devel\Dependencies\src\Ogre\v1.10.8p\ogre-1.10.8p\RenderSystems\GLSupport\src\win32\OgreWin32Window.cpp (line 497)
-
- OGRE Team Member
- Posts: 1994
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1074
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
ah.. you open a can of worms there.. OGRE tries to share resources with the main context if you create a new one. However some resources are strictly per context. Most notably FBOs and VAOs. This is not properly considered in the codebase. E.g. Ogre tries to cache renderbuffers here:
https://github.com/OGRECave/ogre/blob/m ... e.cpp#L506
There were some fixes for this in GLES2:
https://github.com/OGRECave/ogre/commit ... 7e2e000da7
Things probably worked in GL, as we do not use VAOs there - not sure why FBOs did work.
Anyway your best bet is to fix "currentGLContext=true" on Windows.
https://github.com/OGRECave/ogre/blob/m ... e.cpp#L506
There were some fixes for this in GLES2:
https://github.com/OGRECave/ogre/commit ... 7e2e000da7
Things probably worked in GL, as we do not use VAOs there - not sure why FBOs did work.
Anyway your best bet is to fix "currentGLContext=true" on Windows.
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact:
Re: [1.10.8, GL3Plus, Win10, AMD/NVidia] integrated texture shadows update issue
This is really helpful. I'll try to make it work in this direction.paroj wrote:ah.. you open a can of worms there.. OGRE tries to share resources with the main context if you create a new one. However some resources are strictly per context. Most notably FBOs and VAOs. This is not properly considered in the codebase. E.g. Ogre tries to cache renderbuffers here:
https://github.com/OGRECave/ogre/blob/m ... e.cpp#L506
There were some fixes for this in GLES2:
https://github.com/OGRECave/ogre/commit ... 7e2e000da7
Things probably worked in GL, as we do not use VAOs there - not sure why FBOs did work.
Anyway your best bet is to fix "currentGLContext=true" on Windows.
Thank you so much for you time
- emc
- Silver Sponsor
- Posts: 41
- Joined: Mon Mar 20, 2006 12:43 pm
- Location: Athens/Greece
- Contact: