Crates.io | nuance |
lib.rs | nuance |
version | 0.3.2 |
source | src |
created_at | 2018-08-28 06:19:25.85715 |
updated_at | 2021-09-01 09:27:35.814684 |
description | A tool to run your shaders on the gpu. Also a good demo application for wgpu-rs. |
homepage | https://github.com/Gui-Yom/nuance |
repository | https://github.com/Gui-Yom/nuance |
max_upload_size | |
id | 81771 |
size | 164,273 |
A tool to run your shaders on the gpu.
Loaded with example shader : shaders/demo/foamy_water.frag
Made by k-mouse (2016-11-23) https://www.shadertoy.com/view/llcXW7
Install with cargo:
$ cargo install --locked nuance
See Development when building from source.
Or download a prebuilt binary from the Release page. Prebuilt binaries are currently available for Windows (x86_64-pc-windows-msvc) and Linux (x86_64-unknown-linux-gnu).
Run it as is or nuance -H
to force using the best gpu on your machine. By default, nuance selects
the less power-hungry gpu.
Nuance allows you tu run a custom fragment shader. You can also use a shader already compiled to SpirV directly given it was compiled with the Nuance header.
See the complete list of changes from GLSL in the manual.
You can specify additional parameters to your shader using a special interface block. When compiling your shader, parameters will be parsed from the source code to generate sliders and other appropriate UI elements. The shader source will then be transpiled to correct GLSL to be compiled. Example :
// layout(params) indicates that this block is the special one to be parsed.
layout(params) uniform Params {
// layout(min, max, init) to modify each parameters settings
layout(min = 0, max = 100, init = 1) float fSlider0;
layout(min = 0, max = 20) float fSlider1;
};
void main() {
// You can use special values like <param>.min and <param>.max, they will be replaced by the settings defined
// in the params block
fragColor = vec4(fSlider0 / fSlider0.max, fSlider1 / fSlider1.max, 0.0, 1.0);
}
"Hijacking" the layout qualifier allows me to use an existing GLSL parser. It parses those qualifiers as arbitrary identifiers which permits great flexibility.
This repository includes some examples under shaders/
. Some of these are not from me and are just
included here for demonstration purposes. They are the property of their respective owners.
We use shaderc-rs
to compile GLSL shaders to spirv. It is therefore highly recommended to install the
vulkan sdk and set the VULKAN_SDK
env var in order to find the prebuilt shaderc libraries. If not,
shaderc will download and build the vulkan libraries from source, which takes about 90% of this
entire application build time.
Ideas and tasks I should work on in no particular order.