scrawl wrote:Kudos for doing this! How would you rate the ease of use / extensibility of the new shader system compared to the Ogre based one? It took me some time to get used to the lack of the "auto parameters" system, but I've found that the end result was often a cleaner and more efficient shader.
I definitely prefer the new one. It's more clean (nothing is hidden behind preprocessor magic and vertex/fragment shader are in separate files).
Hmm, I don't even remember what those "auto parameters" were or whether I used them.
Unfortunately the performance impact seems to be bigger than on the ogre version - on my system at least (intel haswell igp).
With shaders enabled in general, or you mean the default shaders compared to your fog shaders? This could be the case because the OpenMW-Ogre was always CPU limited.
I meant my shader specifically.
I did more work on it in between, and currently the impact isn't as noticable.
But that might also be related to other tweaks like setting the small object culling size to a higher value.
(Which when set to 20 gives a huge performance boost on my system, btw.)
Bugs: The height based fog looks wrong in water reflections because the scene is rendered upside down.
I believe the problem is in the way that cameraPos is derived from the (reflected) view matrix. The easiest fix would be to add a cameraPos uniform at the top of the scene graph that is updated every frame by the rendering manager.
Regarding the change for water.cpp to use the ShaderManager: this can be merged right away, please open a separate pull request.
Thanks for the hint (especially because it pointed me to how/where uniforms are set) - it turned out though that the problem was somewhere else:
osg_viewMatrixInverse doesn't contain the transformation done by the reflection node
My workaround was to add a isWaterReflection=0 uniform to the root node and overriding it in the reflection node, so the shader knows whether to invert the z-coordinate.
I wrote:My whishlist:
Defines that indicate whether reflection or refraction are being rendered.
Enable shaders for sky and horizon.