GTNewHorizons/Angelica

Flickering tile entities due to render pass delay

Closed this issue · 18 comments

Your GTNH Discord Username

No response

Mod Version

1.0.0-alpha36a

Java Version

Java 21

Graphics Card Vendor

NVidia

Bug Report

Upon updating to 2.6.0 Beta 3 from Beta 2 (I downgraded to 1.0.0-alpha35 but still had issue), Angelica seems to have flickering graphics, myself and a few others on the discord have the same issue.

When I remove the Angelica mod, the issue goes away.

My settings are default

Here's a video:
https://github.com/GTNewHorizons/Angelica/assets/4002351/cc5d2679-20fb-4b7d-98a1-f9c53fe9fd23

Mod List or GTNH Pack Version

Standard complement

Final Checklist

  • I have searched the issues and haven't found a similar issue.
  • I have read the known incompatibilities and this is not related to one of those.
  • I am running an officially released version. (Or, if I've compiled it myself I plan to fix the issue)
  • This issue is not related to a feature that is disabed by default - Shaders, MCPF, etc. [They'll be enabled when they're ready for testing]

I probably logged my issue in the wrong repository, but mine also includes a video: GTNewHorizons/GT-New-Horizons-Modpack#15955

Seems to go away when I disable "Always Defer Chunk Updates" but the whole game becomes a stutter fest

@rbraunm

Upon investigating, tile entities only render on pass 0 and not pass 1 and I suspect GTNH/my world is very costly frame-wise so when it renders pass 1 (Which is semi-transparent entities) and renders pass 0 (Opaque entities), it causes a flicker since the block there is a heavy delay.

This flickering only occurs when "Always Defer Chunk Updates" is ticked - Which states there's visual issues so i guess it's expected.

A temporary work around:

Angelica\src\main\java\me\jellysquid\mods\sodium\client\render\SodiumWorldRenderer.java

    private void renderTE(TileEntity tileEntity, float partialTicks) {
        if(!checkBEVisibility(tileEntity))
            return;

        try {
            TileEntityRendererDispatcher.instance.renderTileEntity(tileEntity, partialTicks);
        } catch(RuntimeException e) {
            if(tileEntity.isInvalid()) {
                SodiumClientMod.logger().error("Suppressing crash from invalid tile entity", e);
            } else {
                throw e;
            }
        }
    }

    public void renderTileEntities(EntityLivingBase entity, ICamera camera, float partialTicks) {
        for (TileEntity tileEntity : this.chunkRenderManager.getVisibleTileEntities()) {
            renderTE(tileEntity, partialTicks);
        }

        for (TileEntity tileEntity : this.globalTileEntities) {
            renderTE(tileEntity, partialTicks);
        }
    }

Basically the above code will render tile entities in both passes (I know this is detrimental to performance) but it works as-expected and flicker is no more. When I disable "Always Defer Chunk Updates" the tile entities flicker is gone but it feels really choppy.

When only rendering visible title entities in both passes, some clearly visible entities flicker well others are fine so the code above renders all entities.

This needs someone who knows more about Angelica/Minecraft internals to fix this, at the moment I am happy with this workaround.

I'm experiencing this issue too (also running an NVIDIA card, maybe that's related to the issue? I'll try doing some testing on integrated graphics later Update: Flickering occurs for me on both my main PC (NVIDIA RTX 3090), and my laptop (both on the discrete RTX 3050 and integrated AMD graphics).

Interestingly, even with "Always Defer Chunk Updates" disabled, the issue still occurs for me, although a lot less frequently.

I also have this issue. I am running Linux with AMD RX5600XT. My video has much worse flickering. This happens with both "Always Defer Chunk Updates" disabled or enabled but it is much worse enabled.

GTNH-2.6.0-flicker.mov

I think this issue may have been triggered by the changes to Carpenter's Blocks' rendering after version 3.5.1. Flickering is present with 3.5.2-pre and 3.5.3. Rolling back to 3.5.1 resolves the flickering in pack version 2.6.0.

Were you able to consistently get the flickering to happen?

Were you able to consistently get the flickering to happen?

Yes, myself and another player. Flickering was constant for us only after updating from 2.6.0-beta-1 to 2.6.0. We tested Angelica versions 1.0.0-alpha35, 1.0.0-alpha36a, and 1.0.0-alpha45, all had the same result. Which made me think it wasn't solely caused by Angelica. The flicker also went away with @jusvit's quick fix (only tested with 1.0.0-alpha45), if that gives any insight as to what might be going on.

Can you zip up your world so we can see if we get it too?

Can you zip up your world so we can see if we get it too?

Here's the copy I tested with. (Just don't judge me too harshly on the unorganized base 🙃). Any location near 1544, ~70, 2124 produces flickering of non opaque tile entities for us.

Thanks!

And confirmed that the issue exists. Now to figure out a proper fix

@Dasfaust When did you start to notice it?
Did you place any block and then it started to happen?

@Dasfaust When did you start to notice it? Did you place any block and then it started to happen?

Flickering was immediate after updating from pack version 2.6.0-beta-1 to 2.6.0, so I'm not sure how to reproduce it from scratch.

Damn. It seems to be a tile entity's rendering that is causing is as it doesnt start until I get near your base

@jusvit @rbraunm @TrueKuehli
can one of you zip up your world so we can check it out? We believe its a tile entity causing this and need to track down which one.

The new version of Carpenter's Blocks seems to fix the issue for me, thank you so much for your work @Dasfaust and @Caedis!

I seem to have same problem, but on GT version 2.6.1, angelica 1.0.0-alpha50 and Carpenter's Blocks 3.5.5-GTNH. After disabling angelica the flickering stopped, so angelica might still be bugged.
Another issue had similar problem, but since its closed, I decided to write this here ( GTNewHorizons/GT-New-Horizons-Modpack#15955 ).