Page 4 of 13

Re: [patch] new fog shader

Posted: 16 Mar 2016, 12:22
by scrawl
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.
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.
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.

Re: [patch] new fog shader

Posted: 08 Apr 2016, 15:10
by visvaldas
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. :mrgreen:
scrawl wrote:
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.)
scrawl wrote:
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.
WIP ...

Re: [patch] new fog shader

Posted: 08 Apr 2016, 18:08
by psi29a
Looking forward to seeing this main-lined into OpenMW for 0.40! (No rush!) :P

Re: [patch] new fog shader

Posted: 09 Apr 2016, 16:53
by visvaldas
Current WIP:
screenshot271.jpg
screenshot264.jpg
screenshot266.jpg
screenshot254.jpg

Re: [patch] new fog shader

Posted: 09 Apr 2016, 18:34
by Rumina
Wow, looks amazing! Nice work.

Re: [patch] new fog shader

Posted: 09 Apr 2016, 21:29
by lysol
Looks really really good. Nice work!

Re: [patch] new fog shader

Posted: 09 Apr 2016, 22:56
by raevol
I wannnt it. !!! When do we get to play with it!

Re: [patch] new fog shader

Posted: 10 Apr 2016, 08:03
by lgromanowski
Awesome :D

Re: [patch] new fog shader

Posted: 10 Apr 2016, 22:32
by TheMechanist
:shock: Soon the days of MGE graphical superiority will be over ;)

Re: [patch] new fog shader

Posted: 13 Apr 2016, 20:05
by laxon
These are amazing! Such a difference.