MCPcopy Index your code
hub / github.com/dimforge/kiss3d

github.com/dimforge/kiss3d @v0.45.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.45.0 ↗ · + Follow
2,458 symbols 6,674 edges 211 files 1,261 documented · 51%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

crates.io

Build status crates.io

Keep It Simple, Stupid 3D and 2D graphics engine.

This library is born from the frustration that today’s 3D graphics library are either:

  • Too low level: you have to write your own shaders and opening a window takes 8 hours, 300 lines of code and 10L of coffee.
  • High level, but too hard to understand/use: these libraries are made to create beautiful photoreal (or close to it) animations or games. They have many features; too many, in fact, if you just want to draw a few objects on the screen with as little friction as possible.

kiss3d is not designed to be feature-complete or fast. It is designed to let you draw simple geometric figures and play with them with as little friction as possible.

Features

  • WASM compatible.
  • Out of the box, open a window with a default arc-ball camera and a point light.
  • First-person camera available as well, and user-defined cameras are possible.
  • Render boxes, spheres, cones, cylinders, quads and lines simply
  • Change an object's color or texture.
  • Change an object's transform.
  • Create basic post-processing effects.

As an example, creating a scene with a red, rotating cube with a light attached to the camera is as simple as:

use kiss3d::prelude::*;

#[kiss3d::main]
async fn main() {
  let mut window = Window::new("Kiss3d: cube").await;
  let mut camera = OrbitCamera3d::default();
  let mut scene = SceneNode3d::empty();
  scene
          .add_light(Light::point(100.0))
          .set_position(Vec3::new(0.0, 2.0, -2.0));

  let mut c = scene.add_cube(1.0, 1.0, 1.0).set_color(RED);

  let rot = Quat::from_axis_angle(Vec3::Y, 0.014);

  while window.render_3d(&mut scene, &mut camera).await {
    c.rotate(rot);
  }
}

This code works on both native platforms and WASM without any changes! The #[kiss3d::main] macro and async rendering API handle the platform differences automatically:

  • On native: The async runtime is managed with pollster::block_on
  • On WASM: The async function integrates with the browser's event loop via requestAnimationFrame

This approach eliminates the need for platform-specific code or managing different entry points, making it simple to write truly cross-platform 3D applications.

Some controls are handled by default by the engine (they can be overridden by the user):

  • scroll: zoom in / zoom out.
  • left click + drag: look around.
  • right click + drag: translate the view point.
  • enter: look at the origin (0.0, 0.0, 0.0).

Compilation

You will need the last stable build of the rust compiler and the official package manager: cargo.

Simply add the following to your Cargo.toml file:

[dependencies]
kiss3d = "0.37"

Optional Features

Recording

Kiss3d supports recording your 3D scene to MP4 video files. This feature requires FFmpeg to be installed on your system.

Install FFmpeg: - macOS: brew install ffmpeg - Ubuntu/Debian: sudo apt install ffmpeg libavcodec-dev libavformat-dev libavutil-dev libswscale-dev - Windows: Download from ffmpeg.org and add to PATH

Enable the feature in your Cargo.toml:

[dependencies]
kiss3d = { version = "0.40", features = ["recording"] }

Egui Integration

For immediate mode GUI support, enable the egui feature:

[dependencies]
kiss3d = { version = "0.40", features = ["egui"] }

Extension points exported contracts — how you extend this code

Camera3d (Interface)
Trait that all camera implementations must implement. Cameras control the viewpoint from which the 3D scene is rendered [6 …
src/camera/camera3d.rs
PostProcessingEffect (Interface)
Trait for implementing custom post-processing effects. Post-processing effects are applied after the 3D scene has been [9 …
src/post_processing/post_processing_effect.rs
GpuData (Interface)
Per-object GPU data for a material. This trait is implemented by material-specific structs that hold per-object GPU res [7 …
src/resource/material.rs
PolylineCompatibleCap (Interface)
Trait to be implemented by caps compatible with a `PolylinePattern`. [2 implementers]
src/procedural/path/polyline_pattern.rs
Renderer3d (Interface)
Trait for implementing custom rendering logic. Implement this trait to create custom renderers that can draw additional [2 …
src/renderer/renderer.rs
Camera2d (Interface)
Trait that all 2D camera implementations must implement. 2D cameras control the view for 2D overlays and scene elements [2 …
src/camera/camera2d.rs
Material3d (Interface)
Trait implemented by materials. Materials define how objects are rendered. The material itself holds shared resources ( [4 …
src/resource/material.rs
CurveSampler (Interface)
A curve sampler. [1 implementers]
src/procedural/path/path.rs

Core symbols most depended-on inside this repo

push
called by 281
src/resource/dynamic_buffer.rs
unwrap
called by 231
src/procedural/render_polyline.rs
set_position
called by 176
src/scene/scene_node2d.rs
set_color
called by 172
src/scene/object2d.rs
iter
called by 162
src/event/event_manager.rs
len
called by 81
src/scene/sprite.rs
add_cube
called by 80
src/scene/scene_node3d.rs
create_bind_group_layout
called by 80
src/context/context.rs

Shape

Method 1,821
Function 310
Class 279
Enum 38
Interface 10

Languages

Rust100%
TypeScript1%

Modules by API surface

src/scene/scene_node3d.rs224 symbols
src/scene/object3d.rs150 symbols
src/scene/scene_node2d.rs127 symbols
src/window/window.rs83 symbols
src/scene/object2d.rs58 symbols
src/camera/orbit3d.rs53 symbols
src/window/wgpu_canvas.rs51 symbols
src/builtin/object_material.rs50 symbols
src/camera/first_person3d.rs48 symbols
src/builtin/shadow.rs46 symbols
src/resource/mesh3d.rs42 symbols
src/post_processing/gi2d.rs38 symbols

For agents

$ claude mcp add kiss3d \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact