### Install Dependencies and Clone Gaustudio Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/gaustudio/demo/gaustudio.ipynb Installs necessary packages and clones the Gaustudio repository. This includes setting up the environment and compiling custom CUDA kernels. ```bash %cd /content !sudo apt-get install colmap !pip install -q plyfile torch torchvision tqdm opencv-python-headless vdbfusion trimesh omegaconf einops kiui scipy %cd /content !git clone --recursive https://github.com/Tao-11-chen/gaustudio.git %cd gaustudio/submodules/gaustudio-diff-gaussian-rasterization !python setup.py install %cd ../.. !python setup.py develop %cd /content/ !git clone --recursive https://github.com/graphdeco-inria/gaussian-splatting.git %cd /content/gaussian-splatting !pip install -e submodules/diff-gaussian-rasterization !pip install -e submodules/simple-knn ``` -------------------------------- ### Install Custom Rasterizer and GauStudio Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/index.md Commands to compile and install the custom Gaussian rasterizer from the submodule and then install GauStudio in development mode. ```bash cd submodules/gaustudio-diff-gaussian-rasterization python setup.py install cd ../.. python setup.py develop ``` -------------------------------- ### Install PyTorch with Conda Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/index.md Example command to install a specific PyTorch version (1.12.1+cu113) using conda. This is a prerequisite for GauStudio. ```bash conda install pytorch=1.12.1 torchvision=0.13.1 cudatoolkit=11.3 -c pytorch ``` -------------------------------- ### Install PyTorch with Pip Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/index.md Example command to install PyTorch (2.0.1+cu118) using pip. This is an alternative to conda installation and requires specifying the CUDA version. ```bash pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118 ``` -------------------------------- ### Install GauStudio Dependencies Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/index.md Installs all necessary Python dependencies listed in the requirements.txt file. Run this after activating the conda environment. ```bash pip install -r requirements.txt ``` -------------------------------- ### Example GLM Build Messages Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md This is an example of the output generated when GLM_FORCE_MESSAGES is defined, showing version, compiler, platform, and feature configurations. ```plaintext GLM: 0.9.9.1 GLM: C++ 17 with extensions GLM: GCC compiler detected" GLM: x86 64 bits with AVX instruction set build target GLM: Linux platform detected GLM: GLM_FORCE_SWIZZLE is undefined. swizzling functions or operators are disabled. GLM: GLM_FORCE_SIZE_T_LENGTH is undefined. .length() returns a glm::length_t, a typedef of int following GLSL. GLM: GLM_FORCE_UNRESTRICTED_GENTYPE is undefined. Follows strictly GLSL on valid function genTypes. GLM: GLM_FORCE_DEPTH_ZERO_TO_ONE is undefined. Using negative one to one depth clip space. GLM: GLM_FORCE_LEFT_HANDED is undefined. Using right handed coordinate system. ``` -------------------------------- ### Installation Configuration Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/CMakeLists.txt Configures installation rules for GLM, including headers, CMake package configuration files, and version files. This section is executed only when the current source directory is the top-level directory. ```cmake if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) include(CPack) install(DIRECTORY glm DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} PATTERN "CMakeLists.txt" EXCLUDE) install(EXPORT glm FILE glmConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glm NAMESPACE glm::) include(CMakePackageConfigHelpers) write_basic_package_version_file("glmConfigVersion.cmake" COMPATIBILITY AnyNewerVersion) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/glmConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/glm) include(CTest) if(BUILD_TESTING) add_subdirectory(test) endif() endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### Gsplat Renderer Setup and Usage Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Configure and use the Gsplat renderer, which is simpler and utilizes the gsplat library. It provides RGB and final opacity outputs. ```python gsplat_renderer = renderers.make({ "name": "gsplat_renderer", "white_background": False }) ``` ```python pkg2 = gsplat_renderer.render(camera, pcd) print(pkg2["render"].shape) # [3, H, W] print(pkg2["rendered_final_opacity"].shape) # [1, H, W] ``` -------------------------------- ### Vanilla Renderer Setup and Usage Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Configure and use the vanilla renderer for full output including depth and median maps. Ensure necessary libraries like torch and json are imported. ```python renderer = renderers.make({ "name": "vanilla_renderer", "scaling_modifier": 1.0, "white_background": False, "convert_SHs_python": False, # True: eval SH on CPU (slower) "compute_cov3D_python": False, # True: compute 3D cov on CPU "debug": False }) ``` ```python from gaustudio import datasets import json from gaustudio.utils.cameras_utils import JSON_to_camera import torch with open("./model/cameras.json") as f: cam_data = json.load(f) camera = JSON_to_camera(cam_data[0], "cuda") with torch.no_grad(): pkg = renderer.render(camera, pcd) print(pkg["render"].shape) # [3, H, W] — RGB image print(pkg["rendered_depth"].shape) # [1, H, W] — alpha-weighted depth print(pkg["rendered_median_depth"].shape) # [1, H, W] — median depth print(pkg["rendered_final_opacity"].shape) # [1, H, W] — accumulated alpha print(pkg["visibility_filter"].shape) # [N] — which Gaussians were visible print(pkg["radii"].shape) # [N] — 2D radii in pixels ``` -------------------------------- ### GLSL Swizzle Example Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Demonstrates GLSL swizzle syntax for accessing and assigning vector components using 'xyzw', 'rgba', and 'stpq' notations. ```glsl vec4 A; vec2 B; B.yx = A.wy; B = A.xx; vec3 C = A.bgr; vec3 D = B.rsz; // Invalid, won't compile ``` -------------------------------- ### Project and Library Setup Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/CMakeLists.txt Initializes the GLM project with the extracted version and sets up the main GLM library target. This includes adding the GLM submodule and creating an alias. ```cmake project(glm VERSION ${GLM_VERSION} LANGUAGES CXX) message(STATUS "GLM: Version " ${GLM_VERSION}) add_subdirectory(glm) add_library(glm::glm ALIAS glm) ``` -------------------------------- ### Matrix Translation Example Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Demonstrates creating a translation matrix and transforming a position vector. Include `` and `` to use these features. ```cpp #include #include int foo() { glm::vec4 Position = glm::vec4(glm:: vec3(0.0f), 1.0f); glm::mat4 Model = glm::translate(glm::mat4(1.0f), glm::vec3(1.0f)); glm::vec4 Transformed = Model * Position; ... return 0; } ``` -------------------------------- ### Depth-Based Initializer for Scene Setup Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Utilize the depth-based initializer to set up a scene, particularly useful when depth information is available. Overwrite existing data if necessary. ```python # Or use the depth-based initializer depth_init = initializers.make({ "name": "depth", "workspace_dir": "/out/depth_ws" }) pcd2 = models.make("general_pcd") pcd2 = depth_init(pcd2, dataset, overwrite=True) ``` -------------------------------- ### Compute Projection Matrix (GLM_EXT_matrix_clip_space) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Generates a perspective projection matrix. This example uses `glm::perspective` and `glm::radians` from `` and `` respectively. ```cpp #include // mat4x4 #include // perspective #include // radians glm::mat4 computeProjection(float Width, float Height) { return glm::perspective(glm::radians(45.0f), Width / Height, 0.1f, 100.f); } ``` -------------------------------- ### Generate Random Vectors with GLM Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Examples of generating random vectors using different distribution functions provided by GLM_GTC_random. ```cpp glm::vec4(glm::linearRand(glm::vec2(-1), glm::vec2(1)), 0, 1); ``` ```cpp glm::vec4(glm::circularRand(1.0f), 0, 1); ``` ```cpp glm::vec4(glm::sphericalRand(1.0f), 1); ``` ```cpp glm::vec4(glm::diskRand(1.0f), 0, 1); ``` ```cpp glm::vec4(glm::ballRand(1.0f), 1); ``` ```cpp glm::vec4(glm::gaussRand(glm::vec3(0), glm::vec3(1)), 1); ``` -------------------------------- ### Matrix Transformation Example Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Applies a series of transformations (translation, rotation, scaling) to a 4x4 matrix. This is fundamental for positioning and orienting objects in 3D space. ```c++ glm::mat4 transform = glm::mat4(1.0f); // Translate transform = glm::translate(transform, glm::vec3(1.0f, 0.0f, 0.0f)); // Rotate transform = glm::rotate(transform, glm::radians(45.0f), glm::vec3(0.0f, 1.0f, 0.0f)); // Scale transform = glm::scale(transform, glm::vec3(0.5f, 0.5f, 0.5f)); ``` -------------------------------- ### COLMAP Initializer for Scene Setup Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Use the COLMAP initializer to process datasets, extract features, perform matching, and triangulate a sparse point cloud. Ensure dataset and model paths are correctly specified. ```python from gaustudio import datasets, models from gaustudio.pipelines import initializers # Load dataset dataset = datasets.make({ "name": "polycam", "source_path": "/data/polycam_export", "camera_number": 1, }) ``` ```python # Create an empty point cloud model to fill pcd = models.make("general_pcd") # Run COLMAP initializer: feature extraction → matching → triangulation init = initializers.make({ "name": "colmap", "workspace_dir": "/out/colmap_ws" }) pcd = init(pcd, dataset, overwrite=False) # skips if sparse/ already exists print(pcd) # GeneralPointCloud(num_points=84231, properties=dict_keys(['xyz', 'rgb', 'normal'])) # Export the sparse point cloud pcd.export("/out/colmap_ws/sparse/0/points3D.ply") ``` -------------------------------- ### Include GLM Core Headers Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Include the main GLM header to access core GLSL mathematics features like vec2, vec3, mat4, and radians. This is the most basic way to start using GLM. ```cpp #include ``` -------------------------------- ### Extract GLM Version Information Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/CMakeLists.txt Reads the setup header to extract major, minor, patch, and revision numbers for the GLM version. This information is used to set the project version. ```cmake file(READ "glm/detail/setup.hpp" GLM_SETUP_FILE) string(REGEX MATCH "#define[ ]+GLM_VERSION_MAJOR[ ]+([0-9]+)" _ ${GLM_SETUP_FILE}) set(GLM_VERSION_MAJOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define[ ]+GLM_VERSION_MINOR[ ]+([0-9]+)" _ ${GLM_SETUP_FILE}) set(GLM_VERSION_MINOR "${CMAKE_MATCH_1}") string(REGEX MATCH "#define[ ]+GLM_VERSION_PATCH[ ]+([0-9]+)" _ ${GLM_SETUP_FILE}) set(GLM_VERSION_PATCH "${CMAKE_MATCH_1}") string(REGEX MATCH "#define[ ]+GLM_VERSION_REVISION[ ]+([0-9]+)" _ ${GLM_SETUP_FILE}) set(GLM_VERSION_REVISION "${CMAKE_MATCH_1}") set(GLM_VERSION ${GLM_VERSION_MAJOR}.${GLM_VERSION_MINOR}.${GLM_VERSION_PATCH}.${GLM_VERSION_REVISION}) ``` -------------------------------- ### Transform Matrix Calculation with Separated Headers Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Calculates a transformation matrix using GLM core features and extensions. This example demonstrates how to include specific headers for vectors, matrices, trigonometric functions, and matrix transformations. ```cpp // Include GLM core features #include // vec2 #include // vec3 #include // mat4 #include //radians // Include GLM extension #include // perspective, translate, rotate glm::mat4 transform(glm::vec2 const& Orientation, glm::vec3 const& Translate, glm::vec3 const& Up) { glm::mat4 Proj = glm::perspective(glm::radians(45.f), 1.33f, 0.1f, 10.f); glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.f), Translate); glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Orientation.y, Up); glm::mat4 View = glm::rotate(ViewRotateX, Orientation.x, Up); glm::mat4 Model = glm::mat4(1.0f); return Proj * View * Model; } ``` -------------------------------- ### Instantiate GauStudio Components with Registry Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Demonstrates how to load a configuration file and instantiate various GauStudio components (models, datasets, renderers, initializers) using the `make` function from their respective registries. Components can be instantiated directly by name or via a configuration dictionary. ```python from gaustudio import models, datasets, renderers from gaustudio.pipelines import initializers from gaustudio.utils.misc import load_config # Load YAML config (merges YAML + CLI overrides) config = load_config("gaustudio/configs/vanilla.yaml", cli_args=["dataset.source_path=/data/scene"]) # Instantiate components by name from config pcd = models.make(config.model.pointcloud) # e.g. 'vanilla_pcd' renderer = renderers.make(config.renderer) # e.g. 'vanilla_renderer' # Or instantiate directly with a dict pcd2 = models.make({"name": "general_pcd"}) dataset = datasets.make({"name": "colmap", "source_path": "/data/scene", "images": "images", "resolution": 1}) initializer = initializers.make({"name": "colmap", "workspace_dir": "/out/ws"}) ``` -------------------------------- ### CLI: gs-init for Two-Stage Gaussian Initialization Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Employ the `gs-init` CLI for a two-stage Gaussian initialization process, including pose estimation and optional geometry seeding. Supports various geometry initializers. ```bash # Pose-only initialization (hloc → colmap fallback) gs-init \ --dataset colmap \ --source_path ./data/garden \ --output_dir ./output/garden_init \ --resolution 2 ``` ```bash # Pose + depth-based geometry initialization gs-init \ -s ./data/mushroom_room \ -o ./output/mushroom_init \ -d colmap \ -i depth \ -r 1 \ --overwrite ``` ```bash # Pose + mesh-based initialization (provide existing mesh) gs-init \ -s ./data/object_scan \ -o ./output/object_init \ -i mesh \ -m ./data/prior_mesh.ply \ --config ./custom_init.yaml ``` -------------------------------- ### glm::column (get) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00058_source.html Retrieves a specific column from a matrix. ```APIDOC ## glm::column (get) ### Description Retrieves a specific column from a matrix. ### Signature ```cpp template typename genType::col_type column(genType const& m, length_t index); ``` ### Parameters * **m**: The input matrix. * **index**: The index of the column to retrieve. ``` -------------------------------- ### glm::row (get) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00058_source.html Retrieves a specific row from a matrix. ```APIDOC ## glm::row (get) ### Description Retrieves a specific row from a matrix. ### Signature ```cpp template typename genType::row_type row(genType const& m, length_t index); ``` ### Parameters * **m**: The input matrix. * **index**: The index of the row to retrieve. ``` -------------------------------- ### Registry System: make() function Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt The `make(config)` function is the primary entry point for instantiating components (models, datasets, renderers, pipelines) from registered classes using OmegaConf configurations. ```APIDOC ## Registry System: `models.make`, `datasets.make`, `renderers.make`, `pipelines.make` Each sub-system (models, datasets, renderers, pipelines/initializers) maintains a global registry dict populated with `@register('name')` decorators. The `make(config)` function accepts either a string name or a dict/OmegaConf config with a `name` key, constructs the registered class, and returns the instance. This is the primary entry point for all component instantiation throughout the framework. ```python from gaustudio import models, datasets, renderers from gaustudio.pipelines import initializers from gaustudio.utils.misc import load_config # Load YAML config (merges YAML + CLI overrides) config = load_config("gaustudio/configs/vanilla.yaml", cli_args=["dataset.source_path=/data/scene"]) # Instantiate components by name from config pcd = models.make(config.model.pointcloud) # e.g. 'vanilla_pcd' renderer = renderers.make(config.renderer) # e.g. 'vanilla_renderer' # Or instantiate directly with a dict pcd2 = models.make({"name": "general_pcd"}) dataset = datasets.make({"name": "colmap", "source_path": "/data/scene", "images": "images", "resolution": 1}) initializer = initializers.make({"name": "colmap", "workspace_dir": "/out/ws"}) ``` ``` -------------------------------- ### Data Preprocessing for Gaustudio Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/gaustudio/demo/gaustudio.ipynb Downloads a sample video, sets up data paths, and preprocesses the video using custom bash scripts for COLMAP. This prepares the data for 3D reconstruction. ```bash %cd /content/gaustudio/ !wget https://huggingface.co/camenduru/neuralangelo/resolve/main/lego.mp4 -O /content/lego.mp4 video_path="/content/lego.mp4" data_path="/content/data" image_path="/content/data/images" downsample_rate=2 !mkdir -p {image_path} !bash gaustudio/demo/preprocess.sh {video_path} {image_path} {downsample_rate} !bash gaustudio/demo/run_colmap.sh {data_path} !mv /content/data/sparse/cameras.bin /content/data/sparse/0/ !mv /content/data/sparse/images.bin /content/data/sparse/0/ !mv /content/data/sparse/points3D.bin /content/data/sparse/0/ ``` -------------------------------- ### glm::axisAngle Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00101_source.html Gets the axis and angle of the rotation from a 4x4 matrix. ```APIDOC ## axisAngle ### Description Get the axis and angle of the rotation from a matrix. ### Signature ```cpp template void axisAngle(mat<4, 4, T, Q> const & Mat, vec<3, T, Q> & Axis, T & Angle) ``` ### Parameters * **Mat**: The 4x4 matrix. * **Axis**: Output parameter for the rotation axis. * **Angle**: Output parameter for the rotation angle. ``` -------------------------------- ### bitfieldExtract Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00370.html Extracts a specified number of bits from a value, starting at a given offset. ```APIDOC ## bitfieldExtract ### Description Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result. ### Signature ```cpp template vec bitfieldExtract(vec const &Value, int Offset, int Bits) ``` ### Parameters * **Value**: The source vector from which to extract bits. * **Offset**: The starting bit position for extraction. * **Bits**: The number of bits to extract. ``` -------------------------------- ### Create and manage Gaussian Point Clouds Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Demonstrates creating, initializing, loading, exporting, and merging Gaussian point clouds using the `models` module. Supports various attribute activations and PLY file operations. ```python from gaustudio import models import numpy as np import torch # Create a VanillaPointCloud (full 3DGS model with SH features) pcd = models.make({"name": "vanilla_pcd", "sh_degree": 3}) # Initialize from raw numpy arrays xyz = np.random.randn(5000, 3).astype(np.float32) rgb = np.random.rand(5000, 3).astype(np.float32) pcd.create_from_attribute(xyz=xyz, rgb=rgb) print(pcd) # VanillaPointCloud(num_points=5000, properties=dict_keys(['xyz', 'opacity', 'f_dc', 'f_rest', 'scale', 'rot'])) # Access activated properties positions = pcd.get_attribute("xyz") # raw, no activation opacities = pcd.get_attribute("opacity") # sigmoid-activated [5000, 1] scales = pcd.get_attribute("scale") # exp-activated [5000, 3] rotations = pcd.get_attribute("rot") # normalized [5000, 4] features = pcd.get_features # SH features [5000, 16, 3] # Load a trained PLY from 3DGS output pcd.load("./model/point_cloud/iteration_30000/point_cloud.ply") pcd.to("cuda") # Export back to PLY pcd.export("./output/my_gaussians.ply") # Merge two point clouds pcd2 = models.make({"name": "vanilla_pcd", "sh_degree": 3}) pcd2.load("./model2/point_cloud/iteration_30000/point_cloud.ply") merged = pcd + pcd2 print(f"Merged: {merged.num_points} points") # GeneralPointCloud: simple XYZ+RGB+Normal, for preprocessing / initialization gen_pcd = models.make("general_pcd") gen_pcd.create_from_attribute(xyz=xyz, rgb=rgb) gen_pcd.export("./output/init_pcd.ply") ``` -------------------------------- ### glm::bitfieldExtract Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00043_source.html Extracts a specified number of bits from a value starting at a given offset. ```APIDOC ## glm::bitfieldExtract ### Description Extracts a specified number of bits from a value starting at a given offset. ### Signature ```cpp template vec bitfieldExtract(vec const& Value, int Offset, int Bits); ``` ### Parameters * `Value`: The vector from which to extract bits. * `Offset`: The starting bit position for extraction. * `Bits`: The number of bits to extract. ``` -------------------------------- ### glm::quarticEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a quartic easing function that starts with a rapid acceleration. Modelled after the quartic x^4. ```APIDOC ## glm::quarticEaseIn ### Description Applies a quartic easing function that starts with a rapid acceleration. Modelled after the quartic x^4. ### Signature ```cpp template genType quarticEaseIn(genType const & a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### Initialize Gaussian Rasterizers Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Initializes and prepares a Gaussian point cloud model for rendering using either the VanillaRenderer or GsplatRenderer. Requires a pre-loaded point cloud. ```python from gaustudio import models, renderers pcd = models.make({"name": "vanilla_pcd", "sh_degree": 3}) pcd.load("./model/point_cloud/iteration_30000/point_cloud.ply") pcd.to("cuda") ``` -------------------------------- ### glm::quinticEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a quintic easing function that starts with a rapid acceleration. Modelled after the quintic y = x^5. ```APIDOC ## glm::quinticEaseIn ### Description Applies a quintic easing function that starts with a rapid acceleration. Modelled after the quintic y = x^5. ### Signature ```cpp template genType quinticEaseIn(genType const & a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### glm::cubicEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a cubic easing function that starts with a rapid acceleration. Modelled after the cubic y = x^3. ```APIDOC ## glm::cubicEaseIn ### Description Applies a cubic easing function that starts with a rapid acceleration. Modelled after the cubic y = x^3. ### Signature ```cpp template genType cubicEaseIn(genType const & a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### Create and Activate Conda Environment Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/index.md Recommended steps to create and activate a new conda environment for GauStudio. Ensure Python version 3.8 is used. ```bash conda create -n gaustudio python=3.8 conda activate gaustudio ``` -------------------------------- ### glm::sineEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a sine easing function that starts with a slow acceleration. Modelled after quarter-cycle of sine wave. ```APIDOC ## glm::sineEaseIn ### Description Applies a sine easing function that starts with a slow acceleration. Modelled after quarter-cycle of sine wave. ### Signature ```cpp template genType sineEaseIn(genType const & a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### glm::sineEaseInOut Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a sine easing function that starts with acceleration and ends with deceleration. Modelled after half sine wave. ```APIDOC ## glm::sineEaseInOut ### Description Applies a sine easing function that starts with acceleration and ends with deceleration. Modelled after half sine wave. ### Signature ```cpp template genType sineEaseInOut(genType const & a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### Unified Dataset Interface Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/docs/source/apis/datasets.md Use the `gaustudio.datasets.make` function to load datasets with a unified interface, abstracting away dataset-specific preprocessing. Specify the dataset name and source path. ```python gaustudio.datasets.make(name='...',source_path='...') ``` -------------------------------- ### Force Default Precision Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Set the default precision for GLM types using GLM_FORCE_PRECISION_. For example, GLM_FORCE_PRECISION_HIGH_FLOAT for high-precision floats. ```c++ #define GLM_FORCE_PRECISION_HIGH_FLOAT #include ``` -------------------------------- ### CLI: gs-process-data for Dataset Preprocessing Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Use the `gs-process-data` CLI tool to preprocess multi-view datasets. Supports various dataset types and initializers, with options for resolution and overwriting. ```bash # Basic COLMAP preprocessing from a raw image folder (vanilla format) gs-process-data \ --dataset vanilla \ --source_path ./data/raw_images \ --output_dir ./data/processed_colmap \ --init colmap \ --resolution 2 ``` ```bash # Polycam export with masks gs-process-data \ -d polycam \ -s ./data/polycam_scan \ -o ./data/processed_polycam \ --init colmap \ -w \ -r 1 \ --overwrite ``` ```bash # MvSNet dataset gs-process-data -d mvsnet -s ./data/mvs_scene -o ./out/mvs_processed ``` -------------------------------- ### Uninstall Target Creation Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/CMakeLists.txt Generates and adds a custom target for uninstalling the installed files. This ensures that users can cleanly remove the library if needed. ```cmake if (NOT TARGET uninstall) configure_file(cmake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY) add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake") endif() ``` -------------------------------- ### Create and Manipulate Camera Dataclass Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Illustrates the creation of a `Camera` object using rotation, translation, and field of view parameters. It also shows how to move the camera to a specific device (e.g., CUDA), downsample it, and perform backprojection of depth data to world-space points. ```python import numpy as np import torch from gaustudio import datasets # Construct a camera from known R, T, FoV R = np.eye(3, dtype=np.float32) T = np.array([0.0, 0.0, -3.0], dtype=np.float32) cam = datasets.Camera( R=R, T=T, FoVx=np.radians(60), FoVy=np.radians(45), image_width=1280, image_height=720, image_path="/data/scene/images/frame_000.jpg" ) print(cam) # Camera(FoVx=1.05, FoVy=0.79, image_width=1280, image_height=720, znear=0.1, zfar=100) print(cam.intrinsics) # tensor([[1109.2, 0.0, 640.0], # [ 0.0, 871.0, 360.0], # [ 0.0, 0.0, 1.0]]) # Move to CUDA cam = cam.to("cuda") # Downsample by factor 2 cam.downsample_scale(2) # Backproject depth to world-space point cloud # cam.depth must be a [H, W] float tensor world_pts = cam.depth2point(coordinate='world') # [H, W, 3] # Compute surface normals from depth normals_cam = cam.depth2normal(k=3, coordinate='camera') # [H, W, 3] normals_world = cam.normal2worldnormal(normals_cam) ``` -------------------------------- ### Vector Length Calculation (int) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Demonstrates how to get the length of a vector type using the `.length()` member function, which returns an `int` by default. ```cpp #include void foo(vec4 const& v) { int Length = v.length(); ... } ``` -------------------------------- ### Include GLM Headers Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Demonstrates how to include GLM headers for different usage scenarios. Use global headers for simplicity or separated headers for finer control over included functionality. ```c++ #include #include #include ``` ```c++ #include #include #include ``` ```c++ #include ``` -------------------------------- ### bitfieldExtract Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00043.html Extracts a specified number of bits from a value starting at a given offset. The extracted bits are placed in the least significant bits of the result. ```APIDOC ## bitfieldExtract ### Description Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result. ### Template Parameters * `length_t L`: The size of the vector. * `typename T`: The scalar type of the vector elements. * `qualifier Q`: The qualifier of the vector. ### Parameters * `Value` (vec< L, T, Q > const &): The vector from which to extract bits. * `Offset` (int): The starting bit position for extraction. * `Bits` (int): The number of bits to extract. ### Returns A vector containing the extracted bits in the least significant positions. ``` -------------------------------- ### Visualize Extracted Mesh with Plotly Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/gaustudio/demo/gaustudio.ipynb Loads a PLY mesh file using trimesh and visualizes it using Plotly. This requires `plotly` and `trimesh` to be installed. ```python import plotly.graph_objects as go import trimesh file="/content/extracted_mesh/fused_mesh.ply" # Load ply file mesh = trimesh.load_mesh(file) # Extract vertices and faces vertices = mesh.vertices faces = mesh.faces # Create Plotly mesh object mesh3d = go.Mesh3d( x=vertices[:, 0], y=vertices[:, 1], z=vertices[:, 2], i=faces[:, 0], j=faces[:, 1], k=faces[:, 2], color='lightblue', opacity=1 ) # Create Plotly figure fig = go.Figure(data=[mesh3d]) # Show the plot fig.show() ``` -------------------------------- ### Generate Camera Paths with Python Utilities Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Utilize Python functions from `gaustudio.cameras.camera_paths` to programmatically generate and manipulate camera trajectories, including orbits, cubemaps, and loading from JSON. ```python from gaustudio.cameras.camera_paths import ( get_path_from_orbit, get_path_from_cubemap, get_path_from_json, upsample_cameras_velocity, downsample_cameras, smoothen_cameras, validate_paths, orbit_camera, ) from gaustudio import models, renderers import torch, torchvision # Generate a 36-camera orbit around a scene center center = [0.0, 0.0, 0.0] cameras = get_path_from_orbit(cam_center=center, cam_radius=3.0, elevation=15, num_cam=36) # 6-view cubemap cameras cube_cams = get_path_from_cubemap(cam_center=center, cam_radius=2.0) # Load from saved cameras.json json_cams = get_path_from_json("./output/scene/cameras.json") ``` -------------------------------- ### backEaseInOut Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00318.html No description available. ```APIDOC GLM_FUNC_DECL genType glm::backEaseInOut( genType const & a ) ``` -------------------------------- ### Include All GLM Core and Extension Headers Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Include both core GLSL features and all GLM extensions for a comprehensive set of mathematical functionalities. Be aware that this can significantly increase build times. ```cpp // Include all GLM core / GLSL features #include // vec2, vec3, mat4, radians // Include all GLM extensions #include // perspective, translate, rotate glm::mat4 transform(glm::vec2 const& Orientation, glm::vec3 const& Translate, glm::vec3 const& Up) { glm::mat4 Proj = glm::perspective(glm::radians(45.f), 1.33f, 0.1f, 10.f); glm::mat4 ViewTranslate = glm::translate(glm::mat4(1.f), Translate); glm::mat4 ViewRotateX = glm::rotate(ViewTranslate, Orientation.y, Up); glm::mat4 View = glm::rotate(ViewRotateX, Orientation.x, Up); glm::mat4 Model = glm::mat4(1.0f); return Proj * View * Model; } ``` -------------------------------- ### mat<4, 2, T, Q> Constructors Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00171_source.html Provides various constructors for initializing a 4x2 matrix. ```APIDOC ## Constructors * `GLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;` Default constructor. * `template GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<4, 2, T, P> const& m);` Copy constructor. * `GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);` Constructor with a scalar value. * `GLM_FUNC_DECL GLM_CONSTEXPR mat(T x0, T y0, T x1, T y1, T x2, T y2, T x3, T y3);` Constructor with individual scalar components. * `GLM_FUNC_DECL GLM_CONSTEXPR mat(col_type const& v0, col_type const& v1, col_type const& v2, col_type const& v3);` Constructor with column vectors. ``` -------------------------------- ### Finding GLM with CMake Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Example of how to find and use the GLM library within a CMake build system. This ensures GLM is correctly located and linked for your project. ```cmake find_package(glm REQUIRED) add_executable(my_app main.cpp) target_link_libraries(my_app PRIVATE glm::glm) ``` -------------------------------- ### mat<2, 4, T, Q> Constructors Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00167_source.html Provides various constructors for initializing a 2x4 matrix, including default, scalar, and vector-based initializations. ```APIDOC ## Constructors ### Default Constructor ```cpp GLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT; ``` ### Copy Constructor ```cpp template GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<2, 4, T, P> const& m); ``` ### Scalar Constructor ```cpp GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar); ``` ### Value Constructor ```cpp GLM_FUNC_DECL GLM_CONSTEXPR mat( T x0, T y0, T z0, T w0, T x1, T y1, T z1, T w1); ``` ### Column Vector Constructor ```cpp GLM_FUNC_DECL GLM_CONSTEXPR mat( col_type const& v0, col_type const& v1); ``` ``` -------------------------------- ### Get Number of Components in GLM Types Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00138_source.html Returns the total number of components for a given GLM vector or matrix type. This is used to determine the range for iteration. ```cpp template inline length_t components(vec<1, T, Q> const& v) { return v.length(); } ``` ```cpp template inline length_t components(vec<2, T, Q> const& v) { return v.length(); } ``` ```cpp template inline length_t components(vec<3, T, Q> const& v) { return v.length(); } ``` ```cpp template inline length_t components(vec<4, T, Q> const& v) { return v.length(); } ``` ```cpp template inline length_t components(genType const& m) { return m.length() * m[0].length(); } ``` -------------------------------- ### glm::backEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00023_source.html Applies a back easing function that starts with a slight overshoot before settling into the ease. Modelled after the function y = x^3 - x*sin(3.1415926535*x). ```APIDOC ## glm::backEaseIn ### Description Applies a back easing function that starts with a slight overshoot before settling into the ease. Modelled after the function y = x^3 - x*sin(3.1415926535*x). ### Signature ```cpp template genType backEaseIn(genType const& a); ``` ### Parameters * **a** (genType const &) - The input value to ease. ### Return Value genType - The eased value. ``` -------------------------------- ### Matrix Transform for MVP (GLM) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Sets up a Model-View-Projection (MVP) matrix for rendering. This function utilizes perspective projection, translation, rotation, and scaling. ```cpp #include // vec3, vec4, ivec4, mat4 #include // translate, rotate, scale, perspective #include // value_ptr void setUniformMVP(GLuint Location, glm::vec3 const& Translate, glm::vec3 const& Rotate) { glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f); glm::mat4 ViewTranslate = glm::translate( glm::mat4(1.0f), Translate); glm::mat4 ViewRotateX = glm::rotate( ViewTranslate, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f)); glm::mat4 View = glm::rotate(ViewRotateX, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f)); glm::mat4 Model = glm::scale( glm::mat4(1.0f), glm::vec3(0.5f)); glm::mat4 MVP = Projection * View * Model; glUniformMatrix4fv(Location, 1, GL_FALSE, glm::value_ptr(MVP)); } ``` -------------------------------- ### saturation (matrix) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00013.html Build a saturation matrix. ```APIDOC template GLM_FUNC_DECL mat< 4, 4, T, defaultp > saturation(T const s) ``` -------------------------------- ### Find and Link GLM in CMake Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/test/cmake/CMakeLists.txt Configures a CMake project to find the GLM library and link an executable against it. Ensure GLM is installed or available in the CMake search path. ```cmake cmake_minimum_required(VERSION 3.2 FATAL_ERROR) project(test_find_glm) find_package(glm REQUIRED) add_executable(test_find_glm test_find_glm.cpp) target_link_libraries(test_find_glm glm::glm) ``` -------------------------------- ### GLM fmax with Epsilon Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Use `glm::fmax` from `` for maximum of two floats, preventing NaN propagation. This example shows how to use it with a default third argument. ```cpp #include // vec2 #include // fmax float positiveMax(float const a, float const b) { return glm::fmax(a, b, 0.0f); } ``` -------------------------------- ### packUnorm1x5_1x6_1x5 Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00119_source.html Packs a vec3 into a UNORM 1x5_1x6_1x5 format. ```APIDOC ## packUnorm1x5_1x6_1x5 ### Description Packs a vec3 into a UNORM 1x5_1x6_1x5 format. ### Parameters - **v** (const [vec3](a00281.html#ga9c3019b13faf179e4ad3626ea66df334)&) - The input vector. ### Returns A uint16 representing the packed data. ``` -------------------------------- ### Get Begin Iterator for GLM Types (Const) Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00138_source.html Returns a constant pointer to the beginning of the data for a GLM vector or matrix. This is used for range-based for loops with constant references. ```cpp template inline typename genType::value_type const * begin(genType const& v) { return value_ptr(v); } ``` -------------------------------- ### backEaseIn Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/doc/api/a00318.html No description available. ```APIDOC GLM_FUNC_DECL genType glm::backEaseIn( genType const & a ) ``` -------------------------------- ### load_config(*yaml_files, cli_args=[]) Source: https://context7.com/gap-lab-cuhk-sz/gaustudio/llms.txt Loads and merges one or more YAML configuration files with command-line argument overrides using OmegaConf. It resolves all interpolation expressions and returns a fully resolved config object. ```APIDOC ## `load_config(*yaml_files, cli_args=[])` — OmegaConf config loader Merges one or more YAML files with CLI-style key=value overrides using OmegaConf. Resolves all interpolation expressions (arithmetic resolvers: `add`, `sub`, `mul`, `div`, `idiv`; `basename`; `calc_exp_lr_decay_rate`) and returns a fully resolved config object. Used at the start of every script to unify YAML defaults with runtime arguments. ```python from gaustudio.utils.misc import load_config # Merge YAML with CLI overrides config = load_config( "gaustudio/configs/vanilla.yaml", cli_args=["dataset.source_path=/data/garden", "renderer.white_background=True", "optimizer.args.lr=0.0001"] ) print(config.dataset.source_path) # /data/garden print(config.renderer.white_background) # True print(config.model.pointcloud.name) # vanilla_pcd ``` ``` -------------------------------- ### GLM C++ Coding Style: Parentheses Spacing Source: https://github.com/gap-lab-cuhk-sz/gaustudio/blob/master/submodules/gaustudio-diff-gaussian-rasterization/third_party/glm/manual.md Shows the correct usage of spaces around parentheses in conditional statements according to GLM's style guide. ```cpp if(blah) // Yes ```