-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🟦 [Nodes] Add a Post-Process Glow. closes #110
- Loading branch information
1 parent
a840530
commit 026f586
Showing
2 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Credit: [illtellyoulater](https://github.com/CoolLibs/Lab/issues/110) | ||
|
||
INPUT UV->Oklab_PremultipliedA 'Image'; | ||
INPUT float 'Brightness'; | ||
INPUT float 'Size'; | ||
INPUT int 'Quality'; /// The higher the number the smoother the result, but it will start to get laggy if set too high. | ||
INPUT float 'Mask'; | ||
|
||
vec4 blur(vec2 uv) | ||
{ | ||
vec4 color = vec4(0.); | ||
for (int x = -'Quality'; x <= 'Quality'; x++) | ||
{ | ||
for (int y = -'Quality'; y <= 'Quality'; y++) | ||
{ | ||
vec2 offset = vec2(x, y) / 'Quality' * 'Size'; | ||
color += 'Image'(uv + offset); | ||
} | ||
} | ||
|
||
float weights_sum = (2. * 'Quality' + 1.) * (2. * 'Quality' + 1.); | ||
return color / weights_sum; | ||
} | ||
|
||
Oklab_PremultipliedA main(UV uv) | ||
{ | ||
vec4 blurred = blur(uv); | ||
vec4 glow = blurred * 'Brightness'; | ||
vec4 base = 'Image'(uv); | ||
|
||
// Combine original image and glow | ||
// return mix(base, glow, 'Blend Strength'); | ||
return base + glow * 'Mask'; | ||
} |
86 changes: 86 additions & 0 deletions
86
Nodes/11 Image Modifier (Post Process)/Glow.clbnode.presets.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
{ | ||
"Presets": { | ||
"Underlying container": [ | ||
{ | ||
"first": "d07c9f21-6de8-4dfd-bc8f-04a5573983de", | ||
"second": { | ||
"Name": "Default", | ||
"Values": [ | ||
{ | ||
"index": 2, | ||
"data": { | ||
"Name": "Brightness", | ||
"Value": 1.5, | ||
"Metadata": { | ||
"Bounds": { | ||
"Has min bound": true, | ||
"Min": 0.0, | ||
"Has max bound": false, | ||
"Max": 1.0, | ||
"Drag speed": 0.009999999776482582, | ||
"Use slider": false, | ||
"Is logarithmic": false | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"index": 2, | ||
"data": { | ||
"Name": "Size", | ||
"Value": 0.15000000596046449, | ||
"Metadata": { | ||
"Bounds": { | ||
"Has min bound": true, | ||
"Min": 0.0, | ||
"Has max bound": false, | ||
"Max": 1.0, | ||
"Drag speed": 0.0010000000474974514, | ||
"Use slider": false, | ||
"Is logarithmic": false | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"index": 1, | ||
"data": { | ||
"Name": "Quality", | ||
"Value": 3, | ||
"Metadata": { | ||
"Bounds": { | ||
"Has min bound": true, | ||
"Min": 1, | ||
"Has max bound": true, | ||
"Max": 6, | ||
"Drag speed": 0.009999999776482582, | ||
"Use slider": false, | ||
"Is logarithmic": false | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"index": 2, | ||
"data": { | ||
"Name": "Mask", | ||
"Value": 1.0, | ||
"Metadata": { | ||
"Bounds": { | ||
"Has min bound": true, | ||
"Min": 0.0, | ||
"Has max bound": true, | ||
"Max": 1.0, | ||
"Drag speed": 0.009999999776482582, | ||
"Use slider": true, | ||
"Is logarithmic": false | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} |