Fix alpha hash by correcting typos and doing calculations in object space

This commit is contained in:
clayjohn 2022-11-14 17:57:49 -08:00
parent aa4c286808
commit 81d8b502cc
3 changed files with 8 additions and 5 deletions

View file

@ -826,7 +826,8 @@ void fragment_shader(in SceneData scene_data) {
// alpha hash can be used in unison with alpha antialiasing
#ifdef ALPHA_HASH_USED
if (alpha < compute_alpha_hash_threshold(vertex, alpha_hash_scale)) {
vec3 object_pos = (inverse(read_model_matrix) * inv_view_matrix * vec4(vertex, 1.0)).xyz;
if (alpha < compute_alpha_hash_threshold(object_pos, alpha_hash_scale)) {
discard;
}
#endif // ALPHA_HASH_USED