Water shader tweaking

Everything about development and the OpenMW source code.
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Water shader tweaking

Post by akortunov »

Hello. I played a bit with water shader settings and have a couple of questions:

1. Most of performance loss by water shader are determined by what to reflect.
So if there is nothing to reflect, FPS is rouhly the same as with disabled water shader, but with shininess and rain ripples.
For now we have only option to disable actors reflections. Why do we treat actors differently from other objects?
Why do not use the "reflect only terrain+sky"/"reflect all" switch, for example? As for me, it makes more sense.

2. I played with "rtt size" setting (the water quality):
a) rtt size < 512 - there are graphics artifacts
b) rtt size = 512 - low setting
c) rtt size = 1024 - medium setting, looks better than low
d) rtt size = 2048 - high setting, looks almost as medium, but causes FPS drop
e) rtt size > 2048 - no quality gain, but there is additional FPS drop

Why 512/1024/2048 values were selected? Why not 512/768/1024, for example?

3. Is there any way to do not reflect distant objects? I doubt that we really need to reflect the whole scene (9 cells).
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Water shader tweaking

Post by Chris »

akortunov wrote: 25 Dec 2017, 17:47 2. I played with "rtt size" setting (the water quality):
a) rtt size < 512 - there are graphics artifacts
b) rtt size = 512 - low setting
c) rtt size = 1024 - medium setting, looks better than low
d) rtt size = 2048 - high setting, looks almost as medium, but causes FPS drop
e) rtt size > 2048 - no quality gain, but there is additional FPS drop
This depends on your main render size. If you're playing in 1920x1080, Having the reflections render at greater than 2048 isn't going to yield any visible improvement since those extra pixels won't be seen. Unless you use something like super-sampling, where those extra pixels will be filtered into the anti-aliased image.
Why 512/1024/2048 values were selected? Why not 512/768/1024, for example?
Video cards really like using power-of-two texture sizes. Ideally the reflections' texture size would be the same size as the main render target (using some divisor of that for quality control), but that may not be the most optimal.
3. Is there any way to do not reflect distant objects? I doubt that we really need to reflect the whole scene (9 cells).
With distant terrain on and looking out over a large area that includes water on a clear day, reflecting distant terrain and objects would improve the visual fidelity.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Water shader tweaking

Post by scrawl »

For now we have only option to disable actors reflections. Why do we treat actors differently from other objects?
Why do not use the "reflect only terrain+sky"/"reflect all" switch, for example? As for me, it makes more sense.
Because certain objects, if left out, will create holes in the environment or other weird effects. Actors always move around anyway, so it's safer to exclude them. Aside from that, actors are one of the most costly things to render, so there is much to be gained from excluding them.
If you don't reflect anything in interior cells, the fog color will be reflected, which, depending on whether or not that fog color was intended to ever be visible may look extremely odd.
A setting for reflecting only terrain+sky in exterior cells could be useful, maybe.
Video cards really like using power-of-two texture sizes. Ideally the reflections' texture size would be the same size as the main render target (using some divisor of that for quality control), but that may not be the most optimal.
Supposedly, yes. I'm not sure how true that still is nowadays.
3. Is there any way to do not reflect distant objects? I doubt that we really need to reflect the whole scene (9 cells).
The 'small feature culling' setting in the Water section should do a good job at excluding distant objects that are small enough to not have much of an impact. You can increase this setting too.
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Water shader tweaking

Post by akortunov »

Chris wrote: 25 Dec 2017, 19:43 This depends on your main render size.
Ok, I got it. So for high resolutions "High" really may be "Medium", and "Medium" really can be "High" for low resolutions, right?
Chris wrote: 25 Dec 2017, 19:43 With distant terrain on and looking out over a large area that includes water on a clear day, reflecting distant terrain and objects would improve the visual fidelity.
At least, we can make it configurable. That visual fidelity may not excuse the performance loss for some users, especially if the user can use the additional GPU power for something different (e.g. for upcoming shadows).
Also, as I said, we can try to reflect only terrain on lange distance.
User avatar
akortunov
Posts: 899
Joined: 13 Mar 2017, 13:49
Location: Samara, Russian Federation

