Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add Lua instructions and example to README
  • Loading branch information
matthewdean committed Jan 30, 2024
commit 20e3a0291c10ec2f0e1f3e3ca3d73933c335ae7f
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Mixbox is shipping in Rebelle 5 Pro as the [Rebelle Pigments](https://www.escape
- [Unity](unity): add package from git url `git://github.com/scrtwpns/mixbox.git#upm`
- [Godot](godot): copy `godot\addons` to the root of your project
- [Shaders](shaders): load `mixbox_lut.png` as texture and include `mixbox.glsl`/`.hlsl`/`.metal` code into your shader
- [Lua](lua): add the `.lua` files from `lua` to the root of your project

## Pigment Colors
| Pigment | | RGB | Float RGB | Linear RGB |
Expand Down Expand Up @@ -346,6 +347,20 @@ gl.bindTexture(gl.TEXTURE_2D, mixbox.lutTexture(gl));
gl.uniform1i(gl.getUniformLocation(shaderProgram, "mixbox_lut"), 0);
```

## Lua

```lua
local mixbox = require("mixbox")

local rgb1 = {0, 33, 133} -- blue
local rgb2 = {252, 211, 0} -- yellow
t = 0.5 -- mixing ratio

local rgb = mixbox.lerp(rgb1, rgb2, t)

print(table.unpack(rgb))
```

## Examples

| Gradients | Mountains | Palette Snakes |
Expand Down