#version 460 core #extension GL_EXT_nonuniform_qualifier : enable #extension GL_GOOGLE_include_directive : require #include "ray_common.glsl" #include "ray_kusochki.glsl" layout (constant_id = 6) const uint MAX_TEXTURES = 4096; layout (set = 0, binding = 6) uniform sampler2D textures[MAX_TEXTURES]; hitAttributeEXT vec2 bary; void main() { const int instance_kusochki_offset = gl_InstanceCustomIndexEXT; const int kusok_index = instance_kusochki_offset + gl_GeometryIndexEXT; const uint first_index_offset = kusochki[kusok_index].index_offset + gl_PrimitiveID * 3; const uint vi1 = uint(indices[first_index_offset+0]) + kusochki[kusok_index].vertex_offset; const uint vi2 = uint(indices[first_index_offset+1]) + kusochki[kusok_index].vertex_offset; const uint vi3 = uint(indices[first_index_offset+2]) + kusochki[kusok_index].vertex_offset; 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; const uint tex_index = kusochki[kusok_index].texture; const vec4 texture_color = texture(textures[nonuniformEXT(tex_index)], texture_uv); if (texture_color.a < 0.1) { ignoreIntersectionEXT; } }