Re: Water shader tweaking

Post by akortunov »

scrawl wrote: 25 Dec 2017, 19:59 The 'small feature culling' setting in the Water section should do a good job at excluding distant objects that are small enough to not have much of an impact. You can increase this setting too.
I tried that, but I got artifacts on short distances, e.g. in trees reflections. So I asked about distant objects.
Chris
Posts: 1625
Joined: 04 Sep 2011, 08:33

Re: Water shader tweaking

Post by Chris »

scrawl wrote: 25 Dec 2017, 19:59
Video cards really like using power-of-two texture sizes. Ideally the reflections' texture size would be the same size as the main render target (using some divisor of that for quality control), but that may not be the most optimal.
Supposedly, yes. I'm not sure how true that still is nowadays.
I have a vague recollection of reading that if you use a clamping texture addressing mode, there isn't much if any performance hit for non-power-of-two sizes (a power-of-two size allows using an integer mask to address the individual texels when wrapping, while a non-power-of-two size requires a slightly more costly modulo/division, but clamping would be the same regardless). I don't know if that's really true or not though.
akortunov wrote: 25 Dec 2017, 20:04 Ok, I got it. So for high resolutions "High" really may be "Medium", and "Medium" really can be "High" for low resolutions, right?
In a manner of speaking. A 2048x2048 RTT is still a 2048x2048 RTT regardless if you're 1080p or 4K. But relative to the full render size, sure.
User avatar
scrawl
Posts: 2152
Joined: 18 Feb 2012, 11:51

Re: Water shader tweaking

Post by scrawl »

I tried that, but I got artifacts on short distances, e.g. in trees reflections. So I asked about distant objects.
Small feature culling works on individual meshes, not whole game objects, so if you have an object that's made up of many small meshes (like individual leaves of a tree) those may disappear prematurely. As hinted in another thread, the best solution is probably to make a more efficient tree model.
imec
Posts: 37
Joined: 13 May 2012, 22:03

Re: Water shader tweaking

Post by imec »

I hate to bump this but being able to disable static object reflections would be such an improvement.
akortunov wrote: 25 Dec 2017, 20:04 At least, we can make it configurable. That visual fidelity may not excuse the performance loss for some users, especially if the user can use the additional GPU power for something different (e.g. for upcoming shadows).
Also, as I said, we can try to reflect only terrain on lange distance.
The performance loss is almost 50% of my frames and I haven't used the feature for years because it is just not worth it. Enabling forced shaders and distant terrain on top of that makes my FPS go from 120-200 in Balmora to lows in the 30s. Things are even worse in complex TR towns like Akamora, Old Ebonheart or Port Telvannis. Disabling actors and lowering the RTT does not improve the problem much unfortunately. And I agree about shadows, they are almost ready to be merged and there is no way it's going to be playable on my decentish system with static object reflections enabled.
scrawl wrote: 25 Dec 2017, 19:59 A setting for reflecting only terrain+sky in exterior cells could be useful, maybe.
Please allow this as an option. I know I'm not alone in sticking to the crummy default animated textures for performance reasons. It would mean a big visual improvement for users like me.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: Water shader tweaking

Post by AnyOldName3 »

Most of the infrastructure to disable static object water reflections exists in the shadows branch (and due to an oversight, they were permanently off until yesterday) but I'm not really sure they're a particular performance hog. If they are, though, it might be a better option to make water reflections completely disableable rather than disabling objects and permitting terrain.
imec
Posts: 37
Joined: 13 May 2012, 22:03

Re: Water shader tweaking

Post by imec »

Options for statics, terrain and actors seems like it would be good, but I might be completely off-base.

It seems like there are reasons to use different configurations:
- Terrain + Actors + Statics (most realistic)
- Terrain + Statics (better performance, what we currently have)
- Terrain only (even better performance and probably won't look too weird)
- Nothing (best performance)

Although people could screw that up and make things look weird on accident if they enabled actors and terrain or some other strange configuration.
Post Reply