Can you please clarify this.
I have a spine model with this special FP. If I manually change the tint constant in the .material file it changes color - so the shader works.
I don’t really get how I can update the tint variable though.
I tried writing
go.propery("tint", vmath.vector4(1,0,0,1))
at the top of the GO that holds the spine-model but it didn’t work.
I’ve updated shader constants with Sprites using sprite.set_constant, but there is no spine.set_constant?
Yes, it would. The workaround is to create a separate material for the spines you want to tint (with a unique tag) and draw that separately, but if you need to dynamically choose which spine to tint, it’s gonna be hairy.
I thought I remembered how I did it previously but I was obviously wrong.
Now I know you’ve already shipped your game but here’s the CORRECT solution anyway
use go.set ! Nothing else.
Tint is already in the material and should be set if using go.set
In shame I created a full tutorial video about how you can do this (that might help others as well with the first steps in Spine handling)
My question touch this example not a topic starter theme. I think better continue thread here without start new topic.
You example works perfect! But only for sprite component. If i try do same with tilemap - nothing changed.
i copy material, vp, fp from buitins
extend fp with you code
change tilemap material on my custom material
But this dont work ( I use tilemape as mask for level with background, background affected saturation (with another custome material) but tilemap - no. I check changes several tries i dont foun error. Maybe i do something else wrong?
i catch error "’/background_mask#tilemap’ does not have any property called ‘saturation’"
of cause i setup “saturation” constant in material definition.
Is material not properly applyed to tilemap ?
I test “tint.w” and see that this property appllyed properly
go.set("/background_mask#tilemap", "tint.w", 0.1)
all is good, tint works perfectly.
Maybe tilemap material defold user cannot change and used old “buildins” material in all cases (even if change it)?
You are probably not using your custom material properly. I tried adding saturation to a copy of the tilemap material from builtins and it worked like a charm. Double check that you aren’t accidentally using the wrong material or that the material is referencing the fragment shader from builtins.
Update to answer the original question:
Duplicate a default spine.material and spine.fp and spine.vp to customize them.
On your spine.material, add in the field “Fragment Constants” a new field “saturation”. Only the “x” will be used.
Now in the file “spine.fp”