Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flawed concept of occlusion culling #30

Open
stonar96 opened this issue May 13, 2022 · 0 comments
Open

Flawed concept of occlusion culling #30

stonar96 opened this issue May 13, 2022 · 0 comments

Comments

@stonar96
Copy link

stonar96 commented May 13, 2022

By taking a quick look at your code I noticed that you do a ray cast for each block corner (8 per block). However, based on that you cannot decide whether or not a block is visible. Take a look at the following picture for example.

grafik

All of the stone block corners are occluded by the red walls, thus your algorithm wouldn't reveal the block although I can see it. In fact, with your approach, you would need infinite raycasts per block to determine whether or not a block is visible. One correct alternative is to use a real occlusion culling algorithm, or you make the requirement stricter, namely that all 8 rays must be blocked by one and the same convex shape consisting of one or multiple connected blocks. I have implemented something similar (even with just one ray cast per block) here.

On a side note, the performance of this mod can be drastically improved because you don't need to ray cast blocks that aren't exposed to air at all. For these blocks, you only need to do a block update when an adjacent block is broken (i.e. the standard Anti-Xray approach). You are also ignoring third person camera perspectives.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant