Declarative 3D for Kotlin Multiplatform & Jetpack Compose
Sigil is a powerful library that brings 3D rendering to your Compose Multiplatform applications using a familiar, declarative syntax. Built on top of the Materia engine, Sigil bridges the gap between the reactivity of Compose and the performance of low-level graphics APIs (Vulkan, WebGPU, Metal).
- Declarative Syntax: Build scenes with
Box,Sphere,Group, andLightcomposables. - Reactive State: Drive animations and scene updates using standard Compose state (
mutableStateOf,animate*AsState). - Multiplatform:
- 🖥️ JVM (Desktop): Vulkan-backed rendering.
- 🌐 Web (JS/Wasm): WebGPU/WebGL2 support.
- 📱 Android/iOS: (Coming Soon)
- PBR Materials: Physically Based Rendering for realistic lighting and materials.
- Zero Boilerplate: No manual loop management or context handling required.
Add Sigil to your commonMain dependencies in build.gradle.kts:
implementation("codes.yousef.sigil:sigil-compose:0.2.7.11")
implementation("codes.yousef.sigil:sigil-schema:0.2.7.11")
// For SSR with Ktor, Spring Boot, or Quarkus:
implementation("codes.yousef.sigil:sigil-summon:0.2.7.11")Create a stunning 3D scene in just a few lines of code:
import codes.yousef.sigil.compose.canvas.MateriaCanvas
import codes.yousef.sigil.compose.composition.*
import io.materia.core.math.Vector3
@Composable
fun RotatingCube() {
var rotationY by remember { mutableStateOf(0f) }
// Your animation logic here...
MateriaCanvas(modifier = Modifier.fillMaxSize()) {
// Lighting
AmbientLight(intensity = 0.5f)
DirectionalLight(position = Vector3(5f, 10f, 5f))
// Objects
Group(rotation = Vector3(0f, rotationY, 0f)) {
Box(
color = 0xFF4488FF.toInt(),
metalness = 0.5f,
roughness = 0.1f
)
}
}
}Explore the full guides and API reference:
Contributions are welcome! Please check our Contributing Guidelines before submitting a PR.
This project is licensed under the MIT License.
Built with ❤️ by CodeYousef