Sprites Blend Mode?

I made my own particle system and would like to control the blend mode of the sprites. I see that we have blend modes for materials so the attribute is likely available to hack in somewhere - ideas?


It isn’t exposed but as you say you can try cloning the default sprite material in place and play with its properties.

It should be accessible like this:

this.entity.sprite._material = this.entity.sprite._material.clone();

Here is the sprite component source code:

Thanks @Leonidas I’ll try. How do I set a material blendmode to overlay, multiply etc?

Like this:

myMaterial.blendType = pc.BLEND_NORMAL;


Rock on

Any errors here? it didn’t do nothing :frowning:

    var material =  this.entity.sprite._material.clone();
    material.blendType = pc.BLEND_ADDITIVE;
    this.entity.sprite._material = material;

No that’s correct, but I am not surprised it didn’t work since this isn’t a material exposed for editing.

Try submitting a feature request on the engine repository in case this is something that can work in another way or can be added to the engine.

Hey @Yohami_Zerpa,

Did a test myself, and it seems that the _material property isn’t being monitored by the component. Setting the material directly on the meshInstance did work:

    var material =  this.entity.sprite._material.clone();
    material.blendType = pc.BLEND_ADDITIVE;
    this.entity.sprite._meshInstance.material = material;  

That worked, thanks! @Leonidas

1 Like

Is this possible too with the GUI element component? tried the same code but nope so far

For Element components go with the official way, you can set the opacity of the element directly or even assign a custom material:

1 Like


1 Like