raytraced reflections update
This commit is contained in:
@@ -265,7 +265,7 @@ void RenderPath3D_Deferred::Render() const
|
||||
device->BindViewports(1, &vp, cmd);
|
||||
|
||||
device->BindResource(PS, getAOEnabled() ? &rtAO : wiTextureHelper::getWhite(), TEXSLOT_RENDERPATH_AO, cmd);
|
||||
device->BindResource(PS, getSSREnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
device->BindResource(PS, getSSREnabled() || getRaytracedReflectionEnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
wiRenderer::DrawDeferredLights(wiRenderer::GetCamera(), depthBuffer_Copy, rtGBuffer[0], rtGBuffer[1], rtGBuffer[2], cmd);
|
||||
|
||||
device->RenderPassEnd(cmd);
|
||||
|
||||
@@ -232,7 +232,7 @@ void RenderPath3D_Forward::Render() const
|
||||
|
||||
device->BindResource(PS, getReflectionsEnabled() ? &rtReflection : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_REFLECTION, cmd);
|
||||
device->BindResource(PS, getAOEnabled() ? &rtAO : wiTextureHelper::getWhite(), TEXSLOT_RENDERPATH_AO, cmd);
|
||||
device->BindResource(PS, getSSREnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
device->BindResource(PS, getSSREnabled() || getRaytracedReflectionEnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
wiRenderer::DrawScene(wiRenderer::GetCamera(), RENDERPASS_FORWARD, cmd, drawscene_flags);
|
||||
wiRenderer::DrawSky(cmd);
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ void RenderPath3D_TiledDeferred::Render() const
|
||||
RenderDecals(cmd);
|
||||
|
||||
device->BindResource(CS, getAOEnabled() ? &rtAO : wiTextureHelper::getWhite(), TEXSLOT_RENDERPATH_AO, cmd);
|
||||
device->BindResource(CS, getSSREnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
device->BindResource(CS, getSSREnabled() || getRaytracedReflectionEnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
|
||||
|
||||
if (device->CheckCapability(GraphicsDevice::GRAPHICSDEVICE_CAPABILITY_UAV_LOAD_FORMAT_R11G11B10_FLOAT))
|
||||
|
||||
@@ -132,7 +132,7 @@ void RenderPath3D_TiledForward::Render() const
|
||||
|
||||
device->BindResource(PS, getReflectionsEnabled() ? &rtReflection : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_REFLECTION, cmd);
|
||||
device->BindResource(PS, getAOEnabled() ? &rtAO : wiTextureHelper::getWhite(), TEXSLOT_RENDERPATH_AO, cmd);
|
||||
device->BindResource(PS, getSSREnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
device->BindResource(PS, getSSREnabled() || getRaytracedReflectionEnabled() ? &rtSSR : wiTextureHelper::getTransparent(), TEXSLOT_RENDERPATH_SSR, cmd);
|
||||
wiRenderer::DrawScene(wiRenderer::GetCamera(), RENDERPASS_TILEDFORWARD, cmd, drawscene_flags);
|
||||
wiRenderer::DrawSky(cmd);
|
||||
|
||||
|
||||
@@ -130,7 +130,10 @@ void RTReflection_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
n2 = unpack_unitvector(subsets_vertexBuffer_POS[descriptorIndex].Load4(i2 * 16).w);
|
||||
|
||||
float4 uvsets = uv0 * w + uv1 * u + uv2 * v;
|
||||
float3 N = normalize(n0 * w + n1 * u + n2 * v);
|
||||
float3 N = n0 * w + n1 * u + n2 * v;
|
||||
|
||||
N = mul((float3x3)ObjectToWorld3x4(), N);
|
||||
N = normalize(N);
|
||||
|
||||
float4 baseColor;
|
||||
[branch]
|
||||
@@ -152,8 +155,8 @@ void RTReflection_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
// Light sampling:
|
||||
float3 P = WorldRayOrigin() + WorldRayDirection() * RayTCurrent();
|
||||
float3 V = normalize(g_xCamera_CamPos - P);
|
||||
Surface surface = CreateSurface(P, N, V, baseColor, 0.5f, 1, 0, 0);
|
||||
Lighting lighting = CreateLighting(0, 0, 0, 0);
|
||||
Surface surface = CreateSurface(P, N, V, baseColor, material.roughness, 1, material.metalness, material.reflectance);
|
||||
Lighting lighting = CreateLighting(0, 0, GetAmbient(surface.N), 0);
|
||||
|
||||
[loop]
|
||||
for (uint iterator = 0; iterator < g_xFrame_LightArrayCount; iterator++)
|
||||
@@ -205,7 +208,8 @@ void RTReflection_ClosestHit(inout RayPayload payload, in MyAttributes attr)
|
||||
}
|
||||
}
|
||||
|
||||
payload.color = baseColor.rgb * (lighting.direct.diffuse + GetAmbient(surface.N)) + emissiveColor.rgb * emissiveColor.a;
|
||||
LightingPart combined_lighting = CombineLighting(surface, lighting);
|
||||
payload.color = baseColor.rgb * combined_lighting.diffuse + emissiveColor.rgb * emissiveColor.a;
|
||||
|
||||
#else
|
||||
payload.color = float3(1, 0, 0);
|
||||
|
||||
Reference in New Issue
Block a user