#3d #gamedev #webassembly #opengl #webgl

three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)

28 releases (11 breaking)

Uses new Rust 2021

new 0.12.2 Jun 30, 2022
0.11.3 May 2, 2022
0.10.2 Feb 14, 2022
0.9.1 Dec 5, 2021
0.1.0 Mar 22, 2020

#35 in WebAssembly

Download history 78/week @ 2022-03-12 97/week @ 2022-03-19 13/week @ 2022-03-26 47/week @ 2022-04-02 486/week @ 2022-04-09 297/week @ 2022-04-16 576/week @ 2022-04-23 1288/week @ 2022-04-30 943/week @ 2022-05-07 787/week @ 2022-05-14 508/week @ 2022-05-21 422/week @ 2022-05-28 380/week @ 2022-06-04 241/week @ 2022-06-11 266/week @ 2022-06-18 110/week @ 2022-06-25

1,130 downloads per month
Used in three-d-gltf-import

MIT license

565KB
13K SLoC

Logo

three-d

crates.io Docs.rs Continuous integration MIT licensed

What is it?

A OpenGL/WebGL/OpenGL ES renderer which seeks to make graphics simple but still have the power to draw exactly what you want.

three-d

  • makes it possible to combine high-level features with custom shaders so you can focus on the important stuff.
  • can be used by those without any graphics experience and who just want to draw something.
  • tries to do stuff in a few simple lines of code.
  • aims to be as explicit as possible so there is no surprices for you - no hidden magic.
  • targets both desktop, web and mobile.

three-d can for example be used for

  • data visualization
  • image processing
  • UI rendering
  • tools (2D or 3D)
  • games (2D or 3D)

The crate consist of three main modules for drawing, context, core and renderer, and two optional utility modules, io and window:

Module Description
context Low-level rendering module - requires a solid understanding of graphics concepts. Gives you complete control over both setup and rendering.
core Mid-level rendering module - requires at least some knowledge about graphics concepts. Use this if you want to write your own shaders and but don't want to spend time on setup and error handling. Can be combined with low-level functionality in the context module.
renderer High-level rendering module - requires no knowledge about graphics concepts. Use this if you just want to draw something on the screen. Features include methods for rendering different types of standard objects with different types of shading. Can be combined seamlessly with the mid-level features in the core module as well as functionality in the context module.
io [Deprecated: Use the three-d-asset crate instead.] Contains functionality to load any type of asset runtime on both native and web as well as parsers for different image and 3D model formats. Also includes functionality to save data which is limited to desktop.
window (requires the "window" feature) Contains functionality for creating a window on both cross-platform native and web. Also contain render loop, event handling and camera control functionality. Can be replaced by anything that provides an OpenGL or WebGL2 graphics context, for example eframe as shown in this example.

Examples

PBR example

Several examples covering most features can be found in the examples folder.

Here you will also find an overview of the examples, build instructions and links where you can try out each example on web.

The examples that fit with a specific release can be found in the branch for that release, ie. the examples for the 0.9 release can be found in the 0.9 branch.

Support

three-d is supported

  • on all major desktop OS (Windows, Mac, Linux) by using OpenGL 3.3 graphics API. Note: MacOS has deprecated OpenGL so it still works, but it might not perform optimally.
  • in all major browsers (Chrome, Firefox, Edge and Safari) by compiling to WebAssembly and using the WebGL 2.0 graphics API.
  • on embedded/mobile systems with OpenGL ES 3.0 support. Note: this is not tested regularly, please report any issues.

State of the project

Most parts are relatively stable, but do expect regular breaking changes until a 1.0.0 release. The master branch is work in progress, so if you want to avoid too many breaking changes and features not working, use a released version. If possible and feasible, functionality will be deprecated in one release before it is removed in the next release.

Contributing

Feature requests and bug reports are more than welcome, just open an issue or start a discussion. Contributions are highly appreciated, please feel free to reach out or simply create a pull request against the master branch. To avoid waste of time, please reach out before making major changes.

Dependencies

~4–16MB
~305K SLoC