Ray tracing texturing and alpha mapping sample

This commit is contained in:
Sascha Willems 2023-04-09 11:37:44 +02:00
parent 5645c2657f
commit d0ad204606
11 changed files with 49 additions and 8 deletions

View file

@ -1,4 +1,10 @@
/* 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
@ -10,13 +16,15 @@ hitAttributeEXT vec2 attribs;
layout(binding = 3, set = 0) uniform sampler2D image;
#include "_bufferreferences.glsl"
#include "_geometrytypes.glsl"
#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;
}