Last active
May 12, 2026 23:07
-
-
Save m-radzikowski/370608cafa9517490579159cc3a3e1a7 to your computer and use it in GitHub Desktop.
Godot LUT shader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } |
Author
Author
60-seconds usage tutorial: https://bsky.app/profile/did:plc:rqt5wsssxealp3p7q7iomzj5/post/3mlldsi3wos22
Recoloring examples
Base
Saturated
Fire
Sepia
Black & White
LUTs
(but best if you make your own, fitting your needs1)
Saturated
Fire
Sepia
Black & White
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Identity LUT:
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.