mojira.dev
MC-218054

Translucent objects are rendered out of order when not using Fabulous! graphics

Below is a snippet of decompiled 1.16.4 game code, which I annotated by hand:

// If the transparency shader is defined (fabulous graphis or better)
  if (this.transparencyShader != null) {

  // Draw lines to the buffer (entity and block entity stuff)
    immediate.draw(RenderLayer.getLines());
    immediate.draw();
 
  // Compatibility stuff
    ... 
 
  // Start rendering translucents (water, stained glass, slime, honey, etc)
    profiler.swap("translucent");
    this.renderLayer(RenderLayer.getTranslucent(), matrices, d, e, f);
  
  // Tripwire and particle rendering
    ... 

// Else, (if NOT fabulous graphics)
  } else {

  // FIRST start rendering translucents
    profiler.swap("translucent");
    this.renderLayer(RenderLayer.getTranslucent(), matrices, d, e, f);

  // THEN draw lines, still using the translucent profiler
    immediate.draw(RenderLayer.getLines());
    immediate.draw();

  // More string and particle rendering
    ...
  
// End if
  }

 

As you can see, when not using fabulous graphics, the lines are drawn using the translucent profiler, which just happens not to outright break the rendering of particles, nametags, entities, and block entities in the vanilla game. However, it is possible that many of the problems "fixed" by the Fabulous graphics settings are indeed simply because of an error in the normal game code. Furthermore, when using custom shaders, this error unveils itself in a number of seemingly game-breaking ways. The attached examples use custom shaders (Sildur's Vibrant Lite)** with various combinations of translucent blocks and non-translucent objects. These issues are also painstakingly difficult to solve from outside of the game with shader mods such as OptiFine, since it is such a hardcoded vanilla bug. I am working on this issue for the Iris shader mod for Fabric, which is currently in beta development stages. OptiFine specifically happens to have found a way to patch this from the outside, but this is likely because of OptiFine's nature to override the vanilla rendering engine entirely. Iris is a Fabric mod, which means it uses Sponge Mixin to add to the top of the vanilla code, whereas Forge mods like OptiFine tend to tamper with or even completely override Mojang's original code. Because of this fact, it makes sense why a hardcoded bug like the one above is so hard to fix from outside the game using gentle methods like Fabric. I hope that, by taking the time to raise your awareness of this bug, I have encouraged you to spend a few minutes of your day rearranging these lines of code for the benefit of Minecraft Java, the community built around it, and the Fabric MC initiative. Thank you for your time.

**NOTE: In the current build of Iris, all translucents are set to render as if they were water, (for development purposes) but I know this has no effect because, for example, the last screenshot is one that I took before this change showing the same issue. I also provided the translucent block in my hand most of the time to distinguish them.

EDIT: I am currently working to confirm that this is still a bug in the latest snapshots, given the significant changes to shaders and rendering. I will also attempt to do so without the use of modded clients, since the addition of custom shader support may prevent the need.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media][media]
Arisa Bot

⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.

-- I am a bot. This action was performed automatically! Please report any issues on Discord or Reddit

Avoma

This report is invalid as your game was modified when experiencing this issue. In the attachments you've provided, I can see that you're using modifications and the bug tracker only handles reports that can be reproduced in a vanilla environment. If the problem persists without the use of mods, feel free to create a new report. Additionally, please see the Bug Tracker Guidelines for the minimum standards when submitting a ticket.

pine1needle

However, it is possible that many of the problems "fixed" by the Fabulous graphics settings are indeed simply because of an error in the normal game code.

The reporter is claiming that this might have effects on vanilla. Thus, this report should probably not be resolved as invalid. Instead, this report should be marked as plausible so that Mojang can tell us whether or not the order of these method calls is intentional.

ampolive

Can confirm. The code can be found in net.minecraft.client.renderer.LevelRenderer#renderLevel(...) using Mojang mappings:

...
        if (this.transparencyChain != null) {
            $$21.endBatch(RenderType.lines());
            $$21.endBatch();
            ...
            $$8.popPush("translucent");
            this.renderChunkLayer(RenderType.translucent(), $$0, $$11, $$12, $$13, $$7);
            ...
        } else {
            $$8.popPush("translucent");
            ...
            this.renderChunkLayer(RenderType.translucent(), $$0, $$11, $$12, $$13, $$7);
            $$21.endBatch(RenderType.lines());
            $$21.endBatch();
            ...
        }
...
migrated

This should probably be marked as related to MC-188529 and alike, even if those are Won't Fix. This report is currently pretty hard to find and those links would definitely help.

migrated

(Unassigned)

Confirmed

Rendering

color, graphics, java, java-edition, rendering, rendering-bug, shaders, translucency, transparency

1.16.5, 21w08b, 1.18, 1.18.2, 1.19.2, 22w46a

Retrieved