by neurolinked » 29 Mar 2021, 22:39
Hi, i'm playing with the BSL language, in particular with the shaders 'spriteblitter' attacched to this Sprite brush.
I have tried to force minimum and manimum for the input parameter and to fix a problem with the fixed parameter highlighted in the code.
Here's the code
cfg{
name = "spriteblitter_2";
samplerDefault;
{
filter = point ;
adressU = clamp ;
adressV = clamp ;
}
}
globals {
texture tex ;
{
uiName="Sprites";
}
float NbSpriteX = 4 ;
{
uiMin = 1 ;
uiMax = 64;
uiNumPixScale = 1;
uiName = "horizontal";
uiFormat = integer;
}
float NbSpriteY = 4;
{
uiMin = 1 ;
uiMax = 64;
uiNumPixScale = 1;
uiFormat = integer;
uiName = "vertical";
}
}
float hash( float3 n )
{
return frac( sin(dot(n, float3(12.9898, 78.233, 36.791)))* 43758.5453 ) ;
}
float4 main( idatas i )
{
float2 p = i.primBox.toUpperLeftNorm( i.pos );
float2 sizeI = float2(1./NbSpriteX, 1./NbSpriteY );
float maxRepeat = NbSpriteX * NbSpriteY ;
int rndp = maxRepeat * hash( float3(i.time, i.nbUserStroke, i.time) );
int linedimension = floor(NbSpriteX);
p = (p + float2( mod(rndp,linedimension), rndp/linedimension))*sizeI;
float4 col = tex.isEmpty ? float4(p.x,p.y,0,1) : tex.sample( p );
return col ;
}
There are thing that i can't understand why they wont work..
* Why the languange don't respect the uiMin and uiMax that i gave to the parameter for horizontal an vertical grid of the sprite.
* Why if i use the mousewheel to change size of the horizontal or vertical grid it won't step by 1 unit
* Every stroke start a new "line" with the same starting sprite unless i click on the UI of BlackInk and restart drawing
Is it possible to integrate a parameter logger features or function to see what value I'm receiving from certain operation ??
Love your software a lot!