You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a shader here ( https://www.shadertoy.com/view/wl2SzR ) that cannot be converted. Compilation free of errors, but the sampling is incorrect.
My guess is it's because of these nested divisions:
in eq (): p.x / p.y
and then
O + = TONE / abs_f4 (to_float4_s (y-hs) -X);
The resulting image is limited to the lower left part, whereby only chaotic color pixels can be seen.
__DEVICE__ float4 abs_f4 (float4 a) {return (to_float4 (_fabs (a.x), _fabs (a.y), _ fabs (a.z), _ fabs (a.w)));}
// Tweak # 2 of sben's 'Flow of cells' (https://www.shadertoy.com/view/MlsGWX)
#define FIELD 10.0f
#define HEIGHT 0.7f
#define ITERATION 2.0f
#define TONE to_float4 (0.2f, 0.4f, 0.8f, 0)
#define SPEED 0.5f
__DEVICE__ float eq (float2 p, float t) {
float x = _sinf (p.y-t + _cosf (t + p.x * 0.8f)) * _cosf (p.x-t);
x * = _acosf (x);
return - x * _fabs (x-0.05f) * p.x / p.y * 4.9f;
}
// ************************************************ ************************
__KERNEL__ void ShaderToyKernel (__ CONSTANTREF__ ShaderToyParams * params, __TEXTURE2D__ iChannel0, __TEXTURE2D__ iChannel1, __TEXTURE2D__ iChannel2, __TEXTURE2D__ iChannel3, __WTERITE2 d) {
DEFINE_KERNEL_ITERATORS_XY (x, y);
if (x <params-> width && y <params-> height)
{
// -----------------------
float2 U = to_float2 (x, y);
float2 iResolution = to_float2 (params-> width, params-> height);
float ratio = (float) params-> width / (float) params-> height;
float itime = params-> itime;
float4 O = to_float4_s (0.0f);
// -----------------------
// Functionality .......
float4 X = O;
float2 p = FIELD * (U / iResolution + 0.9f); // "iResolution / 0.15" test
float t = itime * SPEED;
float hs = FIELD * (HEIGHT + _cosf (t) * 1.9f);
float x = eq (p, t);
float y = p.y-x * 0.1f;
for (float i = 1.0f; i <= ITERATION; i + = 1)
p.x * = 1.5f,
X = x + to_float4 (0, eq (p, t + i + 1.0f), eq (p, t + i + 2.0f), 0),
x = X.z + = X.y,
O + = TONE / abs_f4 (to_float4_s (y-hs) -X);
_tex2DVec4Write (dst, x, y, O);
}
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a shader here ( https://www.shadertoy.com/view/wl2SzR ) that cannot be converted. Compilation free of errors, but the sampling is incorrect.
My guess is it's because of these nested divisions:
in eq (): p.x / p.y
and then
O + = TONE / abs_f4 (to_float4_s (y-hs) -X);
The resulting image is limited to the lower left part, whereby only chaotic color pixels can be seen.
Beta Was this translation helpful? Give feedback.
All reactions