Hi Gigatron ,
This shader can be done in COnstruct2?
shadertoy.com/view/lsGBRK
If i remember well, contruct 2 is not able to work with shaders with multiple channels/images as far as i know, i guess you told me the same but not sure now.
What this shaders does is what we tried months ago, apply a color palete based on a texture to an image.
Is possible?
Also maybe R0J0hound , Ashley know if is possible?
I tried with the Gigatron converter that gives me this:
#ifdef GL_ES
precision mediump float;
#endif
#extension GL_OES_standard_derivatives : disable
//// START C2 UNIFORMS HEADER ////
uniform sampler2D samplerBack;
uniform sampler2D samplerFront;
varying vec2 vTex;
uniform vec2 destStart;
uniform vec2 destEnd;
uniform float seconds;
uniform float pixelWidth;
uniform float pixelHeight;
vec2 iResolution = vec2( 1./pixelWidth, 1./pixelHeight);
//// END C2 HEADER ////
// samplerFront = source image
// iChannel1 = palette image (should be 1-dimensional)
#define BRIGHTNESS 1.0
#define NUMCOLORS 16.0
vec3 find_closest (vec3 ref) {
vec3 old = vec3 (100.0*255.0);
#define TRY_COLOR(new) old = mix (new, old, step (length (old-ref), length (new-ref)));
for (float i = 0.0; i < 1.0; i+=1.0/NUMCOLORS) {
TRY_COLOR(texture2D(iChannel1, vec2(i,0.4)).rgb * BRIGHTNESS);
}
return old ;
}
void main()
{
vec2 uv = gl_FragCoord.xy / iResolution.xy;
vec3 tc = texture2D(samplerFront, uv).xyz;
gl_FragColor = vec4(find_closest(tc),1.0);
But lots of erros i can't solve :S