Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive
- if: ${{ matrix.platform == 'ubuntu' }}
name: Install RandR headers
run: |
Expand Down Expand Up @@ -68,6 +70,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive

- if: ${{ matrix.platform == 'ubuntu' }}
name: Install RandR headers
Expand Down Expand Up @@ -97,6 +101,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.9
with:
Expand All @@ -115,6 +121,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive
- name: Install RandR headers
run: |
sudo apt-get update
Expand All @@ -139,6 +147,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive

- name: set up JDK
uses: actions/setup-java@v4
Expand Down Expand Up @@ -171,6 +181,8 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Update submodules
run: git submodule update --init --recursive

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2.9
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
run: |
git config --global --add safe.directory /__w/Vulkan-Samples/Vulkan-Samples
git fetch origin $TARGET_BRANCH:$TARGET_BRANCH
echo all="$(git diff --name-only --diff-filter=ACMRT $TARGET_BRANCH | grep -v -e .github -e third_party -e .in$ | xargs)" >> $GITHUB_OUTPUT
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

doxygen:
name: Doxygen Syntax Check
Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
- run: git config --global --add safe.directory /__w/Vulkan-Samples/Vulkan-Samples
- run: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DGLFW_BUILD_WAYLAND=OFF -Bbuild/clang
- run: |
/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 }}
/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"

pre-commit:
name: Pre-Commit Checks
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@
[submodule "third_party/tracy"]
path = third_party/tracy
url = https://github.com/wolfpld/tracy.git
[submodule "samples/complex/render_octomap/octomap"]
path = samples/complex/render_octomap/octomap
url = https://github.com/OctoMap/octomap.git
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 42 files
+0 −7 README.md
+0 −8 scenes/Buggy/README.md
+0 −15,818 scenes/Buggy/glTF-Embedded/Buggy.gltf
+ scenes/Buggy/screenshot/screenshot.png
+0 −29 scenes/morpheus_team/LICENSE.txt
+0 −616 scenes/morpheus_team/lego_ball_phone/mlp.json
+0 −140 scenes/morpheus_team/lego_ball_phone/shape0.gltf
+0 −6 scenes/morpheus_team/lego_ball_phone/shape0.mtl
+0 −3 scenes/morpheus_team/lego_ball_phone/shape0.obj
+ scenes/morpheus_team/lego_ball_phone/shape0.pngfeat0.png
+ scenes/morpheus_team/lego_ball_phone/shape0.pngfeat1.png
+0 −616 scenes/morpheus_team/lego_boba_fett_phone/mlp.json
+0 −140 scenes/morpheus_team/lego_boba_fett_phone/shape0.gltf
+0 −6 scenes/morpheus_team/lego_boba_fett_phone/shape0.mtl
+0 −3 scenes/morpheus_team/lego_boba_fett_phone/shape0.obj
+ scenes/morpheus_team/lego_boba_fett_phone/shape0.pngfeat0.png
+ scenes/morpheus_team/lego_boba_fett_phone/shape0.pngfeat1.png
+0 −616 scenes/morpheus_team/lego_monster_truck_phone/mlp.json
+0 −140 scenes/morpheus_team/lego_monster_truck_phone/shape0.gltf
+0 −6 scenes/morpheus_team/lego_monster_truck_phone/shape0.mtl
+0 −3 scenes/morpheus_team/lego_monster_truck_phone/shape0.obj
+ scenes/morpheus_team/lego_monster_truck_phone/shape0.pngfeat0.png
+ scenes/morpheus_team/lego_monster_truck_phone/shape0.pngfeat1.png
+0 −616 scenes/morpheus_team/lego_tractor_phone/mlp.json
+0 −140 scenes/morpheus_team/lego_tractor_phone/shape0.gltf
+0 −6 scenes/morpheus_team/lego_tractor_phone/shape0.mtl
+0 −3 scenes/morpheus_team/lego_tractor_phone/shape0.obj
+ scenes/morpheus_team/lego_tractor_phone/shape0.pngfeat0.png
+ scenes/morpheus_team/lego_tractor_phone/shape0.pngfeat1.png
+ scenes/octMap.bin
+0 −11 scenes/pica_pica_robot/license.txt
+ scenes/pica_pica_robot/scene.bin
+0 −1,801 scenes/pica_pica_robot/scene.gltf
+0 −15 scenes/primitives/LICENSE.md
+0 −7 scenes/primitives/README.md
+0 −611 scenes/primitives/primitives.gltf
+0 −2,667 scenes/subpass_scene_opaque.gltf
+0 −665 scenes/subpass_scene_transparent.gltf
+0 −15 scenes/terrain/LICENSE.md
+0 −5 scenes/terrain/README.md
+0 −121 scenes/terrain/terrain.gltf
+ textures/transparent_glass_rgba.ktx
2 changes: 2 additions & 0 deletions framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ set(SCENE_GRAPH_COMPONENT_FILES
scene_graph/components/pbr_material.h
scene_graph/components/sampler.h
scene_graph/components/sub_mesh.h
scene_graph/components/gaussian_splat.h
scene_graph/components/texture.h
scene_graph/components/transform.h
scene_graph/components/image/astc.h
Expand All @@ -179,6 +180,7 @@ set(SCENE_GRAPH_COMPONENT_FILES
scene_graph/components/mesh.cpp
scene_graph/components/pbr_material.cpp
scene_graph/components/sub_mesh.cpp
scene_graph/components/gaussian_splat.cpp
scene_graph/components/texture.cpp
scene_graph/components/transform.cpp
scene_graph/components/image/astc.cpp
Expand Down
3 changes: 2 additions & 1 deletion framework/gltf_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,8 @@ static inline bool texture_needs_srgb_colorspace(const std::string &name)
} // namespace

std::unordered_map<std::string, bool> GLTFLoader::supported_extensions = {
{KHR_LIGHTS_PUNCTUAL_EXTENSION, false}};
{KHR_LIGHTS_PUNCTUAL_EXTENSION, false},
{KHR_GAUSSIAN_SPLATTING_EXTENSION, false}};

