WIP - Brush shading Language
Posted: 05 Feb 2016, 14:13
We’re starting to get some very promising results for the upcoming version of Black Ink (even if there is still a lot of work left before the release ).
We will introduce a new custom shading language: the BSL (Brush Shading Language).
It is used control how pixel are blitted on the canvas. It’s mainly a superset of HLSL which introduce a lot of helpers and simplification.
Currently, Black Ink’s brushes only output one color per primitive and the Controllers only change the size, rotation etc.. but doesn’t change how the color is applied on the whole primitive. BSL will change that and open a whole new world of (infinite?) possibilities.
Long story short, it will be possible to program smudge blurs, smoothed primitives, texture masking, noises, color aberration, water effects, and much more…
This should be really interesting for technical oriented users (like people in the Shadertoy community for example). Pure artists don’t need to worry, all that complexity will be hidden and you will be able to use custom made effects without having to know how it’s done.
The next release will only include a text based BSL editor because a nodal tool will take a lot longer to develop. This is much more complex than the Controller system.
A lot of Black Ink’s code was rewritten to support this new feature so sorry for the time this release is taking but it is going to be well worth it.
Now enough with the technical talk! This thread will show some results and advancement in our quest for more flexible and enjoyable Brush making
Smooth Primitive effect
BSL source code
$this->bbcode_second_pass_code('', 'float4 main( idatas i )
{
float sm = vmin( i.primBox.getSize() ) ;
float d = -i.primDistance ;
float softness = 0.5 ;
d /= sm*softness + 0.001 ;
float att = 1 - exp( -d );
return float4( i.color.xyz, i.color.a*att ) ;
}')
primitive space display
BSL source code
$this->bbcode_second_pass_code('', 'float4 main( idatas i )
{
matrix2 t = i.primBox.getToUpperLeftTransfo() ;
float2 p = t.transform( i.pos );
p /= i.primBox.getSize();
return float4( p.x, p.y, 0, i.color.a ) ;
}
')
distance to primtive effect
$this->bbcode_second_pass_code('', 'float4 main( idatas i )
{
float d = toDrawSpace( i.primDistance ) ;
float l = abs( cos( d*0.12 ) ) > 0.85 ? 1 : 0 ;
float3 col = lerp( float3(0.2,0.2,0.7), float3(0.7,0.5,0.2), l );
return float4( col, 1 );
}
')