Add SH shading to gaussian splat renderer
This commit is contained in:
@@ -243,7 +243,8 @@ bool BuiltinGaussianSplatPass::PrepareGaussianSplatResources(
|
||||
if (cachedGaussianSplat == nullptr ||
|
||||
cachedGaussianSplat->positions.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->other.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->color.shaderResourceView == nullptr) {
|
||||
cachedGaussianSplat->color.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->sh.shaderResourceView == nullptr) {
|
||||
Debug::Logger::Get().Error(
|
||||
Debug::LogCategory::Rendering,
|
||||
"BuiltinGaussianSplatPass::PrepareGaussianSplatResources failed: gaussian splat GPU cache incomplete");
|
||||
@@ -599,9 +600,10 @@ BuiltinGaussianSplatPass::PassResourceLayout* BuiltinGaussianSplatPass::GetOrCre
|
||||
!passLayout.gaussianSplatPositionBuffer.IsValid() ||
|
||||
!passLayout.gaussianSplatOtherBuffer.IsValid() ||
|
||||
!passLayout.gaussianSplatColorBuffer.IsValid() ||
|
||||
!passLayout.gaussianSplatSHBuffer.IsValid() ||
|
||||
!passLayout.gaussianSplatViewDataBuffer.IsValid()) {
|
||||
return failLayout(
|
||||
"BuiltinGaussianSplatPass prepare-order pass requires sort distance, order, position, other, color, and view-data gaussian splat buffer bindings");
|
||||
"BuiltinGaussianSplatPass prepare-order pass requires sort distance, order, position, other, color, SH, and view-data gaussian splat buffer bindings");
|
||||
}
|
||||
} else if (usage == PassLayoutUsage::BitonicSort) {
|
||||
if (!passLayout.gaussianSplatSortDistanceBuffer.IsValid() ||
|
||||
@@ -1012,7 +1014,11 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
|
||||
|
||||
const RenderResourceCache::CachedGaussianSplat* cachedGaussianSplat =
|
||||
m_resourceCache.GetOrCreateGaussianSplat(m_device, visibleGaussianSplat.gaussianSplat);
|
||||
if (cachedGaussianSplat == nullptr || cachedGaussianSplat->positions.shaderResourceView == nullptr) {
|
||||
if (cachedGaussianSplat == nullptr ||
|
||||
cachedGaussianSplat->positions.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->other.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->color.shaderResourceView == nullptr ||
|
||||
cachedGaussianSplat->sh.shaderResourceView == nullptr) {
|
||||
return fail("BuiltinGaussianSplatPass prepare-order failed: gaussian splat GPU cache is incomplete");
|
||||
}
|
||||
|
||||
@@ -1062,8 +1068,10 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
|
||||
sceneData.cameraData.projection,
|
||||
sceneData.cameraData.view,
|
||||
visibleGaussianSplat.localToWorld.Transpose(),
|
||||
visibleGaussianSplat.localToWorld.Inverse(),
|
||||
Math::Vector4(sceneData.cameraData.worldRight, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldUp, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldPosition, 0.0f),
|
||||
Math::Vector4(
|
||||
static_cast<float>(sceneData.cameraData.viewportWidth),
|
||||
static_cast<float>(sceneData.cameraData.viewportHeight),
|
||||
@@ -1072,7 +1080,7 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
|
||||
Math::Vector4(
|
||||
static_cast<float>(cachedGaussianSplat->splatCount),
|
||||
static_cast<float>(workingSet->sortCapacity),
|
||||
0.0f,
|
||||
3.0f,
|
||||
0.0f)
|
||||
};
|
||||
|
||||
@@ -1095,6 +1103,7 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
|
||||
setLayout.usesGaussianSplatPositionBuffer ||
|
||||
setLayout.usesGaussianSplatOtherBuffer ||
|
||||
setLayout.usesGaussianSplatColorBuffer ||
|
||||
setLayout.usesGaussianSplatSHBuffer ||
|
||||
setLayout.usesGaussianSplatViewDataBuffer)) {
|
||||
return fail("BuiltinGaussianSplatPass prepare-order failed: unexpected descriptor set layout");
|
||||
}
|
||||
@@ -1107,6 +1116,7 @@ bool BuiltinGaussianSplatPass::PrepareVisibleGaussianSplat(
|
||||
setLayout.usesGaussianSplatPositionBuffer ||
|
||||
setLayout.usesGaussianSplatOtherBuffer ||
|
||||
setLayout.usesGaussianSplatColorBuffer ||
|
||||
setLayout.usesGaussianSplatSHBuffer ||
|
||||
setLayout.usesGaussianSplatViewDataBuffer)
|
||||
? visibleGaussianSplat.gaussianSplat
|
||||
: nullptr;
|
||||
@@ -1239,8 +1249,10 @@ bool BuiltinGaussianSplatPass::SortVisibleGaussianSplat(
|
||||
sceneData.cameraData.projection,
|
||||
sceneData.cameraData.view,
|
||||
visibleGaussianSplat.localToWorld.Transpose(),
|
||||
visibleGaussianSplat.localToWorld.Inverse(),
|
||||
Math::Vector4(sceneData.cameraData.worldRight, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldUp, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldPosition, 0.0f),
|
||||
Math::Vector4(
|
||||
static_cast<float>(sceneData.cameraData.viewportWidth),
|
||||
static_cast<float>(sceneData.cameraData.viewportHeight),
|
||||
@@ -1409,8 +1421,10 @@ bool BuiltinGaussianSplatPass::DrawVisibleGaussianSplat(
|
||||
sceneData.cameraData.projection,
|
||||
sceneData.cameraData.view,
|
||||
visibleGaussianSplat.localToWorld.Transpose(),
|
||||
visibleGaussianSplat.localToWorld.Inverse(),
|
||||
Math::Vector4(sceneData.cameraData.worldRight, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldUp, 0.0f),
|
||||
Math::Vector4(sceneData.cameraData.worldPosition, 0.0f),
|
||||
Math::Vector4(
|
||||
static_cast<float>(sceneData.cameraData.viewportWidth),
|
||||
static_cast<float>(sceneData.cameraData.viewportHeight),
|
||||
|
||||
Reference in New Issue
Block a user