GLTFLoader::GLTFLoader(vkb::core::DeviceC &device) :
device{device}
Expand Down
1 change: 1 addition & 0 deletions framework/gltf_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "vulkan/vulkan.h"

#define KHR_LIGHTS_PUNCTUAL_EXTENSION "KHR_lights_punctual"
#define KHR_GAUSSIAN_SPLATTING_EXTENSION "KHR_gaussian_splatting"

namespace vkb
{
Expand Down
68 changes: 68 additions & 0 deletions framework/scene_graph/components/gaussian_splat.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* Copyright (c) 2024-2025, Holochip Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "gaussian_splat.h"

namespace vkb
{
namespace sg
{

GaussianSplat::GaussianSplat(const std::string &name) :
Component{name}
{
}

std::type_index GaussianSplat::get_type()
{
return typeid(GaussianSplat);
}

size_t GaussianSplat::get_gpu_memory_size() const
{
size_t total = 0;

if (position_buffer)
{
total += position_buffer->get_size();
}
if (rotation_buffer)
{
total += rotation_buffer->get_size();
}
if (scale_buffer)
{
total += scale_buffer->get_size();
}
if (opacity_buffer)
{
total += opacity_buffer->get_size();
}
if (color_buffer)
{
total += color_buffer->get_size();
}
if (sh_buffer)
{
total += sh_buffer->get_size();
}

return total;
}

} // namespace sg
} // namespace vkb
113 changes: 113 additions & 0 deletions framework/scene_graph/components/gaussian_splat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/* Copyright (c) 2024-2025, Holochip Inc.
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <memory>
#include <string>
#include <typeinfo>
#include <vector>

#include "common/glm_common.h"
#include "common/vk_common.h"
#include "core/buffer.h"
#include "scene_graph/component.h"

namespace vkb
{
namespace sg
{

/**
* @brief Gaussian Splat rendering primitive data
*
* Stores data for rendering 3D Gaussian Splats as defined by the
* KHR_gaussian_splatting GLTF extension.
*
* Each splat is an oriented 3D Gaussian defined by:
* - Position (center point)
* - Rotation (quaternion orientation)
* - Scale (3D scale factors)
* - Opacity (alpha value)
* - Color (RGB or spherical harmonics coefficients)
*/
class GaussianSplat : public Component
{
public:
/**
* @brief Kernel type for splat rendering
*/
enum class KernelType
{
Ellipse, // Default elliptical kernel
Sphere // Spherical kernel (isotropic)
};

/**
* @brief Color space for splat colors
*/
enum class ColorSpace
{
SRGB, // BT.709-sRGB
Linear // Linear RGB
};

GaussianSplat(const std::string &name = {});

virtual ~GaussianSplat() = default;

virtual std::type_index get_type() override;

// Number of splats
uint32_t splat_count = 0;

// Spherical harmonics degree (0-3)
uint32_t sh_degree = 0;

// Whether antialiasing is enabled
bool antialiased = false;

// Kernel type for rendering
KernelType kernel = KernelType::Ellipse;

// Color space
ColorSpace color_space = ColorSpace::SRGB;

// GPU buffers for splat data
std::unique_ptr<vkb::core::BufferC> position_buffer; // VEC3 positions
std::unique_ptr<vkb::core::BufferC> rotation_buffer; // VEC4 quaternions
std::unique_ptr<vkb::core::BufferC> scale_buffer; // VEC3 scales
std::unique_ptr<vkb::core::BufferC> opacity_buffer; // SCALAR opacities
std::unique_ptr<vkb::core::BufferC> color_buffer; // VEC3 colors (or SH coefficients)
std::unique_ptr<vkb::core::BufferC> sh_buffer; // MAT3 spherical harmonics (if sh_degree > 0)

/**
* @brief Get the total GPU memory used by this splat primitive
*/
size_t get_gpu_memory_size() const;

/**
* @brief Check if spherical harmonics data is available
*/
bool has_spherical_harmonics() const
{
return sh_degree > 0 && sh_buffer != nullptr;
}
};

} // namespace sg
} // namespace vkb
5 changes: 4 additions & 1 deletion samples/README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
////
- Copyright (c) 2020-2024, Arm Limited and Contributors
- Copyright (c) 2020-2025, Arm Limited and Contributors
-
- SPDX-License-Identifier: Apache-2.0
-
Expand Down Expand Up @@ -44,3 +44,6 @@ include::./extensions/README.adoc[]

[[tooling-samples]]
include::./tooling/README.adoc[]

[[complex-samples]]
include::../complex/README.adoc[]
35 changes: 35 additions & 0 deletions samples/complex/README.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
////
- Copyright (c) 2021-2025, The Khronos Group
-
- SPDX-License-Identifier: Apache-2.0
-
- Licensed under the Apache License, Version 2.0 the "License";
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
////
ifndef::complex_samplespath[:complex_samplespath:]

== Complex samples

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.

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.

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.

=== xref:./{complex_samplespath}render_octmap/README.adoc[Render an Octo-Map]

*Instancing*: https://docs.vulkan.org/spec/latest/chapters/drawing.html#vkCmdDrawIndexed[`vkCmdDrawIndexed`]

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.

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.
Loading
Loading