Skip to content

Commit

Permalink
Change shadergraph to shadergarden where applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
slightknack committed Sep 8, 2021
1 parent ba5ca6c commit a8ef1ac
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions LISP.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# A Brief Introduction to shadergraph Lisp
# A Brief Introduction to Shader Garden Lisp
A `ShaderGraph` defines a directed graph of computation. The easiest way to create one for general use is through a small lispy configuration language. This language isn't Turing complete as it's meant for configuration - in this sense, the graph doesn't do any computation itself, it just *describes* how computation should be done.

## Getting Started
Expand All @@ -12,7 +12,7 @@ Let's look at a really basic example:
This shader graph has a single node called `texture`. All it does is immediately return the input texture. This isn't very exciting, but it works. To evaluate this shader graph from Rust, you need to hook it up to a glium context:

```rust
use shadergraph::{map, program::{graph_from_sexp, load_shaders}};
use shadergarden::{map, program::{graph_from_sexp, load_shaders}};

// Create the graph within a context
let context = /* create a glium context */;
Expand All @@ -37,7 +37,7 @@ A shader graph is made of `Node`s, and can have multiple inputs and outputs. Bec
## Using a Shader
Now that we know how to set everything up, let's write something a bit more complex - a shader that combines multiple textures!

Shader Graph use GLSL as its shading language. It's not too hard to pick up, but if you'd like to learn more before continuing I highly recommend you read through [The Book of Shaders](https://thebookofshaders.com/) and [Inigo Quilez's Website](https://iquilezles.org/). A shader is a program that runs a simple function on each pixel in parallel to produce an output.
Shader Garden use GLSL as its shading language. It's not too hard to pick up, but if you'd like to learn more before continuing I highly recommend you read through [The Book of Shaders](https://thebookofshaders.com/) and [Inigo Quilez's Website](https://iquilezles.org/). A shader is a program that runs a simple function on each pixel in parallel to produce an output.

A shader receives inputs through *uniforms*, which can be things like time, vectors, or even textures. By convention, we use the `u_` prefix to denote uniforms.

Expand Down Expand Up @@ -184,7 +184,7 @@ Functions can only return one argument, which is a bit of a limitation at the mo
>
> It's important to note that this wouldn't introduce any additional overhead. These programs define a shader graph, and two exactly-the-same shader graphs, even if defined in different ways, will run with exactly the same performance.
Finally, we'll cover some of Shader Graph Lisp's more advanced features.
Finally, we'll cover some of Shader Garden Lisp's more advanced features.
## Advanced Features
When writing GLSL shaders, it's common to use `#define` statements to define useful constants. For instance:
Expand All @@ -201,7 +201,7 @@ Loops in GLSL are unrolled at compile time, which means they must have a fixed n
But what if you have a shader that can applied in a lot of different situations, with each situation requiring slightly different constants? For example, what if we want to `SEARCH` to be smaller at high resolutions (so we do less work), or what if we want to search *backwards* by starting at `SEARCH` and decrementing `i` in other situations?
It may sound a bit crazy, but Shader Graph Lisp comes equipped has a *preprocessor preprocessor*. Like `#define`, this *pre-preprocessor* inserts useful constants at compiletime for later use. Unlike `#define`, however, these constants can be passed in through Shader Graph Lisp.
It may sound a bit crazy, but Shader Garden Lisp comes equipped has a *preprocessor preprocessor*. Like `#define`, this *pre-preprocessor* inserts useful constants at compiletime for later use. Unlike `#define`, however, these constants can be passed in through Shader Garden Lisp.
Here's a simple example:
Expand Down Expand Up @@ -323,7 +323,7 @@ In this sense, hot code reloading and ease of prototyping go hand-in-hand; the f
To try out hot code reloading, `cd` into `resource` and type `cargo run --release` (using `prime-run` if you have a GPU and don't want your computer to die.) This will load the shader graph specified in `shader.graph`, and begin executing it if no issues exist.
When you save after editing a shader, or the graph itself, `shadergraph` should detect your changes and recompile everything. If compilation succeeds, it'll switch out the old graph with the new; otherwise, it'll print the error and keep running the old one.
When you save after editing a shader, or the graph itself, `shadergarden` should detect your changes and recompile everything. If compilation succeeds, it'll switch out the old graph with the new; otherwise, it'll print the error and keep running the old one.
Happy hacking!
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
# `shadergraph`
# `shadergarden`

Shadergraph is a tool for building hot-code-reloadable shader pipelines. For a tutorial for how to get started, consult the [introductory blog post](https://blog.tonari.no/shadergraph) or the [shadergraph lisp language documentation](./LISP.md).
Shadergraph is a tool for building hot-code-reloadable shader pipelines. For a tutorial for how to get started, consult the [introductory blog post](https://blog.tonari.no/shadergarden) or the [shadergarden lisp language documentation](./LISP.md).

## Usage
Once you've installed shadergraph via `cargo install shadergraph`, test to see that it is installed properly by running:
Once you've installed shadergarden via `cargo install shadergarden`, test to see that it is installed properly by running:

```
shadergraph --help
shadergarden --help
```

This should print out some usage information. To create a new project, run:

```
shadergraph new path/to/project
shadergarden new path/to/project
```

This will create a new example project in the specified directory. To run a shadergraph, cd into the directory of a project and run:
This will create a new example project in the specified directory. To run a shadergarden, cd into the directory of a project and run:

```
shadergraph run
shadergarden run
```

This should open a new window and start running your graph. Don't close the window if you want to make changes; instead, open the project in an editor of your choice - the graph will update on save.

If a build error is encountered while reloading, `shadergraph` will log the error and continue executing the old graph.
If a build error is encountered while reloading, `shadergarden` will log the error and continue executing the old graph.

### Fancier Usage
You can pass input images and videos to shadergraph using the `-i` flag. This flag takes a list of paths to photos/videos - you must pass the same number of input photos/videos as the number of `(input ...)`s specified in `shader.graph`.
You can pass input images and videos to shadergarden using the `-i` flag. This flag takes a list of paths to photos/videos - you must pass the same number of input photos/videos as the number of `(input ...)`s specified in `shader.graph`.

Once you've got a nice shadergraph, to render out a png sequence, use the `render` subcommand. This subcommand works exactly the same as `run`, but requires an output directory. To render the game of life demo out into a gif, run:
Once you've got a nice shadergarden, to render out a png sequence, use the `render` subcommand. This subcommand works exactly the same as `run`, but requires an output directory. To render the game of life demo out into a gif, run:

```
mkdir out
shadergraph render demos/life -o out -s 30 -e 430
shadergarden render demos/life -o out -s 30 -e 430
ffmpeg -i "out/frame-%4d.png" -framerate 30 life.gif
```

Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct Render {
}

#[derive(StructOpt, Debug)]
#[structopt(name = "Shader Graph", bin_name = "shadergraph", about, global_settings(&[AppSettings::ColoredHelp, AppSettings::DeriveDisplayOrder]))]
#[structopt(name = "Shader Garden", bin_name = "shadergarden", about, global_settings(&[AppSettings::ColoredHelp, AppSettings::DeriveDisplayOrder]))]
enum Cli {
New(New),
Run(Run),
Expand Down Expand Up @@ -160,7 +160,7 @@ fn render(render: Render) {

// set up the main event loop
let (event_loop, display) = util::create(
"Shader Graph Renderer".to_string(),
"Shader Garden Renderer".to_string(),
args.width as f64,
args.height as f64,
);
Expand Down Expand Up @@ -249,7 +249,7 @@ fn run(args: Run) {

// set up the main event loop
let (event_loop, display) = util::create(
"Shader Graph Playground".to_string(),
"Shader Garden Playground".to_string(),
args.width as f64,
args.height as f64,
);
Expand Down

0 comments on commit a8ef1ac

Please sign in to comment.