i.animator Posted June 10, 2016 Share Posted June 10, 2016 In Babylon.js Is there a way to render animated sprites with an additive (one one) blend mode? Either that or can I use an animated sprite as a particle that uses the particle's one one blend mode? Thanks, -=T=- Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted June 10, 2016 Share Posted June 10, 2016 Is this not usefull in your case ? https://doc.babylonjs.com/tutorials/How_to_use_Blend_Modes Quote Link to comment Share on other sites More sharing options...
i.animator Posted June 10, 2016 Author Share Posted June 10, 2016 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=- Quote Link to comment Share on other sites More sharing options...
V!nc3r Posted June 13, 2016 Share Posted June 13, 2016 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 ^^ Quote Link to comment Share on other sites More sharing options...
FunFetched Posted December 17, 2017 Share Posted December 17, 2017 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! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.