Shaders incompatability deep dive
Serorin-GH opened this issue ยท 22 comments
This is a Google translation, so I apologize if the words are incorrect.
Describe the bug
X-Ray doesn't work when using shaders in Iris.
To Reproduce
Steps to reproduce the behavior:
- When I turn on shaders in Iris, the corresponding blocks don't appear even when I turn on X-Ray.
(A message indicating that X-Ray is ON appears in the bottom right of the screen.) - When I turn off a shader in Iris, the corresponding block appears when I turn on X-Ray.
- When I turn off a shader in Iris with X-Ray ON, the corresponding block appears.
Minecraft Enviorment
-
Minecraft Version: 1.21.8
-
XRay Mod Version: advanced-xray-neoforge-21.8.3
-
Forge Version if applicable: neoforge-21.8.31
-
Sodium: sodium-neoforge-0.6.13+mc1.21.6
-
Iris: iris-neoforge-1.9.1+mc1.21.7
-
Shaders: ComplementaryUnbound_r5.5.1 , BSL_v10.0
Additional context
The above mod configuration worked fine in 1.21.4.
@MichaelHillcox - I started using WorldEditCUI today - a mod that helps visualize WorldEdit selections. it uses similar 'block highlighting' as shown in image below.
It works even when I have either of my shaders in use (BSL or Photon)
I'm not a developer, but perhaps you could review their code and see how they do it?
Git for WorldEditCUI = https://github.com/EngineHub/WorldEditCUI/tree/master
They have 3 render pipeline files, one for vanilla, one for optifine (which Iris supposedly emulates), and another.
https://github.com/EngineHub/WorldEditCUI/tree/master
My guess is the magic is in the Optifine file.

