# nvidia-rtx/rtxntc architecture

> Architecture diagram of the GitHub repository nvidia-rtx/rtxntc, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvidia-rtx/rtxntc
- Repository: https://github.com/nvidia-rtx/rtxntc

## Overview

##### Project Type and Purpose
- The project is an SDK focused on Neural Texture Compression for physically based (PBR) materials. It contains a core compression/decompression library (LibNTC) together with several sample applications and tools (a command-line interface, explorer, and renderer). The SDK demonstrates how textures can be compressed using neural network techniques and then decompressed either on-load or on-sample, with support for GPU acceleration (via DirectX 12 and Vulkan) and fallback implementations.
- Its purpose includes compressing multiple correlated texture channels into a single set, running efficient inference via a small MLP, and providing integration examples on texture decompression and transcoding to BCn formats.

##### Analyzing the File Structure
- Top-Level Folders & Files:
- Source/build configuration: CMakeLists.txt, .gitignore, .gitattributes, ChangeLog.md, LICENSE.txt.
- Assets: Contains sample materials (assets/materials) and models (assets/models) used for testing and demonstration.
- Documentation: Detailed guides and documents (docs/) covering usage, integration, command-line tool, renderer, manifest configurations, and images that illustrate the decoding pipeline.
- Libraries: Contains the core libraries such as RTXNTC-Library, ntc-utils, and the ntc.py module for automation.
- Samples: Includes the Renderer sample demonstrating integration of the NTC system with GLTF scene rendering.
- Support: Contains tests (BCTest and other utility scripts), additional CMake scripts, and supplementary Python tools for release packaging.
- Tools: Two main tools are provided:
- CLI Tool (tools/cli): Implements the ntc-cli for command-line compression/decompression.
- Explorer (tools/explorer): Provides a GUI-based tool for interactively experimenting with neural texture compression.
- External: Dependencies and integration support (e.g., DLSS, custom CMake modules for external libraries).

##### Using the README for Additional Insights
- The README clearly describes key architectural components such as compression (including latent parameter selection), decompression modes (on-load and on-sample), and the integration of cooperative vector extensions for GPU acceleration.
- Sections like “Integration Guide” highlight the modular nature of the components—a central LibNTC API supported by external tools and samples that illustrate its use.

- Use clear, descriptive labels for each component.
- Core libraries (e.g., LibNTC)
- Tools/applications (CLI tool, Explorer, Renderer)
- Support/auxiliary modules (tests, utilities, external dependencies)
- Infrastructure/Platform components (build system, GPU APIs).
- That each component’s role is visibly annotated (for example, “LibNTC: Handles neural network-based texture compression and decompression”).
- Notes on specific design choices, such as fallback inference paths (dp4a instructions) vs. cooperative vector paths.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure Layer
    subgraph "Infrastructure"
        build("Build System (CMake)"):::infra
        ext("External Dependencies"):::infra
    end

    %% Data Assets
    subgraph "Data Assets"
        mat("Materials"):::assets
        mod("Models"):::assets
    end

    %% Core API Layer
    subgraph "Core API"
        lib("LibNTC Library<br/>Handles neural network-based compression/decompression"):::core
        gpu("GPU Acceleration<br/>(DX12, Vulkan, CUDA)"):::infra
    end

    %% Tools & Applications Layer
    subgraph "Tools & Applications"
        cli("Command-Line Tool (ntc-cli)"):::tools
        exp("NTC Explorer"):::tools
        rend("NTC Renderer"):::tools
    end

    %% Support Layer
    subgraph "Support"
        tests("Tests & Support Modules"):::support
    end

    %% Connections from Infrastructure to Core and Tools
    build --> lib
    ext --> lib
    build --> cli
    ext --> cli
    build --> exp
    ext --> exp
    build --> rend
    ext --> rend

    %% Data Assets feed into Tools
    mat --> cli
    mat --> exp
    mat --> rend
    mod --> rend

    %% Tools call Core API
    cli -->|"callsAPI"| lib
    exp -->|"callsAPI"| lib
    rend -->|"callsAPI"| lib

    %% Support verifies functionality
    tests -->|"verifies"| lib
    tests -->|"verifies"| cli
    tests -->|"verifies"| exp
    tests -->|"verifies"| rend

    %% Core uses GPU Acceleration
    lib -->|"usesGPU"| gpu

    %% Click Events
    click lib "https://github.com/nvidia-rtx/rtxntc/tree/main/libraries/RTXNTC-Library"
    click cli "https://github.com/nvidia-rtx/rtxntc/tree/main/tools/cli"
    click exp "https://github.com/nvidia-rtx/rtxntc/tree/main/tools/explorer"
    click rend "https://github.com/nvidia-rtx/rtxntc/tree/main/samples/renderer"
    click tests "https://github.com/nvidia-rtx/rtxntc/tree/main/support/tests"
    click ext "https://github.com/nvidia-rtx/rtxntc/tree/main/external"
    click mat "https://github.com/nvidia-rtx/rtxntc/tree/main/assets/materials"
    click mod "https://github.com/nvidia-rtx/rtxntc/tree/main/assets/models"

    %% Styles
    classDef infra fill:#B3E5FC,stroke:#0277BD,stroke-width:2px;
    classDef core fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef tools fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
    classDef support fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef assets fill:#D1C4E9,stroke:#512DA8,stroke-width:2px;
```
