New Color blending in 1.29 is interfering with custom shaders


My lovingly tweaked custom shaders are all messed up with 1.29: very low alpha value returned by the fragment shaders (gl_FragColor) seem to be saturated.

I suspect the modifyShaderForColor method has got something to do with this, and more particularly line 1830 of Model.js:

’ float highlight = ceil(gltf_colorBlend); \n’ +

I may be wrong but, ideally, if I provide my own fragment shader, I would like it to remain untouched so I keep control over the output.

The modifyShaderForColor method concatenates extra instructions to the shader making it difficult to know if problems are coming from my own code or from Cesium.

Is there any way to disable/override this behavior?



I think the cause is more likely related to the is related to the un-premultiply alpha step also in modifyShaderForColor. This was added since to fix color blending and make Model’s more accurate with OIT. Does your shader premultiply alpha? What is the value of the gltf’s asset.premultipliedAlpha? As long as the two match there shouldn’t be a problem in Cesium - but let me know if there still is.

Hi Sean,

Thanks for the quick reaction.

That seems to be the answer: my shaders do not pre-multiply alpha and the gltf had “premultipliedAlpha” set to true.

Many thanks,