Right now, the depth filter achieves a fairly smooth isosurface, but to be perfectly honest, the artifacts are becoming noticeable.
Artifact 1: Pull-away
I'm calling this artifact "pull-away," as it's a result of the filter being unable to continue past the edges of the fluid and thus "pulling" the edges towards the center of the sphere. This causes a false edge and the normals to reach a grazing angle a little bit before the edges are actually apparent.
It is exacerbated by a higher filter size.
Artifact 2: Aliasing
When the angle in which an isosurface is viewed becomes too perpendicular to the general normal of the fluid, the filter will repeatedly reject surrounding pixels causing a generational effect of aliasing between iterations--ultimately leading to invalid normals and a black specular reflection.
This image shows the isosurface when the angle is less intense, as you can see--specular highlights are visible.
Artifact 3: Border sample failure
When the filter reaches the edge of the screen, it oversamples itself and returns an incorrect normal.
Artifact 4: Surface decay when inside a volume of fluid
Ultimately, our main goal for this specific artifact is to simply not render any particles when in water. We could do this by running a parallel reduction-esque algorithm by checking if the overall depth is lower than some threshold.
Scope
Pull-away
Generally, we may want to move towards a more "mathematically sound" filter framework. The reason being is that those filters can have mathematically proven properties that we can rely on in order to make sure that our filter is sound. In particular, we could rely on linear shift invariance and separability. Heavily on the separability--they allow us to reduce complexity from O(M^2 x N^2) to O(2 x N * M^2)
We also want to look into repeating the depth value when a tap goes out of bounds. We could do this with some sort of distance metric which falls back on the latest one.
We're probably going to want to use a compute shader for further control over the filter. We could accelerate it by using thread-group-shared memory.
Aliasing
We'll likely have to use the dynamic depth range adjustment proposed in Truong, et al. 2018.
Border sample failure
Likely will be fixed as a side effect of fixing pull-away.
Surface decay
A fast, GPU-driven method of fixing this would be to run a 1x1 min mipchain of the depth buffer, and using it to issue/not issue any more drawcalls.
The other way would to be copying the 1x1 texture to the CPU, which is slow.. so slow. It's not that much of an issue now anyways.
Context
Right now, the depth filter achieves a fairly smooth isosurface, but to be perfectly honest, the artifacts are becoming noticeable.
Artifact 1: Pull-away
I'm calling this artifact "pull-away," as it's a result of the filter being unable to continue past the edges of the fluid and thus "pulling" the edges towards the center of the sphere. This causes a false edge and the normals to reach a grazing angle a little bit before the edges are actually apparent.
It is exacerbated by a higher filter size.
Artifact 2: Aliasing
When the angle in which an isosurface is viewed becomes too perpendicular to the general normal of the fluid, the filter will repeatedly reject surrounding pixels causing a generational effect of aliasing between iterations--ultimately leading to invalid normals and a black specular reflection.
This image shows the isosurface when the angle is less intense, as you can see--specular highlights are visible.
Artifact 3: Border sample failure
When the filter reaches the edge of the screen, it oversamples itself and returns an incorrect normal.
Artifact 4: Surface decay when inside a volume of fluid
Ultimately, our main goal for this specific artifact is to simply not render any particles when in water. We could do this by running a parallel reduction-esque algorithm by checking if the overall depth is lower than some threshold.
Scope
Pull-away
Aliasing
Border sample failure
Surface decay
Acceptance Criteria
todo
Other