You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
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.
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.
The text was updated successfully, but these errors were encountered: