Jump to content

Sprite blendmode or sprite as particle


i.animator
 Share

Recommended Posts

V!nc3r, 

Thank you for the reply. While that does talk about the alpha blend modes, it shows it being use with relation to a material. I don't see any way to get ahold of the material that the sprite manager is using in order to force a different alpha blend mode.

Here is a little example of the sprite sequences:

http://playground.babylonjs.com/#1IQ6A5#5

thanks,

-=T=-

Link to comment
Share on other sites

I don't know if alpha mode could be use without material, however in my not-dev point of view, this is what i would set in this case :

spark.isPickable = false;
spark.material = new BABYLON.StandardMaterial("sparkTexture", scene);
spark.material.alphaMode = BABYLON.Engine.ALPHA_ADD;

I just find how to use this in my actual project, it's not a sprite here, but ALPHA_ADD works well : http://imgur.com/a/beYxe

Hope it can help ^^

Link to comment
Share on other sites

  • 1 year later...

I know this thread is over a year old, but I just ran into this situation myself. ParticleSystem, while handy (and additive, if you want), creates too much new junk for the garbage collector for my purposes, so I wanted to roll my own. SpriteManager, however, doesn't come with an option for additive blending built-in.

However, if you're feeling even slightly adventurous, it's super easy to add this functionality to the engine.

Pop open your babylon.js and look for this line within SpriteManager.prototype.render (it's toward the bottom of the function):

engine.setAlphaMode(Engine.ALPHA_COMBINE);

Change ALPHA_COMBINE to ALPHA_ADD and voila; additive blending of sprites! Of course, you'll want to add a flag to SpriteManager so you can enable/disable this functionality per SpriteManager, but you get the drift. There are other things you might want to do as well, such as disabling the depth test draw just above that, so you don't end up with darker additive sprites blotting out brighter ones behind them, but once you know where to look, you can do whatever you want.

Happy adding!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...