Open Pugsworth opened 2 years ago
You can see it rendering if you look at it the wrong way, only when that part of the screen should be occluded.
I expect the problem to happen near here. Maybe it was fixed somewhere in this massive commit. Can you try to reproduce this on other maps? Does TF2 have this problem? Does CS:GO? If there's a Source game that fixed this, maybe it can be ported.
You could try working around it by using render targets, stencils, and clipping planes. mat_showwatertextures
displays the intermediate textures used to draw water surface reflection. The shader code is in the public Source SDK 2013 base, so you can check that to get a better understanding of how it works, but it's surprisingly simple.
You can see it rendering if you look at it the wrong way, only when that part of the screen should be occluded.
I expect the problem to happen near here. Maybe it was fixed somewhere in this massive commit. Can you try to reproduce this on other maps? Does TF2 have this problem? Does CS:GO? If there's a Source game that fixed this, maybe it can be ported.
You could try working around it by using render targets, stencils, and clipping planes.
mat_showwatertextures
displays the intermediate textures used to draw water surface reflection. The shader code is in the public Source SDK 2013 base, so you can check that to get a better understanding of how it works, but it's surprisingly simple.
Oh interesting. It's almost like the depth sorting gets broken. I will have to play with trying to render just the water in orthographic and overlaying that on top.
It is a problem in every single map I've tried, so there's that.
Something to note, too; camortho causes the exact same effect. I'll have to try it in other games/engine branches to see if Valve ever fixed it.
Oh interesting. It's almost like the depth sorting gets broken.
I think it's something like this.
Something to note, too; camortho causes the exact same effect. I'll have to try it in other games/engine branches to see if Valve ever fixed it.
I tested TF2 and it was affected. I did not try CSGO because camortho is not present. I think Valve never fixed it.
Setting mat_dxlevel
below 90 will default to a different water shader, which will work in orthographic rendering. This might be a problem in the shader (and here). The water shaders for DX9 and DX8 are different formats, and I'm not familiar with either of them. They're included in Source SDK, so it's possible to download and compile them and test changes.
Details
What happens When doing orthographic rendering, water does not render.
Version Protocol version 24 Exe version 2021.06.09 (garrysmod) Exe build: 14:40:17 Jul 12 2021 (8283) (4000) GMod version 2021.07.12, branch: unknown, multicore: 0 Windows 32bit
Steps to reproduce
Simply run this code on any map with water (gm_construct for example).
I couldn't really find if this was a known bug already or if there was a fix for it.