kernel Something { const float width = 600.0; const float height = 600.0; const float2 center = { width/2.0, height/2.0 }; const float PI = 3.14159265; const float4 color1 = { 0.2, 0.01, 0.08, 1.0 }; const float4 colorCenter = { 1.0, 1.0, 1.0, 1.0 }; const float phase = 6.0; const float radius = 200.0; float length( float2 v) { v *= v; return sqrt( v[0] + v[1] ); } void evaluatePixel(out pixel4 result) { float2 vec = result.coord - center; float vec_length = length( vec ); float angle = atan2( vec.x, vec.y); float coef = (cos( angle * phase) + cos( angle * 0.5 * phase ) + cos( angle * 0.1 * phase ) + cos( angle * 0.01 * phase )) * 0.25; // float coef = (cos( angle * phase) * cos( angle * 0.5 * phase ) * cos( angle * 0.1 * phase ) * cos( angle * 0.01 * phase )); if( coef < 0.0 ) coef = - coef; coef = 1.0 - coef; float adjRadius = radius * ( 0.5 + 1.0 * coef ); if( vec_length < adjRadius ) { if( vec_length < adjRadius ) { coef = pow((radius - vec_length) / adjRadius , 1.0 ) * ( 1.0 - coef) + coef; } result = ( 1 - coef ) * color1 + coef * colorCenter; for( int i = 0; i < 3; ++i) { if(result[i] < 0) result[i] = 0.0; else if(result[i] > 1) result[i] = 1.0; } result[3] = 1.0; } else { result = colorCenter; } } region generated() { region reg = { 0, 0, width, height}; return reg; } }