https://github.com/repi/shadertoy-browser
Shadertoy browser & viewer for Mac built in Rust
https://github.com/repi/shadertoy-browser
metal rust shaders shadertoy
Last synced: 7 months ago
JSON representation
Shadertoy browser & viewer for Mac built in Rust
- Host: GitHub
- URL: https://github.com/repi/shadertoy-browser
- Owner: repi
- License: apache-2.0
- Created: 2017-12-27T08:31:20.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-04-30T22:18:50.000Z (over 4 years ago)
- Last Synced: 2025-03-06T15:15:24.527Z (7 months ago)
- Topics: metal, rust, shaders, shadertoy
- Language: Rust
- Homepage:
- Size: 1.17 MB
- Stars: 208
- Watchers: 8
- Forks: 11
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# Rusty Shadertoy Browser
[](https://crates.io/crates/shadertoy-browser)
[](https://travis-ci.org/repi/shadertoy-browser)
[](https://ci.appveyor.com/project/repi/shadertoy-browser)

[](https://app.fossa.io/projects/git%2Bgithub.com%2Frepi%2Fshadertoy-browser?ref=badge_shield)Small [Shadertoy](http://shadertoy.com) browser & viewer for Mac built in [Rust](https://www.rust-lang.org).
This application uses the [Shadertoy REST API](http://shadertoy.com/api) to search for Shadertoys and then downloads them locally and converts them using [`shaderc-rs`](https://crates.io/crates/shaderc) and [`spirv-cross`](https://crates.io/crates/spirv_cross) to be natively rendered on Mac using [`metal-rs`](https://crates.io/crates/metal-rs).
Warning: Some of the Shadertoy shaders are extremely demanding of your GPU and cause system to be unresponsive.
The API queries are done through the [`shadertoy`](https://crates.io/crates/shadertoy) crate, which is also part of this repository in [`src/shadertoy`](src/shadertoy)

## Building
First make sure you have [Rust installed](https://www.rust-lang.org/en-US/install.html) installed.
Then building & running is easy:```sh
$ git clone https://github.com/repi/shadertoy-browser
$ cd shadertoy-browser
$ cargo build --release# this will download and view all shadertoys with "car" in the name
$ cargo run --release -- -s car
```## Usage
Keys:
- `LEFT` and `RIGHT` - switch between shadertoys.
- `SPACE` - toggle grid view mode
- `ENTER` - open shadertoy.com for current shaderIf the screen is red that indicates the shader wasn't able to be built.
Optional command-line settings:
```text
USAGE:
shadertoy-browser [FLAGS] [OPTIONS]FLAGS:
--help Prints help information
-h, --headless Don't render, only download shadertoys
-V, --version Prints version information
-v, --verbose More verbose log output, including list of all shadertoys foundOPTIONS:
-k, --apikey Set shadertoy API key to use. Create your key on https://www.shadertoy.com/myapps
[default: BtHtWD]
-f, --filter ... Inclusion filters [values: VR, SoundOutput, SoundInput, Webcam, MultiPass,
MusicStream]
-y, --gridheight Grid height [default: 4]
-x, --gridwidth Grid width [default: 4]
-l, --limit The maximum number of shaders to download. -1 = no limit [default: -1]
-o, --order Sort order [default: Popular] [values: Name, Love, Popular, Newest, Hot]
-h, --resheight Window resolution height [default: 768]
-w, --reswidth Window resolution width [default: 1024]
-s, --search Search string to filter which shadertoys to get
-t, --threads How many threads to use for downloading & processing shaders. 0 = disables
threading, -1 = use all logical processors [default: -1]
```To use the Rust shadertoy API directly in another app or library, check out the [`shadertoy`](https://crates.io/crates/shadertoy) crate, [docs](http://docs.rs/shadertoy) and [README](src/shadertoy/README.MD).
## Todo
This repo and app is a bit of an experimental Rust test range, and it is not intended to support everything or all shadertoys. But here are a couple of things I would like to implement going forward:
- [ ] Rendering on Windows using DX12 and DXC
- [ ] Rendering backend using SPIRV
- [ ] Be able to click to select a shadertoy in grid view
- [ ] Basic IMGUI for interactive searching & filtering
- [ ] Async future based version of the Shadertoy client REST API
- [ ] Async background download and building of shadertoys
- [ ] Proper key-value cache store instead of files
- [ ] Support shadertoys that use textures & buffers
- [ ] Support shadertoys that use multiple passes
- [ ] Support shadertoys that use keyboard input## License
Licensed under either of the following, at your option:
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)[](https://app.fossa.io/projects/git%2Bgithub.com%2Frepi%2Fshadertoy-browser?ref=badge_large)
### Contribution
Contributions are welcome! Please note that your contributions are assumed to be dual-licensed under Apache-2.0/MIT.