I’ve been fiddling around a lot with the smudge stuff on my Burns branch, and I just had an idea and wanted to jot it down before I can get distracted.
So, right now we have 3 colors involved. The canvas color, the smudge_state, and the brush color. This means your brush can only contain 2 colors at a given point; your brush color and some amount of the smudge_state color. The smudge_state is basically a bucket of paint that you add canvas color to a bit at a time (depending on smudge_length).
So, my idea might be actually be pretty simple.
We need, say, 11 smudge buckets instead of one (edit, 11 makes more sense than 10 so we can have a middle value and it aligns with the in-betweens on the input grids). This would just mean defining a bunch more states in brushsettings.json.
Then, we need a smudge_bucket setting. This can just be 0-10 and rounded to the nearest integer.
When the smudge code goes to update the smudge (or mix brush w/ smudge) it just needs to look at this setting to know which smudge bucket (smudge state) to deal with. You would assign smudge buckets by mapping an input to the smudge_bucket setting. For instance, if you mapped pressure, then light pressure might use smudge_buckets 0-5 and heavier pressure would use smudge_buckets 6-10.
What would this buy us? We can now have a brush loaded with up to 12 colors at once (11 smudge states plus the brush color). Combined with the offset settings we can, say, have the middle part of the brush use a fast-updating (small smudge_length) smudge_bucket 0, and as you approach the outer part of the brush it can use different smudge_buckets that each have a different smudge_length. Essentially, you can smear paint like a real brush and have clearly different colors smeared across the screen instead of one averaged color.
The cool thing is I don’t think this would really add much overhead at all since you’re still only dealing with one smudge_state/bucket at a time. Thoughts?
Implementation:
I’m trying to think how to update a particular smudge_state.
Say I have 44 of these states (RGBA for each bucket). It sounds like I might just have to load this into a 11X4 smudge_buckets array. Then I can roundf(smudge_bucket) input to get the array index. Then I can just deal with smudge_buckets[N RGBA] when operating on the smudge state. The only thing that sucks is that I have to load that whole array and then write it back to the states each time, instead of dealing with JUST the state I want. Any ideas on how to avoid that?