-
Hi @nmbr73 @J-i-P-i , I am big fan of your shader fuses. Inspired from those, I decided to make my own fuse plugin. I really learned a lot from this tutorial @nmbr73 made, (don't know german, watched with english captions). But then I shared it to a different machine where it has a cuda graphics card. Unfortunately, the plugin was not working there even after changing the graphics mode to OpenCL. The error message shown in the console was this:
This message is not showing on my machine having no cuda. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Hi Akascape float2 Var1 = to_float2_s(0.0f) or float2 Var1 = to_float2(0.0f,0.0f); Best regards |
Beta Was this translation helpful? Give feedback.
-
@J-i-P-i Thanks for the response.
I am actually making a glitch effect plugin. Here is the full fuse file: -- Description of kernel parameters
DCTLParams =
[[
float parameter1;
float parameter2;
float parameter3;
float parameter4;
float parameter5;
float parameter6;
float x_axis;
float y_axis;
int width;
int height;
float itime;
int compOrder;
]]
-- source of kernel
DCTLKernel =
[[
__DEVICE__ float2 quantize(float2 v, float steps) {return _floor(v * steps) / steps;}
__DEVICE__ float4 posterize(float4 color, float numColors) {return _floor(color * numColors - 0.5f) / numColors;}
//############################################################################################################################
__KERNEL__ void DCTLKernel(__CONSTANTREF__ DCTLParams *params, __TEXTURE2D__ iChannel0, __TEXTURE2D_WRITE__ dst)
{
DEFINE_KERNEL_ITERATORS_XY(x, y);
//---------------------------------------
if (x < params->width && y < params->height)
{
//-----------------------
float2 fragCoord = to_float2(x, y);
float2 iResolution = to_float2(params->width, params->height);
float itime = params->itime;
float4 fragColor = to_float4_s(0.0f);
//-----------------------
float GlitchAmount = params->parameter1;
float2 uv = fragCoord / iResolution;
float amount = _powf(GlitchAmount, 2.0f);
float2 pixel = params->parameter6 / iResolution;
float4 color = _tex2DVecN(iChannel0, uv.x, uv.y, 15);
float t = _fmod(_fmod(itime, amount * 100.0f * (amount - 0.5f)) * 100.0f, params->parameter3);
float4 postColor = posterize(color, 16.0f);
float2 i = quantize(uv, 64.0f * t) + pixel * (postColor.x - to_float2_s(0.5f)) * 100.0f;
float2 j = quantize(uv, 32.0f - t) + pixel * (postColor.x - to_float2_s(0.5f)) * 1000.0f;
float2 k = quantize(uv, 16.0f + t) + pixel * (postColor.x - to_float2_s(0.5f)) * 20.0f;
float4 a = posterize(_tex2DVecN(iChannel0, i.x, i.y, 15), 5.0f);
float4 b = posterize(_tex2DVecN(iChannel0, j.x, j.y, 15), 4.0f);
float4 c = posterize(_tex2DVecN(iChannel0, k.x, k.y, 15), 16.0f);
float2 p = uv.x + amount * (quantize((a * t - b + c - (t + t / 2.0f) / 10.0f).x, 16.0f) - to_float2_s(0.5f)) * pixel * params->parameter4;
float2 q = uv.y + amount * (quantize((a * t - b + c - (t + t / 2.0f) / 10.0f).x, 16.0f) - to_float2_s(0.5f)) * pixel * params->parameter4;
if (params->x_axis == 1) p.x = q.x;
if (params->y_axis == 1) q.x = p.x;
fragColor = _mix(_tex2DVecN(iChannel0, p.x, q.x, 15),
(a + b + c) / params->parameter2,
(0.5f - (dot(color, postColor) - params->parameter5)) * amount);
_tex2DVec4Write(dst, x, y, fragColor);
}
}
]] |
Beta Was this translation helpful? Give feedback.
-
@J-i-P-i I also have another question, when I add this fuse node in fusion page, a merge node also appears with it. Is there any way to stop the merge node from popping up? |
Beta Was this translation helpful? Give feedback.
-
@J-i-P-i Hello again, hope you are doing well, I am currently working on this shader (https://www.shadertoy.com/view/43SGz1) and made the fuse for it. I completed all the code conversion, but I don't know why the result in fusion is not looking like the shadertoy. If you have some time to review, can you help figure it out. Thank you :) |
Beta Was this translation helpful? Give feedback.
-
@Akascape Hello, I found three things that prevented the display for me:
Attached is the modified fuse in a ZIP Archive. Best regards |
Beta Was this translation helpful? Give feedback.
@Akascape
I had errors with both Cuda and OpenCL.
Cuda is a little more forgiving than OpenCL, but a float2 is "required" when passing parameters to the quantize function
Cuda stumbles because only one float is available and OpenCL stumbles because a float4 is used there.
I corrected this.
Best regards
github doesn't allow files with the extension "fuse" so I renamed it to SuperGlitch.fuse.csv , please remove the csv
SuperGlitch.fuse.csv