Skip to content
项目

关于

Kotlin Multiplatform 3D graphics wrapper for Google's Filament engine, featuring first-class Compose Multiplatform integration across Android, iOS, Desktop, and Web.

设计与媒体

这些数字如何统计

65 星标4 复刻 +1 24小时

实测星标增长

24小时
+1
7天
+1
15天
+2
1个月
+6

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Filament KMP

Maven Central License Filament Kotlin Compose Multiplatform

Filament KMP brings Google's Filament physically based renderer to Android, iOS, Desktop and Web from one Kotlin API, with an optional Compose Multiplatform layer on top.

▶ Try the live web demo — every sample scene, in your browser.

The same scene rendering on Android, iOS, Desktop and Web
FilamentSceneView(
    modifier       = Modifier.fillMaxSize(),
    cameraState    = rememberCameraState(initialEye = Position(0f, 1f, 4f)),
    postProcessing = PostProcessing(bloom = Bloom(strength = 0.2f)),
) {
    Skybox(color = LinearColor(0.1f, 0.12f, 0.15f))
    IndirectLight(irradiance = SphericalHarmonics.NeutralStudio)   // soft ambient, no file to load
    DirectionalLight(direction = Direction(0.3f, -1f, -0.5f), intensity = LightIntensity.LuminousPower(100_000f))
    GltfInstance(asset = rememberGltfAsset { Res.readBytes("files/Duck.glb") })
}
  • One API everywhere — the Kotlin API is written once in commonMain over a C API generated from Filament's headers, so it behaves the same on every platform.
  • Filament's own API — same classes, names and defaults as Filament's C++ API, so Filament's docs apply directly.
  • Compose optional — filament, gltfio, filament-utils and filamat are plain bindings: drive Engine / Renderer / SwapChain on your own surface, or render headless (guide).

[!NOTE] Unofficial project. A community-maintained wrapper, not affiliated with, endorsed by, or supported by Google or the Filament team.

Platforms

Platform Backend
Android (minSdk 24) OpenGL ES / Vulkan
iOS Metal
Desktop / JVM — macOS 11+, Windows 10+, Linux (glibc 2.38+) Metal / Vulkan / OpenGL, JDK 17+
Web (JS & Wasm) WebGL 2.0

Quick start

// settings.gradle.kts
dependencyResolutionManagement {
    repositories {
        mavenCentral()
        google()
    }
}
// build.gradle.kts
kotlin {
    sourceSets {
        commonMain.dependencies {
            // Compose integration (pulls in the engine), or just "…:filament:0.11.1" without Compose.
            implementation("io.github.erkko68.filament:filament-compose:0.11.1")
        }
    }
}

The same coordinates work on every target. Per-platform setup (iOS linking, Web prebuilts, Desktop natives) is in Getting Started.

Modules

Artifact Description
filament Core renderer — Engine, Scene, View, Renderer, Camera, Texture, Material.
filament-compose Compose Multiplatform integration — FilamentSceneView, scene DSL, camera state, post-processing.
gltfio glTF / GLB loading — AssetLoader, FilamentAsset, Animator.
filamat Runtime material compilation — MaterialBuilder.
filament-utils Camera manipulators, HDR/KTX loaders, math helpers.

All under io.github.erkko68.filament, one shared version. Coordinates and per-target dependencies: Modules.

Documentation

For engine concepts (PBR, lighting, materials), see Filament's own Engine and Materials docs.

Samples & showcase

License

Apache License 2.0. Filament itself is also Apache-2.0 licensed by Google.

探索相关项目

加载中…