-
Notifications
You must be signed in to change notification settings - Fork 2
/
miss.rmiss
37 lines (34 loc) · 960 Bytes
/
miss.rmiss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#version 460
#extension GL_EXT_ray_tracing : require
struct RayPayload {
vec3 color;
vec3 pure_color;
float distance;
vec3 normal;
float reflector;
float opacity;
vec3 pos;
vec3 wro;
vec3 wrd;
float hitt;
bool depth;
};
layout(location = 0) rayPayloadInEXT RayPayload rayPayload;
void main()
{
// View-independent background gradient to simulate a basic sky background
// const vec3 gradientStart = vec3(0.5, 0.6, 1.0);
const vec3 gradientStart = vec3(1.0, 0.5, 0.0);
const vec3 gradientEnd = vec3(0, 0.5, 1.0);
vec3 unitDir = normalize(gl_WorldRayDirectionEXT);
float t = 0.5 * (unitDir.y + 1.0);
rayPayload.color = (1.0-t) * gradientStart + t * gradientEnd;
rayPayload.pure_color = rayPayload.color;
rayPayload.distance = -1;
rayPayload.normal = vec3(0.0f);
rayPayload.reflector = 0.0f;
rayPayload.opacity = 1.0;
rayPayload.wro = vec3(0.0);
rayPayload.wrd = vec3(0.0);
rayPayload.hitt = 0.0;
}