Update CLI help and README
This commit is contained in:
parent
6619b079c6
commit
62bff79339
2 changed files with 17 additions and 68 deletions
73
README.md
73
README.md
|
@ -3,7 +3,7 @@
|
|||
|
||||

|
||||
|
||||
<p align=center>Color grading with code.</p>
|
||||
<p align=center>Use Godot's GLSL dialect for color grading and more.</p>
|
||||
|
||||
|
||||
## Table of Contents
|
||||
|
@ -31,56 +31,7 @@ If you want to learn GDShader, take a look at the [Godot docs](https://docs.godo
|
|||
|
||||
**To get started, use the project template (see the Releases section of this repo) and open it in Godot.**
|
||||
|
||||
The template includes many examples. You can use them as a starting-point to write your own stuff.
|
||||
|
||||
Besides the regular GDShader stuff, Pigment has so-called directives. Those allow to further control the behaviour of the application. **The most important directive is `//!load` to load an image.**
|
||||
|
||||
|
||||
### Load TEXTURE using the `//!load` directive
|
||||
|
||||
```glsl
|
||||
//!load <filepath>
|
||||
```
|
||||
|
||||
The main image file will be read and available as the sampler2D `TEXTURE`.
|
||||
|
||||
|
||||
#### Load additional images
|
||||
|
||||
```glsl
|
||||
//!load+ <name> <filepath>
|
||||
|
||||
uniform sampler2D <name>;
|
||||
```
|
||||
|
||||
Have a look at the `place_texture.gdshader` example.
|
||||
|
||||
|
||||
### Have multiple steps with `//!steps n`
|
||||
|
||||
You can apply your shaderfile multiple times. At every additional step, `TEXTURE` is the result of the previous step. This can be used to chain effects that cannot be easily chained otherwise.
|
||||
|
||||
To query the current step index, a `STEP` uniform is automatically injected. If `steps` is set to `0`, your shader won't be applied at all.
|
||||
|
||||
Example:
|
||||
|
||||
```glsl
|
||||
//!load ...
|
||||
//!steps 5
|
||||
|
||||
uniform int STEP;
|
||||
uniform int STEPS;
|
||||
|
||||
void fragment() {
|
||||
if (STEP == 0) {
|
||||
...
|
||||
} else if (STEP == 1) {
|
||||
...
|
||||
} else if (STEP == STEPS-1) {
|
||||
...
|
||||
}
|
||||
}
|
||||
```
|
||||
The template includes examples that you can use as a starting-point to write your own stuff.
|
||||
|
||||
|
||||
## Shaderlib
|
||||
|
@ -95,8 +46,6 @@ shader_type canvas_item;
|
|||
|
||||
#include "./shaderlib/oklab.gdshaderinc"
|
||||
|
||||
//!load ./images/swamp.jpg
|
||||
|
||||
void fragment() {
|
||||
vec4 oklab = rgb2oklab(COLOR);
|
||||
vec4 oklch = oklab2oklch(oklab);
|
||||
|
@ -117,7 +66,7 @@ You can run Pigment from the commandline or scripts.
|
|||
|
||||
```
|
||||
~ Pigment CLI ~
|
||||
-================-
|
||||
-=============-
|
||||
|
||||
Usage:
|
||||
|
||||
|
@ -134,19 +83,19 @@ Commands:
|
|||
| Applies a shader file.
|
||||
|
||||
--shader PATH The path to the shader
|
||||
--input PATH The path to the input image.
|
||||
Passing a folder activates batch mode.
|
||||
--output PATH Where to write the resulting image to.
|
||||
In batch mode, this must be a folder.
|
||||
--input PATH The path to the image
|
||||
Passing a folder activates batch mode
|
||||
--output PATH Where to write the resulting image to
|
||||
In batch mode, this must be a folder
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Batch Mode
|
||||
|
||||
Since version v8.0, you can pass a directory to `--input` and `--output`. This will process all images in the input directory and write the output to the output directory.
|
||||
You can pass a directory to `--input` and `--output`. This will process all images in the input directory and write the output to the output directory.
|
||||
|
||||
> Note: You *can* use this feature for video frames, but it will take a loooong time.
|
||||
> Note: This is not very fast, so using it on maaany images may take some time.
|
||||
|
||||
|
||||
#### Examples
|
||||
|
@ -158,5 +107,5 @@ Since version v8.0, you can pass a directory to `--input` and `--output`. This w
|
|||
|
||||
## Known Issues
|
||||
|
||||
- screen scaling is unsupported; Using screen scaling could lead to an either blurry UI, or no scaling at all -> see #45
|
||||
- commandline interface: `--headless` is not supported
|
||||
- On some systems, screen scaling could lead to an either blurry UI, or no scaling at all
|
||||
- CLI: Godot's `--headless` option is not supported
|
||||
|
|
10
src/Main.gd
10
src/Main.gd
|
@ -13,13 +13,13 @@ func show_help():
|
|||
"Commands:\n\n",
|
||||
" help\n\n",
|
||||
" | Shows this help text.\n\n",
|
||||
" apply --shader PATH [--load-image PATH]\n\n",
|
||||
" apply --shader PATH --input PATH --output PATH\n\n",
|
||||
" | Applies a shader file.\n\n",
|
||||
" --shader PATH The path to the shader\n",
|
||||
" --input PATH The path to the image.\n",
|
||||
" Passing a folder activates batch mode.\n",
|
||||
" --output PATH Where to write the resulting image to.\n",
|
||||
" In batch mode, this must be a folder.\n")
|
||||
" --input PATH The path to the image\n",
|
||||
" Passing a folder activates batch mode\n",
|
||||
" --output PATH Where to write the resulting image to\n",
|
||||
" In batch mode, this must be a folder\n")
|
||||
|
||||
func parse_custom_cmdline(args: PackedStringArray):
|
||||
var kwargs: Dictionary = {"--shader": null, "--output": null, "--input": null}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue