New version of the samples and tutorials based on KHR_ray_tracing
This commit is contained in:
parent
2fd15056a2
commit
b6402f0c09
271 changed files with 134108 additions and 2 deletions
35
ray_tracing__advance/shaders/raytrace.rahit
Normal file
35
ray_tracing__advance/shaders/raytrace.rahit
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
#extension GL_EXT_nonuniform_qualifier : enable
|
||||
#extension GL_EXT_scalar_block_layout : enable
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
|
||||
#include "random.glsl"
|
||||
#include "raycommon.glsl"
|
||||
#include "wavefront.glsl"
|
||||
|
||||
// clang-format off
|
||||
layout(location = 0) rayPayloadInEXT hitPayload prd;
|
||||
|
||||
layout(binding = 2, set = 1, scalar) buffer ScnDesc { sceneDesc i[]; } scnDesc;
|
||||
layout(binding = 4, set = 1) buffer MatIndexColorBuffer { int i[]; } matIndex[];
|
||||
layout(binding = 1, set = 1, scalar) buffer MatColorBufferObject { WaveFrontMaterial m[]; } materials[];
|
||||
// clang-format on
|
||||
|
||||
void main()
|
||||
{
|
||||
// Object of this instance
|
||||
uint objId = scnDesc.i[gl_InstanceID].objId;
|
||||
|
||||
// Material of the object
|
||||
int matIdx = matIndex[objId].i[gl_PrimitiveID];
|
||||
WaveFrontMaterial mat = materials[objId].m[matIdx];
|
||||
|
||||
if(mat.illum != 4)
|
||||
return;
|
||||
|
||||
if(mat.dissolve == 0.0)
|
||||
ignoreIntersectionEXT();
|
||||
else if(rnd(prd.seed) > mat.dissolve)
|
||||
ignoreIntersectionEXT();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue