[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 » 16 Mar 2016, 12:22

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 » 08 Apr 2016, 15:10

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

Re: [patch] new fog shader

Post by psi29a » 08 Apr 2016, 18:08

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 » 09 Apr 2016, 16:53

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 » 09 Apr 2016, 18:34

Wow, looks amazing! Nice work.

User avatar
lysol
Posts: 1316
Joined: 26 Mar 2013, 01:48
Location: Sweden

Re: [patch] new fog shader

Post by lysol » 09 Apr 2016, 21:29

Looks really really good. Nice work!
Normal mapped texture replacers, exclusive for OpenMW:
My Nexus page

User avatar
raevol
Posts: 3014
Joined: 07 Aug 2011, 01:12
Location: Caldera

Re: [patch] new fog shader

Post by raevol » 09 Apr 2016, 22:56

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 » 10 Apr 2016, 08:03

Awesome :D
best regards,
Lukasz

TheMechanist
Posts: 52
Joined: 10 Jan 2014, 22:08

Re: [patch] new fog shader

Post by TheMechanist » 10 Apr 2016, 22:32

:shock: Soon the days of MGE graphical superiority will be over ;)

User avatar
laxon
Posts: 19
Joined: 24 Mar 2013, 10:24

Re: [patch] new fog shader

Post by laxon » 13 Apr 2016, 20:05

These are amazing! Such a difference.

Post Reply