Hey guys
i’m here to get a little help from shader experts
do you think i messed up this code? cause it’s giving me something like “colour sample patch” as output instead of shader output!
i mean this is a really simple and short code but why is this happening? something wrong with the coordinates? a difference between spark and shadertoy corrdinate system maybe?
precision highp float;
vec4 F (vec2 U, std::Texture2d iChannel1)
{
vec2 R = std::getRenderTargetSize();
U = fragment(floor(std::getRenderTargetSize() * std::getVertexTexCoord()));
return iChannel1.sample(U/R.xy);
}
float ln (vec2 p, vec2 a, vec2 b)
{
return length(p-a-(b-a)*clamp(dot(p-a,b-a)/dot(b-a,b-a),0.,1.));
}
vec4 T (vec2 U, std::Texture2d iChannel0, std::Texture2d iChannel1)
{
vec2 R = std::getRenderTargetSize();
U = fragment(floor(std::getRenderTargetSize() * std::getVertexTexCoord()));
U -= F(U, iChannel1).xy;
U -= F(U, iChannel1).xy;
return iChannel0.sample(U/R.xy);
}
void mainImage( in float iFrame, in std::Texture2d iChannel0, in std::Texture2d iChannel1, out vec4 Q )
{
vec2 R = std::getRenderTargetSize();
vec2 U = fragment(floor(std::getRenderTargetSize() * std::getVertexTexCoord()));
Q = 0.25 *
(T(U + vec2(1.0, 0.0), iChannel0, iChannel1) +
T(U - vec2(1.0, 0.0), iChannel0, iChannel1) +
T(U + vec2(0.0, 1.0), iChannel0, iChannel1) +
T(U - vec2(0.0, 1.0), iChannel0, iChannel1));
if (U.x<2.||U.y<2.||R.x-U.x<2.||R.y-U.y<2.||iFrame < 1.0)
Q = vec4(U, 0.0, 0.0);
}