Closed afonsolage closed 2 years ago
I was unable to find a way to fix those blue edges on voxel textures. The ugly work around would be just add a pixel off set between each tile, but this is out of scope of this PR.
I need to find a way to don't draw those faces when there is a "visible area" bellow it:
I'll try another approach, since working on shader I have very little information about surrounding voxels.
I was able to have a working height clipping, but I'll not merge this until I figured out a way to use this.
The way it is now, it'll reveal all caves and buildings underneath voxels. This should be trigged only when player is inside some cave/place where there is a floor over his head and only that area should be height clipped
I don't think it'll be possible to do what I wanna do, due to how voxel faces are merged, since sometimes the clipping will hit a face and I wanna only clip half of it
I'll close this, since another approach will be needed
Finally I think I've figured out a way to make this work. Still needs some tweaks, but this is the general idea:
This is a mix of flood-fill to detect visible areas (and voxels touching those visible areas) and shader to clip voxels that shouldn't be rendered.
Next todo:
I fixed the problem with some faces not being rendered by switching to use an texture 1d to map which voxels should be visible:
But even tho the flood fill is fine, I'm not being able to properly read this info on shader.
Ok it's almost there. Now I just need to figure out how to deal with those edge cases, where the top voxel is clipped since it's on the clip map.
Ok, I made some progress:
Now I need to fix a bug when character move out of the (0,0,0) chunk
app-2022-08-21-14-00-47_2.webm
Just need fix one more bug and I think it's good to be merged (also, after some clean up)
There is some clean up to do, but I'll do it in another PR, since this is good to go.
Add height clipping based on character height. This allows the character to enter inside caves and also prevents the orbit camera from spotting objects outside the character view