rtx: fix translucent things casting shadows (they shouldn't for now)

This commit is contained in:
Ivan 'provod' Avdeev 2021-10-31 12:03:52 -07:00 committed by Ivan Avdeev
parent b3465ceb30
commit 3f12a42432
5 changed files with 9 additions and 2 deletions

View File

@ -298,7 +298,7 @@ void main() {
const uint sbt_stride = 0;
const uint miss_index = 0;
const float L = 10000.;
traceRayEXT(tlas, flags, GEOMETRY_BIT_OPAQUE,
traceRayEXT(tlas, flags, GEOMETRY_BIT_OPAQUE | GEOMETRY_BIT_REFRACTIVE,
sbt_offset, sbt_stride, miss_index,
origin, 0., direction, L,
PAYLOAD_LOCATION_OPAQUE);

View File

@ -23,6 +23,7 @@ layout (constant_id = 3) const uint MAX_VISIBLE_SURFACE_LIGHTS = 255;
#define GEOMETRY_BIT_OPAQUE 0x01
#define GEOMETRY_BIT_ADDITIVE 0x02
#define GEOMETRY_BIT_REFRACTIVE 0x04
#define SHADER_OFFSET_MISS_REGULAR 0
#define SHADER_OFFSET_MISS_SHADOW 1

View File

@ -34,6 +34,8 @@ typedef struct {
enum {
MaterialMode_Opaque,
MaterialMode_Opaque_AlphaTest,
MaterialMode_Refractive,
// TODO MaterialMode_Subtractive,
MaterialMode_Additive,
} material_mode;
} vk_ray_draw_model_t;

View File

@ -339,7 +339,7 @@ void VK_RayFrameAddModel( vk_ray_model_t *model, const vk_render_model_t *render
case kRenderTransColor:
case kRenderTransTexture:
HACK_reflective = true;
draw_model->material_mode = MaterialMode_Opaque_AlphaTest; // FIXME add new translucency mode
draw_model->material_mode = MaterialMode_Refractive;
break;
// Additive blending: C = SRC * alpha + DST

View File

@ -523,6 +523,10 @@ static void prepareTlas( VkCommandBuffer cmdbuf ) {
inst[i].instanceShaderBindingTableRecordOffset = SHADER_OFFSET_HIT_ALPHA_TEST,
inst[i].flags = VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR;
break;
case MaterialMode_Refractive:
inst[i].mask = GEOMETRY_BIT_REFRACTIVE;
inst[i].flags = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR;
break;
case MaterialMode_Additive:
inst[i].mask = GEOMETRY_BIT_ADDITIVE;
inst[i].instanceShaderBindingTableRecordOffset = SHADER_OFFSET_HIT_ADDITIVE,