Skip to content

Commit 36c918f

Browse files
authored
Add a Gaussian Splat and octomap rendering sample (#1247)
* Add a complex sample showing how to do a simplistic tool that shows a Voxel Point Cloud map using Octomap. Also demonstrates how to use ImGUI in a project with added functionality and positioning of rendered assets. * Add Gaussian splat rendering and GLTF support to octomap sample Extends the octomap sample with three view modes: Octomap, GLTF Regular, and GLTF Splats. Implements splat rendering pipeline with per-instance attributes and premultiplied alpha blending. Adds GLTF mesh rendering with vertex color support. Includes new shader files for splat geometry and fragment evaluation. Updates camera to FirstPerson type for WASD movement. Fixes cube winding order and improves command buffer recording. Adds proper license headers to all new and modified files. * Reformat and reorganize includes in octomap sample Standardizes code formatting with consistent indentation and brace style. Reorders includes alphabetically with core utilities first. Consolidates constructor initializer list to single line. Adjusts spacing and alignment throughout for consistency. * Add explicit submodule update step to all workflow jobs Ensures submodules are fully initialized and updated in each job by adding explicit `git submodule update --init --recursive` command after checkout, complementing the existing `submodules: "recursive"` checkout option. * Fix indentation in .gitmodules for octomap submodule Replaces spaces with tabs to maintain consistent formatting throughout the .gitmodules file. * Add octomap file for complex render sample * Restrict render_octomap sample to platforms with GLFW support * Force Windows to build library as static to hopefully fix CI. * Implement update_overlay method for render_octomap sample Adds update_overlay method override that delegates to custom ImGUI implementation in render() function and executes additional UI callbacks when provided. * Fix header guard naming and exclude octomap submodule from CI checks Renames header guards in ImGUIUtil.h from ORB_SLAM3_IMGUI_H to IMGUI_UTIL_H to match the actual file name. Excludes samples/complex/render_octomap/octomap directory from CI workflow file checks. * Add braces to single-statement conditionals and replace C-style casts with static_cast Improves code style consistency by adding braces to all single-statement if blocks. Replaces C-style casts with appropriate static_cast and reinterpret_cast. Filters out third_party/glfw warnings from clang-tidy output in CI workflow. * Fix indentation in render_octomap sample Replaces leading spaces with tabs to maintain consistent formatting throughout the file. * Refactor ImGUI input handling to use platform-agnostic framework events Replaces GLFW-specific key handling with framework's KeyCode enum for platform-agnostic input. Renames handleKey to handle_key_event to match framework naming conventions. Updates modifier key state tracking to use ImGui's key state. Removes GLFW dependency and platform-specific conditionals from ImGUI implementation. Enables render_octomap sample on all platforms including Android, iOS, and Direct-to-Display. * Update copyright year to 2026 Updates copyright headers across framework components and shaders from 2025 to 2026. * Update copyright years in project files Updated copyright headers across various project files to reflect the year 2026. This ensures consistency and compliance with licensing requirements. * Update Gaussian splatting implementation to follow KHR_gaussian_splatting spec Moves Gaussian splatting attributes from extension object to primitive attributes using KHR_gaussian_splatting namespace. Updates attribute parsing to check KHR_gaussian_splatting:ROTATION, SCALE, OPACITY, and SH_DEGREE_0_COEF_0 in primitive attributes first, with fallback to old draft extension properties and COLOR_0. Simplifies extension parsing logic and removes nested property structures. Updates code examples in tutorial documentation to reflect new attribute structure. * clang-format * fix the compile * Update to latest KHR and use sample map. * Update to show we do not need to use MoltenVK for rendering. * clang-format fixes. * Fix windows having 32bit limit on a static lib. * Allow imgui to update with keyboard nav. fix name.size() >= 5 and add in built spv files so platforms that oddly don't auto build will work. * Fix for keyboard navigation and numpad look handling * clang-format * address Sascha's nit on KHR_gaussian_splatting extension name (Diverges from what we do in GLTF_Loader in the framework, but it's a good idea). * Expand README for Octomap sample to include usage, controls, rendering modes, and key implementation details. * I forgot to add in the complex samples section to nav.adoc along with the rest of the documentation. * address comment. * Address feedback. * Update Gaussian Splat documentation and implementation to include additional attributes and clarifications - Add `:stem:` attribute for mathematical expressions in the documentation. - Clarify SPZ compression details and the use of PLY as raw data storage. - Adjust JSON examples to include new attributes (`antialiased` and `shDegree`). - Switch to `SplatInstance` struct for interleaved data storage in the code. - Expand explanations around projection math, blending, and premultiplied alpha use. - Highlight mandatory depth sorting for correct rendering. * Update to better describe how to add custom UI textures. * clang-format * Address Andreas' comments. Thanks! keep them coming! * clang-format. * try to resolve clang-format * Remove ImGui from the complex render_octomap sample inlcuding the instruction. Move to the Framework imgui Address rest of Andreas' comments. * Address Andreas' latest comments.
1 parent 293e828 commit 36c918f

30 files changed

Lines changed: 3990 additions & 5 deletions

‎.github/workflows/build.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
- uses: actions/checkout@v4
2525
with:
2626
submodules: "recursive"
27+
- name: Update submodules
28+
run: git submodule update --init --recursive
2729
- if: ${{ matrix.platform == 'ubuntu' }}
2830
name: Install RandR headers
2931
run: |
@@ -68,6 +70,8 @@ jobs:
6870
- uses: actions/checkout@v4
6971
with:
7072
submodules: "recursive"
73+
- name: Update submodules
74+
run: git submodule update --init --recursive
7175

7276
- if: ${{ matrix.platform == 'ubuntu' }}
7377
name: Install RandR headers
@@ -97,6 +101,8 @@ jobs:
97101
- uses: actions/checkout@v4
98102
with:
99103
submodules: "recursive"
104+
- name: Update submodules
105+
run: git submodule update --init --recursive
100106
- name: ccache
101107
uses: hendrikmuhs/ccache-action@v1.2.9
102108
with:
@@ -115,6 +121,8 @@ jobs:
115121
- uses: actions/checkout@v4
116122
with:
117123
submodules: "recursive"
124+
- name: Update submodules
125+
run: git submodule update --init --recursive
118126
- name: Install RandR headers
119127
run: |
120128
sudo apt-get update
@@ -139,6 +147,8 @@ jobs:
139147
- uses: actions/checkout@v4
140148
with:
141149
submodules: "recursive"
150+
- name: Update submodules
151+
run: git submodule update --init --recursive
142152

143153
- name: set up JDK
144154
uses: actions/setup-java@v4
@@ -171,6 +181,8 @@ jobs:
171181
- uses: actions/checkout@v4
172182
with:
173183
submodules: "recursive"
184+
- name: Update submodules
185+
run: git submodule update --init --recursive
174186

175187
- name: ccache
176188
uses: hendrikmuhs/ccache-action@v1.2.9

‎.github/workflows/check.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: |
3030
git config --global --add safe.directory /__w/Vulkan-Samples/Vulkan-Samples
3131
git fetch origin $TARGET_BRANCH:$TARGET_BRANCH
32-
echo all="$(git diff --name-only --diff-filter=ACMRT $TARGET_BRANCH | grep -v -e .github -e third_party -e .in$ | xargs)" >> $GITHUB_OUTPUT
32+
echo all="$(git diff --name-only --diff-filter=ACMRT $TARGET_BRANCH | grep -v -e .github -e third_party -e 'samples/complex/render_octomap/octomap' -e .in$ | xargs)" >> $GITHUB_OUTPUT
3333
3434
doxygen:
3535
name: Doxygen Syntax Check
@@ -101,7 +101,7 @@ jobs:
101101
- run: git config --global --add safe.directory /__w/Vulkan-Samples/Vulkan-Samples
102102
- run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DGLFW_BUILD_WAYLAND=OFF -Bbuild/clang
103103
- run: |
104-
/usr/bin/run-clang-tidy -j $(($(nproc)/2+1)) -p build/clang -header-filter=framework,samples,app -checks=-*,google-*,-google-runtime-references -quiet ${{ needs.changed-files.outputs.all }}
104+
/usr/bin/run-clang-tidy -j $(($(nproc)/2+1)) -p build/clang -header-filter=framework,samples,app -checks=-*,google-*,-google-runtime-references -quiet ${{ needs.changed-files.outputs.all }} 2>&1 | grep -v "third_party/glfw"
105105
106106
pre-commit:
107107
name: Pre-Commit Checks

‎.gitmodules‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@
5656
[submodule "third_party/ai-ml-sdk-vgf-library"]
5757
path = third_party/ai-ml-sdk-vgf-library
5858
url = https://github.com/arm/ai-ml-sdk-vgf-library
59+
[submodule "third_party/octomap"]
60+
path = third_party/octomap
61+
url = https://github.com/OctoMap/octomap.git

‎antora/modules/ROOT/nav.adoc‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@
141141
* xref:samples/general/README.adoc[General samples]
142142
** xref:samples/general/mobile_nerf/README.adoc[Mobile NeRF]
143143
** xref:samples/general/mobile_nerf_rayquery/README.adoc[Mobile NeRF Ray Query]
144+
* xref:samples/complex/README.adoc[Complex Samples]
145+
** xref:samples/complex/render_octomap/README.adoc[Gausssian Splat and Octomap Rendering]
146+
*** xref:samples/complex/render_octomap/Tutorials/capturing-gaussian-splats.adoc[Capturing Gaussian Splats]
147+
*** xref:samples/complex/render_octomap/Tutorials/gaussian-splats-rendering.adoc[Rendering Gaussian Splats]
144148
* xref:docs/README.adoc[General documentation]
145149
** xref:docs/build.adoc[Build guide]
146150
** xref:docs/memory_limits.adoc[Memory limits]

‎assets‎

Submodule assets updated 63 files

‎framework/gltf_loader.cpp‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,8 @@ static inline bool texture_needs_srgb_colorspace(const std::string &name)
400400
} // namespace
401401

402402
std::unordered_map<std::string, bool> GLTFLoader::supported_extensions = {
403-
{KHR_LIGHTS_PUNCTUAL_EXTENSION, false}};
403+
{KHR_LIGHTS_PUNCTUAL_EXTENSION, false},
404+
{KHR_GAUSSIAN_SPLATTING_EXTENSION, false}};
404405

