InkPainter
InkPainter copied to clipboard
Modifying the alpha of brush at runtime causes abnormal paint behavior

When changing the brush's alpha at runtime causes only the last or the latest painted brush to simulate fluidic effects (see screenshot) (Modifying scale works fine)
(Note: How can I change the width and height in scale separately?) (Note2: Changing the alpha in HeightFluid changes the alpha of all the painted brushes ☹️ )
This is how I change alpha in the Update() function
//vars
public InkCanvas inkCanvas; //set in inspector
private static readonly System.Random random = new System.Random();
float dampedAlpha;
//functions
private void Update()
{
if(Input.GetMouseButton(0))
{
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hitInfo;
if(Physics.Raycast(ray, out hitInfo))
{
dampedAlpha = Mathf.SmoothDamp(dampedAlpha, (float)RandomNumberBetween(0f,1f), ref vel, Time.fixedDeltaTime);
Brush tempBrush = brush;
tempBrush.Color = new Color(brush.Color.r,brush.Color.g,brush.Color.b,dampedAlpha);
inkCanvas.Paint(tempBrush, hitInfo);
}
}
}
private static double RandomNumberBetween(double minValue, double maxValue)
{
var next = random.NextDouble();
return minValue + (next * (maxValue - minValue));
}
Steps to Reproduce:
- Attach "InkCanvas" Component to plane.
- Attach "HeightFluid" script to the plane.
- Uncheck "Performance Optimize" in HeightFluid script
- Change Properties of brush to:
Color Blend Type = Alpha Only
Normal Blend Type = Add
Height Blend Type = Use Brush
- Create a custom script, modify the alpha values in Update() and paint.
Thanks for the report! currently investigating, so please be patient. I'm sorry for contact late.