Entity Culling Fabric/Forge

Entity Culling Fabric/Forge

80M Downloads

Entities can become invisible - Fabric 1.19/1.18.2

ImpSpy2 opened this issue · 16 comments

commented

It seems to happen in very specific situations as I have tried doing the same test on another world and could not reproduce the issue however this problem has happened multiple times before on different worlds on 1.18.2. I can consistently reproduce the issue on Fabric 1.19 using the seed 2479860311489992403 and the village house shown in the video's below at the coordinates: -773 73 621.

In the second video a villager behind the glass temporarily turns invisible so it's not just entities in that corner of the village house. This is the only mod I have installed along with Fabric API.

Test.1.mp4
Test.2.mp4
commented

Same thing happens with me

commented

Arg these edge cases are horrible to debug, but thanks for finding a setup to reproduce it. Will look into it soon.

commented

This issue is also present on 1.16.5 forge for me. seems to be that if an entity gets spawned behind a block with alpha it will remain invisible for whatever reason. it can also happen if a player enters a chunk the same as you but is beside some non full block such as a fence or vines, only occuring if you teleport into said chunk when they are there. the entities involved remain invisible until you restart the game

commented

downgrading the mod seemingly fixes the issue, unsure how far back as of yet.

commented

I haven't done changes to the tracing engine in a long time, and even if an old version happened to not have the bug, then it's probably just because of another bug I fixed. Kind of a rabbit hole this entire thing. Right now looking into obj exports for 3d skin layers, maybe I'll give this one a try after that.

commented

nothing has been attempted on this issue as of yet, has it gone stale? Hope things are going okay for you

commented

the problem is the issue that I'm having in 1.16.5 is not at all an issue only 99% of people will not notice. players legitimately disappear entirely 70% of the time when they hop dimensions, wolves killing sheep whilst being invisible, etcetera. it's an extremely noticeable bug in the 1.16.5 branch. and has been broken since 1.4.0 (1.3.0 was still working.)

we were able to notice the issue in 100% of all cases for the 1.16.5 version of the issue since it carries on. I have a feeling now that it is a separate issue entirely instead of whatever this issue was.

point being, 1.16.5 invisibility is "permanent", whilst this 1.18.2 issue seems to resolve if the entity rounds a corner. so they may be different issues but the 1.16.5 version is extremely noticeable

commented

Then you are having some other kind of issue. This issue is about a really highly specific entity/block constellation, where entities are invisible when they shouldn't be. And since only 2 people reported this so far from millions of downloads, I'd say it is basically unnoticeable for most people.

commented

okay, I'll go open a new issue on what we've been experiencing then

commented

I'm working on 10+ mods at the same time while also finishing my bachelor's degree and working as a developer, so time is limited. And this issue is something where you can easily sink in 5-10 hours of work with no progress on getting it resolved. Combine that with this never being noticed by probably 99% of people, and it becomes really hard to get yourself to invest time into it. Compared that to lower hanging improvements like tr7zw/FirstPersonModel#56 (comment) https://github.com/tr7zw/ItemSwapper/issues #86 https://github.com/tr7zw/WaveyCapes/releases/tag/1.3.0-1.19.3 , where a noticeable improvement for the spent time is guaranteed.
I will get around to it eventually, but finding the missing/misplaced !, -, (...), flipped variable or so inside https://github.com/LogisticsCraft/OcclusionCulling/blob/master/src/main/java/com/logisticscraft/occlusionculling/OcclusionCullingInstance.java is not a fun task. Might require creating more debug visualizations and or unit tests to replicate the issue(at least got more experience in creating visualizations when working on the waveycapes update, where I created, tested and debugged the entire physics code outside of the game).

commented

Also want to note, I haven't forgotten about this, it's just taunting to try to resolve it. But I was able to reproduce it with the provided seed and position, and even after killing all other entities, this is still happening. This kinda points to this not being the cache getting polluted by something, but some actual math/logic error. I might have to write some visualizations to better understand how the code gets this so wrong.

commented

Ok, 2 days+sleepless nights later: I had to write some visualizations to get a better hang of the issue. Recreating the seeds setup results in this:
grafik
As can be seen, one ray clearly reaches the hitbox but got marked as blocked. After a bit of digging, it turns out that setting a block to "blocked" when no ray was reaching it is an issue because the actual block itself never got checked(the implementation doesn't care about the final block). So removing this cache set, suddenly it works:
grafik
So is that the solution? One quick check ingame and... no.
grafik
In this case, the point distribution is an issue. Switching to a different implementation for that results in it working, but it's using an excessive amount of rays.
grafik
grafik
This causes the culling passes from a quick test on the Cubecraft lobby to go from 1-4ms to 4-10ms. This is not a dealbreaker, but depending on the hardware and world this might cause degraded performance. So now the real challenge is to write a better point distribution logic while reducing the total amount. Easier said than done, I guess I'll report back when I managed to get anything working in that regard.

commented

grafik
This is more what I had in mind. Will experiment a bit more with reducing the number of rays(currently it's about twice as many as before for the worst case, hidden), but all obvious edge cases should be resolved by this.

commented

I have the same issue in combination with the create mod in 1.19.2. I have noted contraptions that speed up/catch up when you look at them. It can lead to you falling of them when hit-boxes update.
It also causes train cars to go invisible.

I would rather that some losses in speed over these issues I'm experiencing. I'm happy to see that you are working on it.

commented

I have noted contraptions that speed up/catch up when you look at them.

That sounds like the lerping catching up. It should be noted, the camera view direction is not used at all by this mod. It always culls 360° in all directions, so quickly turning around stuff doesn't pop in.

It also causes train cars to go invisible.

This might be related to this issue.

commented

Anyway, this fixed engine is now in release 1.6.0, so this ticket gets closed. Future issues with 1.6.0+ should go into their own tickets.