forked from Maxon-Computer/Redshift-OSL-Shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaintColors.osl
32 lines (30 loc) · 1.27 KB
/
PaintColors.osl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
//reference: http://glslsandbox.com/e#43216.0
shader PaintColors
[[ string help = "Painterly Texture Map Distortion",
string label = "Paint Colors" ]]
(
float tm=0[[float min=0, float max=100]],
float offX=0.175[[float min=0, float max=0.5]],
float offY=0.275[[float min=0, float max=0.5]],
float offZ=0.25[[float min=0, float max=0.5]],
float scale=1.0[[int slider = 1,
float min=0.01, float max=1000,
float slidermin = 0.1, float slidermax=100]],
output color c = 0)
{
int complexity = 47; // More points of color.
float fluid_speed = 108.0; // Drives speed, higher number will make it slower.
float clrInt = 0.8;
vector p=vector(u,v,0);
p = P / scale;
for(int i=1;i<complexity;i++)
{
vector newp = p + tm*0.001;
float s=i;
newp[0]+=0.6/s*sin(s*p[2]+tm/fluid_speed+0.3*s) + offX; // + mouse[1]/mouse_factor+mouse_offset;
newp[1]+=0.6/s*sin(s*p[0]+tm/fluid_speed+0.3*(i+10)) - offY; // - mouse[0]/mouse_factor+mouse_offset;
newp[2]+=0.6/s*sin(s*p[1]+tm/fluid_speed+0.3*s) + offZ;
p=newp;
}
c=vector(clrInt*sin(3.0*p[0])+clrInt, clrInt*sin(3.0*p[1])+clrInt, clrInt*sin(p[0]+p[2])+clrInt);
}