EntityCulling icon indicating copy to clipboard operation
EntityCulling copied to clipboard

Entities can become invisible - Fabric 1.19/1.18.2

Open ImpSpy2 opened this issue 2 years ago • 5 comments

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.

https://user-images.githubusercontent.com/61091635/179632464-7faac3b7-e99d-4e74-87a8-10d06cabc9f2.mp4

https://user-images.githubusercontent.com/61091635/179632480-252ab362-7588-4d2f-a70b-7b7f5504e82a.mp4

ImpSpy2 avatar Jul 19 '22 00:07 ImpSpy2

Same thing happens with me

AmbassadorLaZer avatar Jul 19 '22 00:07 AmbassadorLaZer

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

tr7zw avatar Jul 22 '22 13:07 tr7zw

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

Kaleidio avatar Sep 14 '22 14:09 Kaleidio

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

Kaleidio avatar Sep 14 '22 14:09 Kaleidio

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.

tr7zw avatar Sep 14 '22 14:09 tr7zw

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

Kaleidio avatar Feb 02 '23 13:02 Kaleidio

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 https://github.com/tr7zw/FirstPersonModel/issues/56#issuecomment-1412659175 https://github.com/tr7zw/ItemSwapper/issues https://github.com/tr7zw/EntityCulling/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).

tr7zw avatar Feb 02 '23 13:02 tr7zw

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

Kaleidio avatar Feb 02 '23 15:02 Kaleidio

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.

tr7zw avatar Feb 02 '23 15:02 tr7zw

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

Kaleidio avatar Feb 02 '23 16:02 Kaleidio

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.

tr7zw avatar Feb 12 '23 02:02 tr7zw

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.

tr7zw avatar Feb 13 '23 16:02 tr7zw

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.

tr7zw avatar Feb 13 '23 19:02 tr7zw

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.

skadlig avatar Feb 17 '23 10:02 skadlig

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.

tr7zw avatar Feb 18 '23 21:02 tr7zw

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.

tr7zw avatar Feb 18 '23 21:02 tr7zw