Skip to content

Commit

Permalink
Merge branch 'debugVisChanges' into 'main'
Browse files Browse the repository at this point in the history
[REMIX-2105] Adding height value debug view

See merge request lightspeedrtx/dxvk-remix-nv!720
  • Loading branch information
MarkEHenderson committed Feb 23, 2024
2 parents dccd91b + ed1f9fd commit 58bf1a3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/dxvk/rtx_render/rtx_debug_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,16 @@ namespace dxvk {
{DEBUG_VIEW_THIN_FILM_THICKNESS, "Thin Film Thickness"},

{DEBUG_VIEW_IS_BAKED_TERRAIN, "Terrain: Is Baked Terrain (RGS only)"},
{DEBUG_VIEW_TERRAIN_MAP, "Terrain: Cascade Map"},
{DEBUG_VIEW_TERRAIN_MAP_OPACITY, "Terrain: Cascade Map Opacity"},
{DEBUG_VIEW_TERRAIN_MAP, "Terrain: Cascade Map",
"Parameterize via:\n"
"Debug Knob [0]: (rounded down) which texture type to show: \n"
"0: AlbedoOpacity, 1: Normal, 2: Tangent, 3: Height,\n"
"4: Roughness, 5: Metallic, 6: Emissive"},
{DEBUG_VIEW_TERRAIN_MAP_OPACITY, "Terrain: Cascade Map Opacity",
"Parameterize via:\n"
"Debug Knob [0]: (rounded down) which texture type to show: \n"
"0: AlbedoOpacity, 1: Normal, 2: Tangent, 3: Height,\n"
"4: Roughness, 5: Metallic, 6: Emissive"},
{DEBUG_VIEW_CASCADE_LEVEL, "Terrain: Cascade Level (RGS only)"},

{DEBUG_VIEW_VIRTUAL_HIT_DISTANCE, "Virtual Hit Distance"},
Expand Down Expand Up @@ -228,6 +236,7 @@ namespace dxvk {
{DEBUG_VIEW_SCROLLING_LINE, "Scrolling Line"},
{DEBUG_VIEW_POM_ITERATIONS, "POM Iterations"},
{DEBUG_VIEW_POM_DIRECT_HIT_POS, "POM Direct Hit Position (Tangent Space)"},
{DEBUG_VIEW_HEIGHT_MAP, "Height Map Value"},
} };

ImGui::ComboWithKey<CompositeDebugView> compositeDebugViewCombo = ImGui::ComboWithKey<CompositeDebugView>(
Expand Down Expand Up @@ -573,7 +582,7 @@ namespace dxvk {
if (static_cast<CompositeDebugView>(Composite::compositeViewIdx()) != CompositeDebugView::Disabled) {
switch (Composite::compositeViewIdx()) {
case CompositeDebugView::FinalRenderWithMaterialProperties:
m_composite.debugViewIndices = std::vector<uint32_t> { DEBUG_VIEW_POST_TONEMAP_OUTPUT, DEBUG_VIEW_ALBEDO, DEBUG_VIEW_SHADING_NORMAL, DEBUG_VIEW_PERCEPTUAL_ROUGHNESS, DEBUG_VIEW_EMISSIVE_RADIANCE };
m_composite.debugViewIndices = std::vector<uint32_t> { DEBUG_VIEW_POST_TONEMAP_OUTPUT, DEBUG_VIEW_ALBEDO, DEBUG_VIEW_SHADING_NORMAL, DEBUG_VIEW_PERCEPTUAL_ROUGHNESS, DEBUG_VIEW_EMISSIVE_RADIANCE, DEBUG_VIEW_HEIGHT_MAP };
break;
default:
break;
Expand Down Expand Up @@ -748,7 +757,7 @@ namespace dxvk {
ctx->bindResourceView(DEBUG_VIEW_BINDING_INSTRUMENTATION_INPUT, m_instrumentation.view, nullptr);

const ReplacementMaterialTextureType::Enum terrainTextureType = static_cast<ReplacementMaterialTextureType::Enum>(
clamp<uint32_t>(static_cast<uint32_t>(minValue()),
clamp<uint32_t>(static_cast<uint32_t>(m_debugKnob.x),
ReplacementMaterialTextureType::AlbedoOpacity,
ReplacementMaterialTextureType::Count - 1));
Resources::Resource terrain = m_device->getCommon()->getSceneManager().getTerrainBaker().getTerrainTexture(terrainTextureType);
Expand Down
16 changes: 16 additions & 0 deletions src/dxvk/shaders/rtx/algorithm/geometry_resolver.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,22 @@ void geometryResolverVertexOutputDebugView(
}
storeInDebugView(pixelCoordinate, hitPos);
}
#endif
break;
case DEBUG_VIEW_HEIGHT_MAP:
#ifdef OPAQUE_MATERIAL_USE_POM
float heightMapValue = -1.f;
if (materialType == surfaceMaterialTypeOpaque && cb.pomMode != DisplacementMode::Off)
{
const MemoryPolymorphicSurfaceMaterial memoryPolymorphicSurfaceMaterial = surfaceMaterials[surface.surfaceMaterialIndex];
const uint8_t polymorphicType = memoryPolymorphicSurfaceMaterialGetTypeHelper(memoryPolymorphicSurfaceMaterial);
OpaqueSurfaceMaterial opaqueSurfaceMaterial = opaqueSurfaceMaterialCreate(surface.surfaceMaterialIndex, memoryPolymorphicSurfaceMaterial);
if (opaqueSurfaceMaterial.heightTextureIndex != BINDING_INDEX_INVALID) {
heightMapValue = 1.f - pomSampleHeight(opaqueSurfaceMaterial.heightTextureIndex, opaqueSurfaceMaterial.samplerIndex, surfaceInteraction.textureCoordinates);
}
}

storeInDebugView(pixelCoordinate, heightMapValue);
#endif
break;
}
Expand Down
1 change: 1 addition & 0 deletions src/dxvk/shaders/rtx/utility/debug_view_indices.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@

#define DEBUG_VIEW_POM_ITERATIONS 810
#define DEBUG_VIEW_POM_DIRECT_HIT_POS 811
#define DEBUG_VIEW_HEIGHT_MAP 812


enum class CompositeDebugView : uint32_t {
Expand Down

0 comments on commit 58bf1a3

Please sign in to comment.