Hi - I’m trying to convert this lovely shader → Shader - Shadertoy BETA
for use in Playcanvas - and I’m following Leonidas’s guide here - Shadertoy to PlayCanvas: Sirenian Dawn | Playing in Canvas
But I’m stuck - mainly because I’m new to non-unity shader stuff. The important stuff is in the diamond shader file - at the getAlbedo() function. The rest copies across with no errors.
https://playcanvas.com/editor/scene/1644525
the original shader, frag is this…
//vec2 frag = (2.0 * fragCoord.xy - iResolution.xy) / iResolution.y;
and in the tutorial example It’s changed to this. So I’ve stuck with that.
vec2 frag = (2.0 * $UV.x - iResolution.xy) / iResolution.y;
my problem is the dist calculation further down. It’s always >= 0.0 which makes me think the calculations are probably wrong.
also I’m having to change
texture (iChannel0, direction).rgb;
to
texture(iChannel0, vec2(direction.x,direction.y)).rgb;
which feels wrong. but It won’t let me use direction on it’s own it only accepts a vec2 into the texture function.
Can anyone point me in the right direction ? thanks