

layout(location = 0, index = 0) out vec4 outcol0;

uniform vec4 diffcol;

uniform vec4 ks_planeeq0;
uniform vec4 ks_planeeq1;
uniform vec4 ks_planeeq2;
uniform vec4 time_s;

in vec3 v2f_os_pos;
in vec3 ks_pos;
in vec3 ws_pos;
in float its;

float nrand( vec2 n ) {
	return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453);
}
vec3 nrand3( vec2 n ) {
	return fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* vec3(43758.5453, 28001.8384, 50849.4141) );
}

void main()
{
	vec2 seed = gl_FragCoord.xy + fract(time_s.x+ks_pos.z) + fract(ks_pos.xy);
	float alpha = diffcol.a;

	outcol0 = vec4( diffcol.rgb*(1+its), 0);
	outcol0.rgb *= alpha;

	outcol0.rgb += nrand3( seed ) / 255.0;
}
