31 lines
No EOL
905 B
Text
31 lines
No EOL
905 B
Text
/* Copyright (c) 2023, Sascha Willems
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
*/
|
|
#version 460
|
|
|
|
#extension GL_EXT_ray_tracing : require
|
|
#extension GL_GOOGLE_include_directive : require
|
|
#extension GL_EXT_nonuniform_qualifier : require
|
|
#extension GL_EXT_buffer_reference2 : require
|
|
#extension GL_EXT_scalar_block_layout : require
|
|
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
|
|
|
|
hitAttributeEXT vec2 attribs;
|
|
|
|
layout(binding = 3, set = 0) uniform sampler2D image;
|
|
|
|
#include "bufferreferences.glsl"
|
|
#include "geometrytypes.glsl"
|
|
|
|
void main()
|
|
{
|
|
Triangle tri = unpackTriangle(gl_PrimitiveID, 32);
|
|
vec4 color = texture(image, tri.uv);
|
|
// If the alpha value of the texture at the current UV coordinates is below a given threshold, we'll ignore this intersection
|
|
// That way ray traversal will be stopped and the miss shader will be invoked
|
|
if (color.a < 0.9) {
|
|
ignoreIntersectionEXT;
|
|
}
|
|
} |