Code Monkey home page Code Monkey logo

shadertoy-browser's Introduction

Rusty Shadertoy Browser

Crate Build Status Build Status MIT/Apache FOSSA Status

Small Shadertoy browser & viewer for Mac built in Rust.

This application uses the Shadertoy REST API to search for Shadertoys and then downloads them locally and converts them using shaderc-rs and spirv-cross to be natively rendered on Mac using 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 crate, which is also part of this repository in src/shadertoy

Render Output

Building

First make sure you have Rust installed installed. Then building & running is easy:

$ 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 shader

If the screen is red that indicates the shader wasn't able to be built.

Optional command-line settings:

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 found

OPTIONS:
    -k, --apikey <key>                Set shadertoy API key to use. Create your key on https://www.shadertoy.com/myapps
                                      [default: BtHtWD]
    -f, --filter <filter>...          Inclusion filters [values: VR, SoundOutput, SoundInput, Webcam, MultiPass,
                                      MusicStream]
    -y, --gridheight <grid_height>    Grid height [default: 4]
    -x, --gridwidth <grid_width>      Grid width [default: 4]
    -l, --limit <limit>               The maximum number of shaders to download. -1 = no limit [default: -1]
    -o, --order <order>               Sort order [default: Popular]  [values: Name, Love, Popular, Newest, Hot]
    -h, --resheight <res_height>      Window resolution height [default: 768]
    -w, --reswidth <res_width>        Window resolution width [default: 1024]
    -s, --search <string>             Search string to filter which shadertoys to get
    -t, --threads <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 crate, docs and README.

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:

FOSSA Status

Contribution

Contributions are welcome! Please note that your contributions are assumed to be dual-licensed under Apache-2.0/MIT.

shadertoy-browser's People

Contributors

dependabot-support avatar dependabot[bot] avatar expenses avatar fossabot avatar repi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shadertoy-browser's Issues

Build error on src/render_metal.rs:108

I'm getting the following error when i'm trying to build on MacOS:

warning: variable does not need to be mutable --> src/render_metal.rs:108:25

screen shot 2018-01-06 at 6 23 53 pm

I'm not a rust programmer, but I would like to try it out your rust application.

catalina - error: failed to run custom build command for `shaderc v0.3.16`

Compiling aho-corasick v0.7.6
error: failed to run custom build command for shaderc v0.3.16

Caused by:
process didn't exit successfully: /Users/johndpope/Documents/gitWorkspace/shadertoy-browser/test/release/build/shaderc-8859e5aa0099e6c0/build-script-build (exit code: 101)
--- stderr
thread 'main' panicked at '

couldn't find required command: "cmake"

', /Users/johndpope/.cargo/registry/src/github.com-1ecc6299db9ec823/shaderc-0.3.16/build/cmd_finder.rs:45:13
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...

I tried appending --target-dir to see if it helped - it didn't.
cargo build --release --target-dir test

Benchmark between GL and Metal

Nice project. How is the performance differs from OpenGL And Metal? Which one is better? If is Metal, what times it will be faster than GL?

If error "no default toolchain set: cargo build --release" then rustup install stable

In the process of writing this issue I solved it. Perhaps it might help someone... (will close).

cargo build --release
error: no override and no default toolchain set
uname -a
Linux studio 5.11.0-40-generic #44~20.04.2-Ubuntu SMP Tue Oct 26 18:07:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
rustup toolchain list
no installed toolchains

i fixed it with:

rustup install stable
rustup default stable

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.