Really, I was wondering if the end of a stroke could be treated as an event that can update parameters. In this case it would be color; at stroke end set new color to last merged color.
Ok I see. But it's seems to me introducing a complex system to achieve somehting to can be made with the EyeDropper or the AutoPicking.
Also, if no color was preset, brushing the canvas or a palette would pick up some color. Mixing on screen would be easier.
You can do that with a BSL which look like that :
$this->bbcode_second_pass_code('', '
globals{
float4 colorVoid ;
}
float4 main( idatas i){
float4 c = i.color ;
c = lerp( colorVoid, c, saturate(10*c.a) );
return c ;
}')
We could use it to have gradual effects, too. "Load" in this brush, for instance. At stroke end, read stroke length, diminish load percentage accordingly. Clamp percentage set this way to a minimal value to simulate amount of paint the brush might typically carry from the canvas.
it's also already possible with something like this :
$this->bbcode_second_pass_code('', '
float4 main( idatas i){
float4 c = lerp( i.color, i.color*float4(1,1,1,0), saturate(0.005*toDrawSpace(i.dist)) );
return c ;
}')
Randomizing effects could be great when using textures (or bristle density in this one) if you don't want a stenciled look between strokes.
I often use the
i.nbUserStroke as a seed for your Random effect to have each stroke unique.