-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c3b5c4
commit 54e6fe0
Showing
5 changed files
with
1,680 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: https://www.lwjgl.org/license | ||
*/ | ||
#version 460 | ||
#extension GL_EXT_ray_tracing : enable | ||
|
||
layout(location = 0) rayPayloadInEXT bool payload; | ||
|
||
void main(void) { | ||
payload = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: https://www.lwjgl.org/license | ||
*/ | ||
#version 460 | ||
#extension GL_EXT_ray_tracing : enable | ||
|
||
layout(location = 0) rayPayloadEXT bool payload; | ||
layout(binding = 0, set = 0) uniform accelerationStructureEXT acc; | ||
layout(binding = 1, set = 0, rgba8) uniform image2D image; | ||
layout(binding = 2, set = 0) uniform Camera { | ||
mat4 projInverse; | ||
mat4 viewInverse; | ||
} cam; | ||
|
||
void main(void) { | ||
vec2 px = vec2(gl_LaunchIDEXT.xy) + vec2(0.5); | ||
vec2 ndc = (px / vec2(gl_LaunchSizeEXT.xy)) * 2.0 - vec2(1.0); | ||
vec3 origin = cam.viewInverse[3].xyz; | ||
vec4 target = cam.projInverse * vec4(ndc, 0.0, 1.0); | ||
vec4 direction = cam.viewInverse * vec4(normalize(target.xyz), 0.0); | ||
uint rayFlags = gl_RayFlagsOpaqueEXT | gl_RayFlagsCullBackFacingTrianglesEXT; | ||
float tMin = 0.1; | ||
float tMax = 100.0; | ||
traceRayEXT( | ||
acc, // acceleration structure | ||
rayFlags, // rayFlags | ||
0xFF, // cullMask | ||
0, // sbtRecordOffset | ||
0, // sbtRecordStride | ||
0, // missIndex | ||
origin, // ray origin | ||
tMin, // ray min range | ||
direction.xyz, // ray direction | ||
tMax, // ray max range | ||
0 // payload (location = 0) | ||
); | ||
imageStore(image, ivec2(gl_LaunchIDEXT), payload ? vec4(1.0) : vec4(0.0)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright LWJGL. All rights reserved. | ||
* License terms: https://www.lwjgl.org/license | ||
*/ | ||
#version 460 | ||
#extension GL_EXT_ray_tracing : enable | ||
|
||
layout(location = 0) rayPayloadInEXT bool payload; | ||
|
||
void main(void) { | ||
payload = false; | ||
} |
Oops, something went wrong.