Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d88599d
commit 89c9e0f
Showing
1 changed file
with
33 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,33 @@ | ||
// Satin OFX DCTL | ||
|
||
DEFINE_UI_PARAMS(MAX_ITER, Satin, DCTLUI_SLIDER_INT, 2, 1, 5, 1) | ||
DEFINE_UI_PARAMS(time, Motion, DCTLUI_SLIDER_FLOAT, 0, 0, 1, 0.001) | ||
|
||
__DEVICE__ float3 transform(int p_Width, int p_Height, int p_X, int p_Y, float p_R, float p_G, float p_B) | ||
{ | ||
float X = (float)p_X; | ||
float Y = (float)p_Y; | ||
float width = (float)p_Width; | ||
float height = (float)p_Height; | ||
Y = height - Y; | ||
float2 uv = make_float2(X / width, Y / height); | ||
float TIME = time * 20; | ||
|
||
float2 p = uv * 8; | ||
float2 i = p; | ||
float c = 0; | ||
float inten = 0.15f; | ||
float r = length(p + make_float2(_sinf(TIME), _sinf(TIME * 0.433f + 2)) * 3); | ||
|
||
for (int n = 0; n < MAX_ITER; n++) { | ||
float t = r - TIME * (1 - (1.9f / (n + 1))); | ||
t = r - TIME / (n + 0.6f); | ||
i = i - (p + make_float2(_cosf(t - i.x - r) + _sinf(t + i.y), _sinf(t - i.y) + _cosf(t + i.x) + r)); | ||
c += 1 / length( make_float2((_sinf(i.x + t) / inten), (_cosf(i.y + t) / inten))); | ||
} | ||
c /= MAX_ITER; | ||
r = 1.5f - 0.25f * r; | ||
|
||
float3 RGB = make_float3(c, c, c) * make_float3(2.4f, 2, 2.5f) - 0.15f; | ||
return RGB; | ||
} |