405406
GLTFLoader::GLTFLoader(vkb::core::DeviceC &device) :
406407
device{device}

‎framework/gltf_loader.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "vulkan/vulkan.h"
3636

3737
#define KHR_LIGHTS_PUNCTUAL_EXTENSION "KHR_lights_punctual"
38+
#define KHR_GAUSSIAN_SPLATTING_EXTENSION "KHR_gaussian_splatting"
3839

3940
namespace vkb
4041
{

‎samples/README.adoc‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
////
2-
- Copyright (c) 2020-2024, Arm Limited and Contributors
2+
- Copyright (c) 2020-2026, Arm Limited and Contributors
33
-
44
- SPDX-License-Identifier: Apache-2.0
55
-
@@ -44,3 +44,6 @@ include::./extensions/README.adoc[]
4444

4545
[[tooling-samples]]
4646
include::./tooling/README.adoc[]
47+
48+
[[complex-samples]]
49+
include::../complex/README.adoc[]

‎samples/complex/README.adoc‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
////
2+
- Copyright (c) 2021-2026, The Khronos Group
3+
-
4+
- SPDX-License-Identifier: Apache-2.0
5+
-
6+
- Licensed under the Apache License, Version 2.0 the "License";
7+
- you may not use this file except in compliance with the License.
8+
- You may obtain a copy of the License at
9+
-
10+
- http://www.apache.org/licenses/LICENSE-2.0
11+
-
12+
- Unless required by applicable law or agreed to in writing, software
13+
- distributed under the License is distributed on an "AS IS" BASIS,
14+
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
- See the License for the specific language governing permissions and
16+
- limitations under the License.
17+
-
18+
////
19+
ifndef::complex_samplespath[:complex_samplespath:]
20+
21+
== Complex samples
22+
23+
The goal of these samples is to demonstrate how to use Vulkan in a real world scenario. These are meant to be demonstrations of how to use Vulkan as a whole instead of a singular item within Vulkan.
24+
25+
This format for samples is to demonstrate how to work with other libraries or setup projects. Some of the samples may or may not use the Framework as needed.
26+
27+
While the Vulkan concepts found here aren't complex, the interaction and unique benefit with the real-world use cases they work with are meant to be. Examples of what might eventually be found here include AI, OpenXR, GLTF, etc. Topics which don't belong in the other sample categories by themselves yet are useful in many areas.
28+
29+
=== xref:./{complex_samplespath}render_octmap/README.adoc[Render an Octo-Map]
30+
31+
*Instancing*: https://docs.vulkan.org/spec/latest/chapters/drawing.html#vkCmdDrawIndexed[`vkCmdDrawIndexed`]
32+
33+
Uses instancing to render octmaps generated in realtime by ARCore and ARKit then saved, and joined together using Point Cloud Registration into one shared map.
34+
35+
These maps are commonly used by Robot Operating System (ROS) and this is a solution showing how to render the map created. This is a topic of interest to SLAM and AI with OpenXR for map understanding and joining.
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright (c) 2025-2026, Holochip Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 the "License";
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
get_filename_component(FOLDER_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
19+
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_LIST_DIR} PATH)
20+
get_filename_component(CATEGORY_NAME ${PARENT_DIR} NAME)
21+
22+
# On Windows, build as STATIC to avoid DLL export issues
23+
# On other platforms, build as SHARED for better memory efficiency
24+
if(WIN32)
25+
set(OCTOMAP_LIBRARY_TYPE STATIC)
26+
else()
27+
set(OCTOMAP_LIBRARY_TYPE SHARED)
28+
endif()
29+
30+
set(OCTOMAP_ROOT ${CMAKE_SOURCE_DIR}/third_party/octomap)
31+
32+
add_library( octomath STATIC
33+
${OCTOMAP_ROOT}/octomap/src/math/Vector3.cpp
34+
${OCTOMAP_ROOT}/octomap/src/math/Quaternion.cpp
35+
${OCTOMAP_ROOT}/octomap/src/math/Pose6D.cpp
36+
)
37+
set_target_properties(octomath PROPERTIES POSITION_INDEPENDENT_CODE ON)
38+
target_include_directories(octomath PUBLIC ${OCTOMAP_ROOT}/octomap/include)
39+
40+
add_library(octomap ${OCTOMAP_LIBRARY_TYPE}
41+
${OCTOMAP_ROOT}/octomap/src/AbstractOcTree.cpp
42+
${OCTOMAP_ROOT}/octomap/src/AbstractOccupancyOcTree.cpp
43+
${OCTOMAP_ROOT}/octomap/src/Pointcloud.cpp
44+
${OCTOMAP_ROOT}/octomap/src/ScanGraph.cpp
45+
${OCTOMAP_ROOT}/octomap/src/CountingOcTree.cpp
46+
${OCTOMAP_ROOT}/octomap/src/OcTree.cpp
47+
${OCTOMAP_ROOT}/octomap/src/OcTreeNode.cpp
48+
${OCTOMAP_ROOT}/octomap/src/OcTreeStamped.cpp
49+
${OCTOMAP_ROOT}/octomap/src/ColorOcTree.cpp
50+
)
51+
target_link_libraries(octomap PUBLIC octomath)
52+
53+
add_library(dynamicEDT3d ${OCTOMAP_LIBRARY_TYPE} ${OCTOMAP_ROOT}/dynamicEDT3D/src/dynamicEDT3D.cpp)
54+
target_include_directories(dynamicEDT3d PUBLIC ${OCTOMAP_ROOT}/dynamicEDT3D/include)
55+
target_link_libraries(dynamicEDT3d PUBLIC octomap)
56+
57+
add_sample_with_tags(
58+
ID ${FOLDER_NAME}
59+
CATEGORY ${CATEGORY_NAME}
60+
AUTHOR "Holochip"
61+
NAME "Octmap rendering"
62+
DESCRIPTION "Demonstration of how to render an OctMap which was generated from ICP combining ARCore and ARKit SLAM maps"
63+
SHADER_FILES_GLSL
64+
"render_octomap/glsl/render.vert"
65+
"render_octomap/glsl/render.frag"
66+
"render_octomap/glsl/gltf.vert"
67+
"render_octomap/glsl/gltf.frag"
68+
"render_octomap/glsl/splat.vert"
69+
"render_octomap/glsl/splat.frag"
70+
LIBS
71+
dynamicEDT3d
72+
)

0 commit comments

Comments
 (0)