Shader I am seeding from
shader f(float i = 0, output float F =0) { F = i; }
Just try compile it and hook to anything, no dice.
I got a signal going, RGB to vector.
So I guess its working. I fail to pipe some generic noise.
Dug further.
Animated float values are not caught.
So I animate Time, scrubbing time line does not sync the scale of the particles to the OSL shader.
Changing the float value directly on the OSL shader with the spinner updates perfect.
vector fract ( vector x ){
return x - floor (x);}
vector Rotate(vector V, float angle) {
float c = cos(angle);
float s = sin(angle);
matrix mat2 = matrix (c,-s,0,0,s,c,0,0,0,0,0,0,0,0,0,0);
return transform(mat2,V);
}
vector coordToHex(vector coord, float scale, float angle) {
vector c = Rotate(coord, angle);
float q = (1.0 / 3.0 * sqrt(3.0) * c[0] - 1.0 / 3.0 * c[1]) * scale;
float r = 2.0 / 3.0 * c[1] * scale;
return vector(q, r, -q - r);
}
vector hexToCell(vector hex, float m) {
return fract(hex / m) * 2.0 - 1.0;
}
float absMax(vector V) {
return max(max(abs(V[0]), abs(V[1])), abs(V[2]));
}
float nsin( float value) {
return sin(value * M_PI*2) * 0.5 + 0.5;
}
float hexToFloat(vector hex, float amt) {
return mix(absMax(hex), 1.0 - length(hex) / sqrt(3.0), amt);
}
float calc(vector tx, float Time) {
float angle = M_PI * nsin(Time * 0.1) + M_PI / 6.0;
float len = 1.0 - length(tx) * nsin(Time);
float value = 0.0;
float gridSize = 20.0;
float wave = 5.0;
vector hex = coordToHex(tx, gridSize * nsin(Time * 0.1), angle);
for (int i = 0; i < 3; i++) {
float offset = float(i) / 3.0;
vector cell = hexToCell(hex, 1.0 + float(i));
value += nsin(hexToFloat(cell,nsin(len + Time + offset)) *
wave * nsin(Time * 0.5 + offset) + len + Time);
}
return value / 3.0;
}
shader gugu(
point Po = P,
float Time = 0,
output vector Out = 0,
) {
float brightness = 1.5;
float timeScale = 0.2;
float Displace = 0.01;
point tx = (Po) - 0.5;
float Timer = Time * timeScale;
vector rgb = vector(0.0, 0.0, 0.0);
for (int i = 0; i < 3; i++) {
float time2 = Timer + float(i) * Displace;
rgb[i] += pow(calc(tx, time2), 2.0);
}
Out = vector(rgb * brightness);
}