raytraced shadow update
This commit is contained in:
@@ -13,7 +13,6 @@ Texture2D<float4> subsets_textures[] : register(t0, space2);
|
||||
Buffer<uint> subsets_indexBuffer[] : register(t0, space3);
|
||||
Buffer<float2> subsets_vertexBuffer_UVSETS[] : register(t0, space4);
|
||||
|
||||
typedef BuiltInTriangleIntersectionAttributes MyAttributes;
|
||||
struct RayPayload
|
||||
{
|
||||
float color;
|
||||
@@ -33,9 +32,9 @@ void RTAO_Raygen()
|
||||
float seed = g_xFrame_Time;
|
||||
|
||||
RayDesc ray;
|
||||
ray.TMin = 0.1;
|
||||
ray.TMin = 0.01;
|
||||
ray.TMax = rtao_range;
|
||||
ray.Origin = P;
|
||||
ray.Origin = P + N * 0.01;
|
||||
|
||||
RayPayload payload;
|
||||
payload.color = 0;
|
||||
@@ -61,13 +60,13 @@ void RTAO_Raygen()
|
||||
}
|
||||
|
||||
[shader("closesthit")]
|
||||
void RTAO_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTAO_ClosestHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
//payload.color = 0;
|
||||
}
|
||||
|
||||
[shader("anyhit")]
|
||||
void RTAO_AnyHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTAO_AnyHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
float u = attr.barycentrics.x;
|
||||
float v = attr.barycentrics.y;
|
||||
|
||||
@@ -8,7 +8,7 @@ TEXTURE2D(texture_depth_history, float, TEXSLOT_ONDEMAND2);
|
||||
|
||||
RWTEXTURE2D(output, unorm float, 0);
|
||||
|
||||
static const float temporalResponseMin = 0.85;
|
||||
static const float temporalResponseMin = 0.9;
|
||||
static const float temporalResponseMax = 1.0f;
|
||||
static const float temporalScale = 2.0;
|
||||
static const float temporalExposure = 10.0f;
|
||||
|
||||
@@ -24,7 +24,6 @@ Buffer<uint> subsets_indexBuffer[] : register(t0, space3);
|
||||
ByteAddressBuffer subsets_vertexBuffer_RAW[] : register(t0, space4);
|
||||
Buffer<float2> subsets_vertexBuffer_UVSETS[] : register(t0, space5);
|
||||
|
||||
typedef BuiltInTriangleIntersectionAttributes MyAttributes;
|
||||
struct RayPayload
|
||||
{
|
||||
float3 color;
|
||||
@@ -82,9 +81,9 @@ void RTReflection_Raygen()
|
||||
float seed = g_xFrame_Time;
|
||||
|
||||
RayDesc ray;
|
||||
ray.TMin = 0.1;
|
||||
ray.TMin = 0.01;
|
||||
ray.TMax = rtreflection_range;
|
||||
ray.Origin = P;
|
||||
ray.Origin = P + N * 0.01;
|
||||
ray.Direction = normalize(R);
|
||||
|
||||
RayPayload payload;
|
||||
@@ -106,7 +105,7 @@ void RTReflection_Raygen()
|
||||
}
|
||||
|
||||
[shader("closesthit")]
|
||||
void RTReflection_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTReflection_ClosestHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
float u = attr.barycentrics.x;
|
||||
float v = attr.barycentrics.y;
|
||||
@@ -257,7 +256,7 @@ void RTReflection_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
}
|
||||
|
||||
[shader("anyhit")]
|
||||
void RTReflection_AnyHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTReflection_AnyHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
float u = attr.barycentrics.x;
|
||||
float v = attr.barycentrics.y;
|
||||
|
||||
@@ -16,14 +16,13 @@ Texture2D<float4> subsets_textures[] : register(t0, space2);
|
||||
Buffer<uint> subsets_indexBuffer[] : register(t0, space3);
|
||||
Buffer<float2> subsets_vertexBuffer_UVSETS[] : register(t0, space4);
|
||||
|
||||
typedef BuiltInTriangleIntersectionAttributes MyAttributes;
|
||||
struct RayPayload
|
||||
{
|
||||
float color;
|
||||
};
|
||||
|
||||
[shader("raygeneration")]
|
||||
void RTAO_Raygen()
|
||||
void RTShadow_Raygen()
|
||||
{
|
||||
const float2 uv = ((float2)DispatchRaysIndex() + 0.5f) / (float2)DispatchRaysDimensions();
|
||||
const float depth = texture_depth.SampleLevel(sampler_point_clamp, uv, 0);
|
||||
@@ -86,9 +85,9 @@ void RTAO_Raygen()
|
||||
}
|
||||
|
||||
RayDesc ray;
|
||||
ray.TMin = 0.1;
|
||||
ray.TMin = 0.01;
|
||||
ray.TMax = 0;
|
||||
ray.Origin = surface.P;
|
||||
ray.Origin = surface.P + surface.N * 0.01;
|
||||
|
||||
float3 L;
|
||||
|
||||
@@ -226,13 +225,13 @@ void RTAO_Raygen()
|
||||
}
|
||||
|
||||
[shader("closesthit")]
|
||||
void RTAO_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTShadow_ClosestHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
//payload.color = 0;
|
||||
}
|
||||
|
||||
[shader("anyhit")]
|
||||
void RTAO_AnyHit(inout RayPayload payload, in MyAttributes attr)
|
||||
void RTShadow_AnyHit(inout RayPayload payload, in BuiltInTriangleIntersectionAttributes attr)
|
||||
{
|
||||
float u = attr.barycentrics.x;
|
||||
float v = attr.barycentrics.y;
|
||||
@@ -277,7 +276,7 @@ void RTAO_AnyHit(inout RayPayload payload, in MyAttributes attr)
|
||||
}
|
||||
|
||||
[shader("miss")]
|
||||
void RTAO_Miss(inout RayPayload payload)
|
||||
void RTShadow_Miss(inout RayPayload payload)
|
||||
{
|
||||
payload.color += 1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ TEXTURE2D(texture_depth_history, float, TEXSLOT_ONDEMAND2);
|
||||
|
||||
RWTEXTURE2D(output, uint4, 0);
|
||||
|
||||
static const float temporalResponseMin = 0.85;
|
||||
static const float temporalResponseMin = 0.9;
|
||||
static const float temporalResponseMax = 1.0f;
|
||||
static const float temporalScale = 2.0;
|
||||
static const float temporalExposure = 10.0f;
|
||||
|
||||
@@ -10374,37 +10374,37 @@ void Postprocess_RTShadow(
|
||||
|
||||
rtdesc.shaderlibraries.emplace_back();
|
||||
rtdesc.shaderlibraries.back().shader = &shaders[RTTYPE_RTSHADOW];
|
||||
rtdesc.shaderlibraries.back().function_name = "RTAO_Raygen";
|
||||
rtdesc.shaderlibraries.back().function_name = "RTShadow_Raygen";
|
||||
rtdesc.shaderlibraries.back().type = ShaderLibrary::RAYGENERATION;
|
||||
|
||||
rtdesc.shaderlibraries.emplace_back();
|
||||
rtdesc.shaderlibraries.back().shader = &shaders[RTTYPE_RTSHADOW];
|
||||
rtdesc.shaderlibraries.back().function_name = "RTAO_ClosestHit";
|
||||
rtdesc.shaderlibraries.back().function_name = "RTShadow_ClosestHit";
|
||||
rtdesc.shaderlibraries.back().type = ShaderLibrary::CLOSESTHIT;
|
||||
|
||||
rtdesc.shaderlibraries.emplace_back();
|
||||
rtdesc.shaderlibraries.back().shader = &shaders[RTTYPE_RTSHADOW];
|
||||
rtdesc.shaderlibraries.back().function_name = "RTAO_AnyHit";
|
||||
rtdesc.shaderlibraries.back().function_name = "RTShadow_AnyHit";
|
||||
rtdesc.shaderlibraries.back().type = ShaderLibrary::ANYHIT;
|
||||
|
||||
rtdesc.shaderlibraries.emplace_back();
|
||||
rtdesc.shaderlibraries.back().shader = &shaders[RTTYPE_RTSHADOW];
|
||||
rtdesc.shaderlibraries.back().function_name = "RTAO_Miss";
|
||||
rtdesc.shaderlibraries.back().function_name = "RTShadow_Miss";
|
||||
rtdesc.shaderlibraries.back().type = ShaderLibrary::MISS;
|
||||
|
||||
rtdesc.hitgroups.emplace_back();
|
||||
rtdesc.hitgroups.back().type = ShaderHitGroup::GENERAL;
|
||||
rtdesc.hitgroups.back().name = "RTAO_Raygen";
|
||||
rtdesc.hitgroups.back().name = "RTShadow_Raygen";
|
||||
rtdesc.hitgroups.back().general_shader = 0;
|
||||
|
||||
rtdesc.hitgroups.emplace_back();
|
||||
rtdesc.hitgroups.back().type = ShaderHitGroup::GENERAL;
|
||||
rtdesc.hitgroups.back().name = "RTAO_Miss";
|
||||
rtdesc.hitgroups.back().name = "RTShadow_Miss";
|
||||
rtdesc.hitgroups.back().general_shader = 3;
|
||||
|
||||
rtdesc.hitgroups.emplace_back();
|
||||
rtdesc.hitgroups.back().type = ShaderHitGroup::TRIANGLES;
|
||||
rtdesc.hitgroups.back().name = "RTAO_Hitgroup";
|
||||
rtdesc.hitgroups.back().name = "RTShadow_Hitgroup";
|
||||
rtdesc.hitgroups.back().closesthit_shader = 1;
|
||||
rtdesc.hitgroups.back().anyhit_shader = 2;
|
||||
|
||||
@@ -10443,9 +10443,9 @@ void Postprocess_RTShadow(
|
||||
device->SetName(&temp, "rtshadow_temp");
|
||||
|
||||
device->CreateTexture(&desc, nullptr, &temporal[0]);
|
||||
device->SetName(&temporal[0], "rtao_temporal[0]");
|
||||
device->SetName(&temporal[0], "rtshadow_temporal[0]");
|
||||
device->CreateTexture(&desc, nullptr, &temporal[1]);
|
||||
device->SetName(&temporal[1], "rtao_temporal[1]");
|
||||
device->SetName(&temporal[1], "rtshadow_temporal[1]");
|
||||
|
||||
desc.Format = FORMAT_R11G11B10_FLOAT;
|
||||
device->CreateTexture(&desc, nullptr, &normals);
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace wiVersion
|
||||
// minor features, major updates, breaking compatibility changes
|
||||
const int minor = 51;
|
||||
// minor bug fixes, alterations, refactors, updates
|
||||
const int revision = 52;
|
||||
const int revision = 53;
|
||||
|
||||
const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user