Convert shaderToy to sparksl

I am trying to convert shaderToy shader to Spark sl . It is a small code about 20 lines.
I tried it myself, but line 12
This line

#define V(p) textureLod(iChannel0,(p)/R,.5).y

I can’t edit it😕

// created by florian berger (flockaroo) - 2018
// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
// scribble blue in tweets of two
// improved + golfed down ballpoint effect
// check “” for this and more effects for AfterEffects and OpenFX

#define R iResolution.xy

#define V(p) textureLod(iChannel0,(p)/R,.5).y

void mainImage( out vec4 c, vec2 f )
float S=sqrt(R.x)/30.,h,s;
vec2 g,d=R/2E2,p,q,v,i,e=vec2(d.x*.2,0);
for(int j=0;j<3000;j++)
int k=j/16;
if(j%16==0) { i=floor(f/d)+vec2(k%13,k/13)-6.; s=mod(i.y,2.)-.5; p=(i+s)d; v-=v; }
mat2( cos( .8
vec4(4,2,6,4) + atan(h)1.3s+s ) ) * normalize(g),
g=q-p; q=f-p; float l=length(g); g/=l; h=dot(q,g);

I don’t think you can use #define in spark sl. You can use regular functions so the conversion would look like this:

float V(p) {
  return iChannel0.sampleLod((p)/R, .5).y;

In case you haven’t seen it, there’s a handy table for shadertoy conversions here

1 Like

like this giving a white screen
I don’t know why??

It’s really hard to say without tinkering with the code. You could try modifying the output by multiplying or subtracting. If you want to post the code I can take a look.

bluePen scribble.arexport (29.4 KB)

1 Like

I checked the codepen page and I only get a black screen from it - same thing happens in spark too.

Here’s a different version that works for me, but it is more complex than the codepen version.

it really complex so i cannot convert it to spark sl
thanks sir