Reusing Fabric based materials with custom shaders...

I have a Material I define thus…

var _material = new Cesium.Material({

fabric: {

type: ‘HeatPolygon’,

uniforms: {

colour: getColorForPercentage(value),

alpha: 0.8


source: _shaderSource





Which works as expected.

If I try to reuse this material by using Material.fromType(“HeatPolygon”), which I think is the correct procedure from reading the Fabric notes, something seems to disconnect either at the uniform level or with the shader.

I presume the shader source and the uniforms I have defined are not being referenced correctly or I am misunderstanding something.

I believe there is a note at the bottom of the Fabric docs that refers to this, but I’ve tried a number of approaches and still don’t seem to be getting it quite right. : Materials in the Rendering Pipeline

If I simply recreate the Material each time I use it, with different values, then this all works fine. But that seems like a wasteful / bad approach to me.

Am I going beyond the scope of what is possible right now, or just being dumb?

Thanks for any pointers.