Sodium

Sodium

35M Downloads

Some blocks/chunks flashing

UsainSrht opened this issue ยท 15 comments

commented

Version information

sodium-fabric-mc1.17.1-0.3.3+build.8

Expected Behavior

Normal game without flashing

Actual Behavior

Game flashing

Reproduction Steps

  1. join a world
  2. fly around / rotate your head
  3. see flashing

Java version

Java 16

CPU

Incel Core 2 Duo E7500

GPU

AMD RADEON HD 5500

Additional information

Javaw.2021-11-29.18-55-02-659-1.mp4
commented

dis happens to me

commented

version: Sodium 0.4.0-alpha5

java: AdoptJDK17

cpu: fx 6300

gpu: amd hd 8490

same here

SNpYFfzIFB.mp4
commented

Happens to me as well.

yea it happens to my i thought it was a pc issue lol

commented

Happens to me as well.

commented

Looks like the problem has to do with the player being located at extreme coordinate values.

commented

I was several hundred thousand blocks away from spawn. Tried with the same mods near spawn in a singleplayer world and did not experience the issue.

commented

We might just want to revert the problematic commit if it's indeed the culprit. The performance improvement was minor & it complicates rendering. A more complete solution in the future would be to use an octree for storing chunks & recursively check nodes against the frustum (an idea that has been on my radar for some time) but I haven't gotten around to it, like most other things...

commented

Checking git bisect showed it being caused by e7afa14, after some further testing it specifically seems to be related to the frustum.intersectAab part

// HACK: Regions need to be slightly larger than their real volume
// Otherwise, the first node in the iteration graph might be incorrectly culled when the camera
// is at the extreme end of a region
int visflag = frustum.intersectAab(x - REGION_EXCESS, y - REGION_EXCESS, z - REGION_EXCESS,
x + (REGION_WIDTH << 4) + REGION_EXCESS, y + (REGION_HEIGHT << 4) + REGION_EXCESS, z + (REGION_LENGTH << 4) + REGION_EXCESS);
this.visibility = switch (visflag) {
case FrustumIntersection.INSIDE -> RenderRegionVisibility.INSIDE;
case FrustumIntersection.INTERSECT -> RenderRegionVisibility.INTERSECT;
default -> RenderRegionVisibility.OUTSIDE;
};

Setting visflag to always return FrustumIntersection.INSIDE does appear to completely stop all flashing, but this obviously has some performance implications, and I don't know enough about JOML or Sodium rendering to suggest a real fix.

commented

Looks like the problem has to do with the player being located at extreme coordinate values.

Yes you're right.

commented

Apologies for being technically illiterate, but will whatever fix you're thinking of be in a new version that I can see from Curseforge? Or is there something different I need to do?

commented

Checking git bisect showed it being caused by e7afa14, after some further testing it specifically seems to be related to the frustum.intersectAab part

// HACK: Regions need to be slightly larger than their real volume
// Otherwise, the first node in the iteration graph might be incorrectly culled when the camera
// is at the extreme end of a region
int visflag = frustum.intersectAab(x - REGION_EXCESS, y - REGION_EXCESS, z - REGION_EXCESS,
x + (REGION_WIDTH << 4) + REGION_EXCESS, y + (REGION_HEIGHT << 4) + REGION_EXCESS, z + (REGION_LENGTH << 4) + REGION_EXCESS);
this.visibility = switch (visflag) {
case FrustumIntersection.INSIDE -> RenderRegionVisibility.INSIDE;
case FrustumIntersection.INTERSECT -> RenderRegionVisibility.INTERSECT;
default -> RenderRegionVisibility.OUTSIDE;
};

Setting visflag to always return FrustumIntersection.INSIDE does appear to completely stop all flashing, but this obviously has some performance implications, and I don't know enough about JOML or Sodium rendering to suggest a real fix.

uh how do i do this im dumb as shit lmao

commented

Just thought I'd add my 2 cents here as well. This flickering seems to increase gradually based on how far away the player is from x0 z0, it's pretty noticeable from x1,000,000 x1,000,000 onwards and basically happens constantly from around x10,000,000 y10,000,000 onwards.

Note that I'm using Fabulously Optimized 3.1.0-alpha.1 which uses Sodium 0.4.0-alpha5+build.9.

https://www.youtube.com/watch?v=PSM7XvzAMrw

(Uploaded to YouTube because the file size was too big for GitHub, note that higher resolutions might still be processing on their side)

commented

https://www.youtube.com/watch?v=CjYvWDXC_vI

This is from an older version but the latest version 1.18.1, Java 17, latest Fabric API etc. still has this issue. This makes Sodium unusable for me. Please fix.

commented

is there a way for me to fix this yet?

commented

Use build 750 (if e7afa14 actually caused this issue)
Download from here: github.com/CaffeineMC/sodium-fabric/actions/runs/1491875735
I can upload my copy of the build if you can't download it