|
@@ -11,7 +11,8 @@ float hash_3d(vec3 p) {
|
|
|
|
|
|
float compute_alpha_hash_threshold(vec3 pos, float hash_scale) {
|
|
|
vec3 dx = dFdx(pos);
|
|
|
- vec3 dy = dFdx(pos);
|
|
|
+ vec3 dy = dFdy(pos);
|
|
|
+
|
|
|
float delta_max_sqr = max(length(dx), length(dy));
|
|
|
float pix_scale = 1.0 / (hash_scale * delta_max_sqr);
|
|
|
|
|
@@ -32,9 +33,9 @@ float compute_alpha_hash_threshold(vec3 pos, float hash_scale) {
|
|
|
1.0 - ((1.0 - a_interp) * (1.0 - a_interp) / (2.0 * min_lerp * (1.0 - min_lerp))));
|
|
|
|
|
|
float alpha_hash_threshold =
|
|
|
- (lerp_factor < (1.0 - min_lerp)) ? ((lerp_factor < min_lerp) ? cases.x : cases.y) : cases.z;
|
|
|
+ (a_interp < (1.0 - min_lerp)) ? ((a_interp < min_lerp) ? cases.x : cases.y) : cases.z;
|
|
|
|
|
|
- return clamp(alpha_hash_threshold, 0.0, 1.0);
|
|
|
+ return clamp(alpha_hash_threshold, 0.00001, 1.0);
|
|
|
}
|
|
|
|
|
|
#endif // ALPHA_HASH_USED
|