Pass world positions to computeAnisotropicEllipseAxes().

Fixes #197.
This commit is contained in:
Anton Baskanov 2021-11-10 01:42:34 +07:00 committed by Ivan Avdeev
parent 499559308d
commit 593be43b58
1 changed files with 5 additions and 5 deletions

View File

@ -87,19 +87,19 @@ void main() {
};
const vec3 pos[3] = {
vertices[vi1].pos,
vertices[vi2].pos,
vertices[vi3].pos,
gl_ObjectToWorldEXT * vec4(vertices[vi1].pos, 1.),
gl_ObjectToWorldEXT * vec4(vertices[vi2].pos, 1.),
gl_ObjectToWorldEXT * vec4(vertices[vi3].pos, 1.),
};
const vec2 texture_uv = vertices[vi1].gl_tc * (1. - bary.x - bary.y) + vertices[vi2].gl_tc * bary.x + vertices[vi3].gl_tc * bary.y + push_constants.time * kusochki[kusok_index].uv_speed;
const uint tex_index = kusochki[kusok_index].texture;
const vec3 real_geom_normal = normalize(normalTransformMat * cross(pos[2]-pos[0], pos[1]-pos[0]));
const vec3 real_geom_normal = normalize(cross(pos[2]-pos[0], pos[1]-pos[0]));
const float geom_normal_sign = sign(dot(real_geom_normal, -gl_WorldRayDirectionEXT));
const vec3 geom_normal = geom_normal_sign * real_geom_normal;
// This one is supposed to be numerically better, but I can't see why
const vec3 hit_pos = (gl_ObjectToWorldEXT * vec4(pos[0] * (1. - bary.x - bary.y) + pos[1] * bary.x + pos[2] * bary.y, 1.)).xyz + geom_normal * normal_offset_fudge;
const vec3 hit_pos = pos[0] * (1. - bary.x - bary.y) + pos[1] * bary.x + pos[2] * bary.y + geom_normal * normal_offset_fudge;
//const vec3 hit_pos = gl_WorldRayOriginEXT + gl_WorldRayDirectionEXT * gl_HitTEXT + geom_normal * normal_offset_fudge;
const float ray_cone_width = payload.pixel_cone_spread_angle * payload.t_offset;