Here is some helpful code on how to get hold of the sprite materials and adjust their diffuse color:
var Spine = pc.createScript("spine");
Spine.prototype.initialize = function () {
var spineData = this.entity.spine.data.spine;
for (var materialName in spineData._materials) {
var spineMaterial = spineData._materials[materialName];
spineMaterial.diffuse.set(0, 0.5, 1.0);
spineMaterial.update();
}
};
Thanks. I just tried this but it doesn’t seem to have any effect whatsoever? My Spine character is still completely white (the same as their imported images). Any ideas?
I tried animating the color over time (green to red) directly in Spine, exporting and running but the entity in PlayCanvas is still just white all the time?!?
I tried your code in the example project and it worked fine. Very strange. The problem is that I cant see any differences between my project and that one apart from I’m using 8th Wall AR to initialize the entity…but it doesn’t seem to do anything with materials as far as I can tell…?!? All the graphics formats are the same.
Might be worth checking on the 8th Wall Slack on what could be causing the issue. Maybe there is a custom shader being used that overwrites the materials?
I checked with 8th wall and they say they do nothing to the material. What I did discover though is if I export my Spine object with anything OTHER than rgb(0,0,0) or rgb(255,255,255) the colour change works correctly.
So basically all I had to do to get this working was set my spine model’s colour to rgb(1,1,1) (instead of 0,0,0) and then using this code the colour change works perfectly.