[patch] new fog shader

Everything about development and the OpenMW source code.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: [patch] new fog shader

Post 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.
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: [patch] new fog shader

Post 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 ...
User avatar
psi29a
Posts: 5356
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: [patch] new fog shader

Post by psi29a »

Looking forward to seeing this main-lined into OpenMW for 0.40! (No rush!) :P
visvaldas
Posts: 35
Joined: 24 May 2015, 20:31

Re: [patch] new fog shader

Post by visvaldas »

Current WIP:
screenshot271.jpg
screenshot264.jpg
screenshot266.jpg
screenshot254.jpg
Rumina
Posts: 23
Joined: 27 May 2013, 17:03

Re: [patch] new fog shader

Post by Rumina »

Wow, looks amazing! Nice work.
User avatar
lysol
Posts: 1513
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: [patch] new fog shader

Post by lysol »

Looks really really good. Nice work!
User avatar
raevol
Posts: 3093
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: [patch] new fog shader

Post by raevol »

I wannnt it. !!! When do we get to play with it!
User avatar
lgromanowski
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland
Contact:

Re: [patch] new fog shader

Post by lgromanowski »

Awesome :D
TheMechanist
Posts: 59
Joined: 10 Jan 2014, 22:08

Re: [patch] new fog shader

Post by TheMechanist »

:shock: Soon the days of MGE graphical superiority will be over ;)
User avatar
laxon
Posts: 21
Joined: 24 Mar 2013, 10:24
Location: Oslo
Contact:

Re: [patch] new fog shader

Post by laxon »

These are amazing! Such a difference.
Post Reply