2024-06-09 16:25:55 +02:00
2024-12-19 16:48:32 +01:00
< h1 align = center > Fragmented< / h1 >
2024-06-09 16:25:55 +02:00

2025-01-24 21:56:37 +01:00
< p align = center > An image editing/compositing software for graphics programmers.< / p >
2024-06-09 16:44:28 +02:00
2025-01-24 21:44:41 +01:00
## Table of Contents
- [Supported Platforms ](#supported-platforms )
- [Usage ](#usage )
- [Shaderlib ](#shaderlib )
- [Commandline interface ](#commandline-interface )
- [Known Issues ](#known-issues )
2024-06-09 16:44:28 +02:00
## Supported Platforms
2024-06-21 10:33:34 +02:00
- Linux
2024-06-09 16:44:28 +02:00
2024-12-19 16:48:32 +01:00
You can find the latest releases [here ](https://github.com/ChaoticByte/Fragmented/releases/latest ).
2024-06-09 16:44:28 +02:00
## Usage
2025-01-24 21:56:37 +01:00
With Fragemented, you are editing images by writing GDShaders. This brings almost endless opportunities to create unique art.
If you want to learn GDShader, take a look at the [Godot docs ](https://docs.godotengine.org/en/stable/tutorials/shaders/ ).
The repo also includes examples. You can use them as a starting-point to write your own filters.
Besides the regular GDShader stuff, Fragmented also has so-called directives. Those allow to further control the behaviour of the application. The most important directive is `//!load` to load an image.
2024-06-09 16:44:28 +02:00
2024-12-19 18:52:47 +01:00
### Load TEXTURE using the `//!load` directive
```glsl
//!load < filepath >
```
2025-01-06 22:11:53 +01:00
The main image file will be read and available as the sampler2D `TEXTURE` .
2024-12-19 18:52:47 +01:00
#### Load additional images
2024-06-09 16:44:28 +02:00
```glsl
2024-12-21 18:27:21 +01:00
//!load+ < name > < filepath >
2025-01-01 21:43:32 +01:00
2024-06-09 16:44:28 +02:00
uniform sampler2D < name > ;
```
2025-01-01 21:43:32 +01:00
Have a look at the `place_texture.gdshader` example.
2024-12-22 23:04:35 +01:00
2025-01-06 22:11:53 +01:00
### 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
void fragment() {
if (STEP == 0) {
2025-01-06 22:15:00 +01:00
...
2025-01-06 22:11:53 +01:00
} else if (STEP == 1) {
2025-01-06 22:15:00 +01:00
...
2025-01-06 22:11:53 +01:00
}
// ... and so on
}
```
2024-12-22 23:04:35 +01:00
## Shaderlib
2025-01-22 07:19:56 +01:00
> Note: The shaderlib API is still unstable as I am figuring things out. It will be declared stable with version 10.
2025-01-01 21:43:32 +01:00
This repo comes with a (still small) shader library including pre-written functions and more.
2024-12-22 23:04:35 +01:00
Have a look at the `shaderlib` folder.
2025-01-01 21:43:32 +01:00
Here is an example:
2024-12-22 23:04:35 +01:00
```glsl
shader_type canvas_item;
#include "res://shaderlib/hsv.gdshaderinc"
2025-01-08 20:53:45 +01:00
//!load ./examples/images/swamp.jpg
2024-12-22 23:04:35 +01:00
void fragment() {
COLOR = hsv_offset(COLOR, 0.32, 0.2, 0.0);
}
```
2025-01-19 12:51:10 +01:00
## Commandline interface
You can run Fragmented from the commandline or scripts.
> Note: Headless mode is not supported. Using the commandline interface still opens a window.
### Usage
```
./Fragmented cmd --shader PATH [--load-image PATH]
--shader PATH The path to the shader
--output PATH Where to write the resulting image to
--load-image PATH The path to the image. This will overwrite the
load directive of the shader file (optional)
```
You can also run `./Fragmented cmd help` to show the help message.
#### Examples
```
./Fragmented cmd --shader ./examples/oklab.gdshader --output ./output.png
```
```
./Fragmented cmd --shader ./examples/oklab.gdshader --load-image ~/Pictures/test.png --output ./output.png
```
2025-01-24 21:44:41 +01:00
## Known Issues
- screen scaling is unsupported; Using screen scaling could lead to an either blurry UI, or no scaling at all -> see #45
- the shaderlib API is still unstable, this will change with version 10
- commandline interface: `--headless` is not supported