Skip to content

Instantly share code, notes, and snippets.

@m-radzikowski
Last active May 12, 2026 23:07
Show Gist options
  • Select an option

  • Save m-radzikowski/370608cafa9517490579159cc3a3e1a7 to your computer and use it in GitHub Desktop.

Select an option

Save m-radzikowski/370608cafa9517490579159cc3a3e1a7 to your computer and use it in GitHub Desktop.
Godot LUT shader
shader_type canvas_item;
uniform sampler2D screen_texture : hint_screen_texture, filter_linear_mipmap;
/**
* LUT texture should be (imported as) a 3D texture.
* Pay attention to setting up correct number of slices in import settings.
*/
uniform sampler3D lut_texture : filter_linear;
/** PX size of single LUT cell (slice), e.g. 64 for a 64x64 px square. */
uniform float lut_size = 64.0;
uniform float intensity : hint_range(0.0, 1.0) = 1.0;
void fragment() {
vec4 original_color = texture(screen_texture, SCREEN_UV);
// Half-texel offset so we sample the center of each LUT cell,
// avoiding edge bleeding artefacts.
float scale = (lut_size - 1.0) / lut_size;
float offset = 0.5 / lut_size;
vec3 lut_uv = clamp(original_color.rgb, 0.0, 1.0) * scale + offset;
vec3 graded_color = texture(lut_texture, lut_uv).rgb;
COLOR = vec4(mix(original_color.rgb, graded_color, intensity), original_color.a);
}
@m-radzikowski
Copy link
Copy Markdown
Author

Identity LUT:

lut_identity

Apply color grading to this LUT and import it in Godot as Texture3D with 8 horizontal and 8 vertical slices. In the shader, set lut_size=64.

@m-radzikowski
Copy link
Copy Markdown
Author

m-radzikowski commented May 11, 2026

60-seconds usage tutorial: https://bsky.app/profile/did:plc:rqt5wsssxealp3p7q7iomzj5/post/3mlldsi3wos22

Recoloring examples

Base

lut_none

Saturated

lut_saturated

Fire

lut_fire

Sepia

lut_sepia

Black & White

lut_bw

LUTs

(but best if you make your own, fitting your needs1)

Saturated

lut_saturated

Fire

lut_fire

Sepia

lut_sepia

Black & White

lut_bw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment