Spyglass usage causes water to disappear

Spyglass water disappears with shaders This probably belongs to dev corner, but i took an oath to ask questions exclusively in help-me. MC Version: 1.21.5 Mods: Fabric/DH/Iris
DistantHorizons-neoforge-fabric-2.3.2-b-1.21.5 iris-fabric-1.8.11-mc1.21.5 nvidium-0.4.1-beta3-1.21.5 sodium-fabric-0.6.13+mc1.21.5
So i've been trying to hack in shader support into a non-dh shader and i've ran into something i'm incapable of dealing with on my own Whenever i use a spyglass there's a range of directions i can look towards where water will disappear entirely. The range seems to depend on player location, most likely Z coordinate I can't reproduce that in singleplayer, only happens in multiplayer. It doesn't happen to some DH-compatible shaders like "complimentary". So i want to avoid changing any DH settings. Replacing "complimentary shader's" terrain/water with my dh_water and dh_terrain leads to my files working properly, so... is there some iris setting im possibly missing? Here's the minimal code i'm using to troubleshoot it rn Both dh_water.vsh and dh_terrain.vsh look like:
#version 120
void main()
{
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
}
#version 120
void main()
{
gl_Position = gl_ProjectionMatrix * gl_ModelViewMatrix * gl_Vertex;
}
dh_terrain.fsh is:
#version 120
layout(location = 0) out vec4 fragColor;
void main()
{
fragColor = vec4(0.3, 0.3, 0.3, 1.0);
}
#version 120
layout(location = 0) out vec4 fragColor;
void main()
{
fragColor = vec4(0.3, 0.3, 0.3, 1.0);
}
dh_water.fsh is:
#version 120

uniform sampler2D depthtex1;

uniform float viewWidth;
uniform float viewHeight;

layout(location = 0) out vec4 fragColor;

void main()
{
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
if (texture2D(depthtex1, screenPos.xy).r < 1.0)
{
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
return;
}
fragColor = vec4(0.4, 1.0, 0.4, 1.0);
}
#version 120

uniform sampler2D depthtex1;

uniform float viewWidth;
uniform float viewHeight;

layout(location = 0) out vec4 fragColor;

void main()
{
vec3 screenPos = vec3(gl_FragCoord.xy / vec2(viewWidth, viewHeight), gl_FragCoord.z);
if (texture2D(depthtex1, screenPos.xy).r < 1.0)
{
fragColor = vec4(1.0, 0.0, 0.0, 1.0);
return;
}
fragColor = vec4(0.4, 1.0, 0.4, 1.0);
}
Solution:
Here is a DH support testing shader: https://github.com/Null-MC/dh_tester Everything shoulfd work in this one, you can base yuor work of it...
GitHub
GitHub - Null-MC/dh_tester: A simple shader for testing compatibili...
A simple shader for testing compatibility between Distant Horizons and Iris. - Null-MC/dh_tester
Jump to solution
5 Replies
Miki_P98
Miki_P985mo ago
This probably belongs to dev corner, but i took an oath to ask questions exclusively in help-me.
Love this You might have better luck asking about shdaer development on ShaderLabs Discord server, they specialize in MC shaders Here not many people know how to write shaders even among the DH devs
Solution
Miki_P98
Miki_P985mo ago
Here is a DH support testing shader: https://github.com/Null-MC/dh_tester Everything shoulfd work in this one, you can base yuor work of it
GitHub
GitHub - Null-MC/dh_tester: A simple shader for testing compatibili...
A simple shader for testing compatibility between Distant Horizons and Iris. - Null-MC/dh_tester
Miki_P98
Miki_P985mo ago
GitHub
ShaderDoc/dh-support.md at master · IrisShaders/ShaderDoc
Documentation of Minecraft shaders. Contribute to IrisShaders/ShaderDoc development by creating an account on GitHub.
Zeropoint
ZeropointOP5mo ago
This makes a lot of sense. Will do, thx xD
Zeropoint
ZeropointOP5mo ago
In case anyone stumbles upon this: Lack of a deferred pass was the issue in my case. Addition of deferred1 pass resulted in water being present as expected.

Did you find this page helpful?