#3d #opengl #webgl #3d-rendering #graphics #opengl-rendering #gamedev

three-d

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

38 releases

0.17.0 Feb 26, 2024
0.16.3 Nov 9, 2023
0.15.0 Mar 14, 2023
0.14.0 Nov 4, 2022
0.1.0 Mar 22, 2020

#6 in Rendering

Download history 283/week @ 2023-12-07 250/week @ 2023-12-14 141/week @ 2023-12-21 120/week @ 2023-12-28 192/week @ 2024-01-04 256/week @ 2024-01-11 201/week @ 2024-01-18 236/week @ 2024-01-25 252/week @ 2024-02-01 261/week @ 2024-02-08 219/week @ 2024-02-15 560/week @ 2024-02-22 521/week @ 2024-02-29 427/week @ 2024-03-07 414/week @ 2024-03-14 236/week @ 2024-03-21

1,740 downloads per month
Used in 7 crates (6 directly)

MIT license

620KB
14K SLoC

three-d 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 efficiently draw exactly what you want.

three-d

  • targets those who just want to draw something and those who want to avoid the tedious setup but still wants low-level access.
  • makes it possible to combine high-level features with custom low-level implementations for example custom shaders.
  • tries to do stuff in a few simple lines of code.
  • aims to be as explicit as possible so there is no surprises for you - no hidden magic.
  • targets 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)

Quotes

Quotes from issues, discussions and pull requests:

..., thanks for writing such a nice 3d crate. I'm able to get what I want done without thousands of lines of boilerplate. It's truly a pleasure.

I must say: Man, you did a hell of a job with this library! It's really beyond performant, easy and understanable to use and I am grateful, you made it open source! Thank you so much.

Thank you for making such a great 3d tool, It has been such a great use to me as most other rust based 3d tooling is either too low level, or a whole fully fledged game engine which does not fit my needs.

First off, three-d is a joy to work with, even for someone with little experience in Rust (though admittedly, I do have some experience working with OpenGL).

Thanks for offering a really cool and simple to get started 3D Library in rust :)

Hi, thanks for such a cool and easy-to-use project!

Thanks for this library, it's been a joy to work with so far!

First of, Great job for the library and therefore thank you!

Thanks so much for this library, it's looking excellent!

Thanks for the great project.

This project has been wonderful to use so far, thank you so much for you time and dedication.

Structure

The crate consist of three main modules for drawing, context, core and renderer, and an optional window module for easy setup:

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, 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. Features include functionality to 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.
window (requires the "window" feature) Window functionality on cross-platform native and web, which primarily is provided to make it easy to get started. In some cases, it is desirable to replace the default Window with a custom winit window as exemplified in the winit_window example. However, this module can also be replaced entirely by anything that provides an OpenGL or WebGL2 graphics context, for example winit and glutin, wasm-bindgen or eframe.

In addition, the three-d-asset crate enables loading, deserializing, serializing and saving 3D assets, for example 3D models, textures etc. Please make sure to use the same version of three-d-asset as defined in the Cargo.toml.

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 to the web version of the examples.

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 (see web/README.md)
  • 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–23MB
~267K SLoC