2020-03-05
Nannou is an open source, creative coding framework for Rust. Today marks one of the biggest milestones for the project since its launch - the release of version 0.13.
This version is particularly special for our community as it opens the
floodgates for a lot of pending graphics work and paves the road ahead for
running nannou on the web!
Daily Sketch 1219 by Mactuitui using nannou.
While the main focus was graphics, this release also lands some serious patches and long-desired features. We'll cover this and more.
WebGPU is a new cross-platform standard for working with hardware accelerated graphics and compute. Despite having "Web" in the name, the standard lends itself incredibly well as a portable native solution for working with the GPU.
With 0.13, nannou gains support for this new standard via wgpu-rs - a Rust implementation of the standard driven by the gfx-rs community. Adopting wgpu results in a whole suite of nice new benefits for nannou users.
wgpu provides a promising path forward to running nannou on the web! WebGPU is in the process of being implemented by all major browsers and provides exciting new opportunities for easily sharing serious graphics and compute projects. While the web target is not quite ready today, the path ahead for running nannou sketches and apps online looks promising! You can track progress on the web target here.
wgpu targets Metal on macOS directly, rather than going through MoltenVK. This alone greatly simplifies the build process on macOS and closes around 20% of nannou's open issues!
The WebGPU standard has a vibrant and active community surrounding it and wgpu-rs has already been adopted by a number of projects over the past few years. The developers have been incredibly supportive making the adoption process very easy. kvark especially has been an exceptional help, and even has a commit in the new release. 0.13 would likely be another week or two away if it was not for your support, so thank you!
With the release of 0.13, nannou users can now easily and efficiently capture frames and save them to a file. This makes it much easier to screenshot, record and share sketches.
You can capture the next frame in its final state right before it is presented to the window like this:
window.capture_frame(path);
Daily Sketch 1220 by Mactuitui, updated for 0.13 and captured using this approach.
Sometimes its useful to capture your sketch at a much higher resolution than
what your window can support, especially stills intended for print. Nannou now
also supports this case by allowing users to draw to a much larger texture,
capturing it with the new TextureCapturer
type and simultaneously downscaling
for preview within the window. See the capture_hi_res.rs example for a demonstration of this.
Adopting wgpu-rs opens the door for a range of graphics-related updates that have been awaiting the overhaul. These include:
Draw
API has been missing the ability to
easily draw images, switch between blend modes, apply group transformations
and take advantage of the glyph cache when rendering text. These are all much
more easily addressable now that 0.13 has landed.Although it was a few months ago now, we wanted to use this opportunity to mention that we had a great time at the RustFest BCN workshop! We were overwhelmed by the attendance, and would like to apologise to those who couldn't find a seat or spare power socket due to the packed room.
Lasers and LEDs at the Creative Coding Workshop with @nannoucc at #rustfest pic.twitter.com/NhHWUELyBX
— Sophie G (@rarity2017) November 9, 2019
Thanks to Sophie for capturing this moment!
If you are interested in organising a nannou workshop near you, feel free to get in touch via contact@nannou.cc.
Since we announced the project almost a year and a half ago, nannou has grown from a small three-person team into a small community. Feel free to join us!
Most of us hang out in the nannou slack and would be more than happy to meet you and chat about all things creative coding and nannou :)
Whether you made a fancy sketch or just got an ellipse drawing to the screen, feel free to share it with us on twitter @nannoucc! The #nannou hashtag also has lots of awesome creations from the community.
Daily Sketch 0114 by Mactuitui
If you would like to help us spend more time on nannou, consider becoming a contributor at our Open Collective page.