Very interesting! This I can use to look into things :D I'll do a deep dive tomorrow
See #140
I came here to report the same issue.
I do not have previous version experience to know if it worked before.
- MineCraft Version 1.21.8
- Fabric API: fabric-api-0.133.0+1.21.8
- XRay Mod Version: advanced-xray-fabric-21.6.3
- Sodium: sodium-fabric-0.6.13+mc1.21.6
- Iris: iris-fabric-1.9.1+mc1.21.7
- Shader - Photon_v1.2a (I've also tested with BSL_v10 - separately, only one or the other in the shaderpack folder and active.)
- ResourcePack: Patrix_1.21.8_32x_basic (but also occurs in Vanilla/no resource texture selected)
I also have other mods installed, but my testing has shown that the xray lines will appear with all of my others installed, so long as i disable the Shader pack.
With Photon shaderpack enabled
With shaderpack disabled (did not move/change view perspective - just went into Iris menu and disabled shader pack.

This isn't complete.
The referenced notice #140 seems to blame Optifine+shaders, and indicates the Xray author (you?) can't solve it due to Opti dev not answering your requests for assistance and it being closed source.
The two posts above have two separate shaders, neither of them being Optfine.
Serorin-GH is using BSLv10 shader + Iris for NeoForge
JamminR (myself) is using Photon v1.2a + Iris for Fabric
The two common denominators are a) we're using shaders and b) we're using Iris, an open source project.
If you believe this to be a shader loader issue, IrisShaders has a github repo and what seems to be an LGPL-v3 license.
IrisShaders Git = https://github.com/IrisShaders/Iris
Website = https://www.irisshaders.dev/
If you want to start with Shader pack authors,
-
BSLShaders doesn't seem to have a Git, but the author has a website and several social links/discord.
https://capttatsu.com/ -
Photon v1.2a
Git = https://github.com/sixthsurge/photon
(Though they use Modrinth for public releases, they do have a 'stable.zip' release available on Github)
Please let me know how else I can help.
I can enable any logging you provide me steps to enable, and steps to follow and attach logs and results here.
If you have any 'dev build' of the Xray mod you want me to try that provides additional detailed info for you, I'm willing to do that too.
Advanced Xray is an excellent mod. It will be even better if Minecraft users wouldn't have to disable shaders to use it.
Yeah, it's not so much optifine as it is shaders in general. I can see you took time to write this down so I thank you for this.
My actual issue isn't the shader provider specifically, it's just that I don't know what I need to do do make my mod work with shaders. I've seen some instances where you can see the render but it's in the wrong place, etc. I'm sure it's likely simple but I'm unlikely to be able to work it out myself as I don't really do much with shaders. Most of these mods do a bunch of mixins and not many of them give good information on how to integrate your mod with shaders
You're welcome. I really like the mod and wish to help in anyway i can.
10-15 years ago there was a mod that would both draw lines like Advanced Xray, and also allow clear view by stopping rendering all but ore / lava / dungeon blocks etc, no texture pack needed.
This is the closest working one to that. Get it working with shaders, and perhaps at same time figure out adding the stop rendering block/free view toggle if possible now, and it be the best (and only) xray mod out there for current MC.
(I've seen the see-through texture packs - but there's no quick view method like a mod toggle)
Good luck with fixing it. Perhaps the dev and or team at one of the above links (Iris / Photon / BSL) can assist.
I'm still looking into this as there is a bunch of moving parts. I've marked this as the main issue and I'll try and keep it up to date as I make progress :D
Wait...what!!?
You're not dedicating full time sleepless days/nights into fixing this mod that gives you no life support other than a fun side hobby (when users aren't complaining about it)?
I'm shocked!
(joking! /sarcasm)
Thanks for the update. I glance every few days at the code repo to look for updates.
For now when needed, Iris shade manager allows a keybind to quickly enable/disable shaders, so i often use it.
I noticed someone made a pull request to add a transparency adjustment. Perhaps between the render pipeline changes that seem required, you could poke through some of your other issue list bugs and or feature requests and get those in too.
I offer to alpha/beta test any changes you make if wanted.
Apologies - the render files in which i noticed comments on how WorldEditCUI gets past the optifine shaders issue were not posted a few weeks back. (I accidentally posted the same github WorldEditCUI main url twice)
Here's the render files - one has 'optifine' in the name, and comments indicating additional framebuffers are used.
https://github.com/EngineHub/WorldEditCUI/tree/master/worldeditcui-fabric/src/main/java/org/enginehub/worldeditcui/render
Just my two cents - I understand that this issue stems from the rewrtie of the mod, but since it is still an issue, can we maybe get just a regular update to the old version of xray to 1.21.8 and up? I understand it may be less performant but sacrificing that that up for shader support feels like a no-brainer in my opinion.
It didn't work before. This isn't knew. We've not worked with shared since god knows how long algo, maybe forever.
Hmm, the plot thickens... must be a change with the render pipelines...
I'll add it to my list.
This is likely an issue with Minecraft changing and not to do with the rewrites to the mod, most if not all the rendering code is basically the same
I wish @MichaelHillcox luck in fixing root cause whatever it may be.
Before coming to Github and posting reply to this thread originally, I found a few discussions on reddit and other social forums that said basically the same as @VL4DST3R said... "works for me!" while others were asking why it didn't.
1.21 was the first version of Minecraft I've played in several years and it indeed did -not- work for me. And apparently from the closed issue list, this issue, and the pinned issue, not many others either.
I can only guess it has much to do with way the frame buffers are loaded and what shaders/resource packs or other resources use them and maybe load order.
I believe the render pipeline file comment WorldEditCUI states about extra frame buffers is -likely- the root cause.
/**
* Optifine shaders uses a lot more frame buffers to render the world -- we have to make sure we're on the right one.
*
* @see <a href="https://github.com/sp614x/optifine/blob/master/OptiFineDoc/doc/shaders.txt">the shaders documentation</a>
*/
I do not know if Iris has shader documentation, only that it's intended to be Optifine compatible.
That's just my educated guesstimate as to why Xray doesn't work for all shader users.
This is likely an issue with Minecraft changing and not to do with the rewrites to the mod, most if not all the rendering code is basically the same
May very well be actually, I noticed that YDM's MobHealthBar, another mod I used for many versions now also broke with the update to 1.21.8. It is now rendering almost invisible except for some very specific screen space reflections artifacts that hint at something being there even if invisible.
That being said there are still mods that do work in displaying their overlay properly in this version, like another user mentioned here WorldEdit CUI and in my case the alternative to the health bar above that I am now currently using, Health Indicators . @JamminR suggestion sonds like a good lead here.
Can you test these builds? I think I might have sorted it. Looks like I was missing something specific to allow shaders to work with the fix we needed to add as of the later mc version. Those builds should work on 1.21.9 + 1.21.10
Testing right now, will report back in a minute.
Edit: Nope, no dice, still invisible with Complementary.
I'm very surprised this doesn't work for you. Can you confirm the Mod version you're using, the exact shader pack and the mods you're using for shaders.
Should let me address any remaining issues
SCRATCH ALL THAT - IT WORKS!
I was a dumbass and booted 1.21.8, not .10 where I got your test version - so I assumed it just didn't work!
Could we get an update for 1.21.8 as well? This is the version we ended up using on our server for mod compatibility reasons.
Below is my original comment if you are still interested in investigating why some shaders work while others don't:
the Mod version you're using, the exact shader pack and the mods you're using for shaders.
advanced-xray-fabric-21.9.1-beta.1+shader_test for Minecraft 1.21.10,
ComplementaryUnbound_r5.6.1 + EuphoriaPatches_1.7.2 (but the shader pack is not really that big of a specific, it used to work with "most" shaders. See below for more info.)
iris-fabric-1.9.6+mc1.21.9
I'm not sure if this is a relevant factor but I've only had Nvidia GPUs throughout my use over the years.
I've confirmed the following shaders as working on 1.21 / not working on 1.21.10 with xray:
- Chocapic13 V9.1 Extreme Beta 5
- rethinking-voxels_r0.1-beta6a (also based on complementary)
- SEUS Renewed v1.0.1
- Sildur's Vibrant Shaders v1.32 Extreme-VL
- Seamatis' Vibrant Shaders v2.1 Ultra (extremely ancient shader)
NOT working on 1.21 either:
- SoftVoxelsLite_v2.0
- BSL_v8.1.02.3
