Tomm Huth Posted March 14, 2018 Share Posted March 14, 2018 I'm playing around with the particle system, trying to create subtle background particles wafting randomly around. I think i have something (https://www.babylonjs-playground.com/#WJBZQH), but I'd like to fade in particles - not just out. Particles suddenly appearing is a little jarring. Is that even possible? I know a "soft birth" of particles has been mention here before, but I couldn't really make much sense of it as is also tried to do alot more. Also: how can i use particles with a transparent scene clearColor? With that, particles are simply not visible until they appear over some geometry in the scene. Any tips? Quote Link to comment Share on other sites More sharing options...
Tomm Huth Posted March 15, 2018 Author Share Posted March 15, 2018 Ha! I think there was something with my colors that messed things up, but particleSystem.color1 = new Color4(1, 1, 1, .1) particleSystem.color2 = new Color4(1, 1, 1, .85) particleSystem.colorDead = new Color4(1, 1, 1, 0.0) particleSystem.blendMode = ParticleSystem.BLENDMODE_STANDARD works like a charm. I don't know why tho, so if anyone has any background info on this that would be great. How does particles get blended with the environment? My texture is an alpha channel png. Now if only i could get the particles to fade in. I tried the suggestion from but that did not work. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 15, 2018 Share Posted March 15, 2018 http://playground.babylonjs.com/#ZVNDN#4 Quote Link to comment Share on other sites More sharing options...
Tomm Huth Posted March 15, 2018 Author Share Posted March 15, 2018 thats static particles, and not really what my playground does tho. Copying the updateFunction does not seem to make a difference either, in fact it messes up the fading out of the particles (they fade out, then in, and then just disappear). https://www.babylonjs-playground.com/#WJBZQH#1 Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 15, 2018 Share Posted March 15, 2018 Its showing you that you can make a custom update function... modify it how you need. Quote Link to comment Share on other sites More sharing options...
Tomm Huth Posted March 15, 2018 Author Share Posted March 15, 2018 I'm trying to, but its not obvious to me what to do. I'm trying this if (particle.age < particle.lifeTime * .35) { particle.color.a = particle.age / (particle.lifeTime * .35) } if (particle.age > particle.lifeTime * .7) { let x = (particle.age - particle.lifeTime * .7) / particle.lifeTime * .3 particle.color.a = 1 - x console.log(x) } but it does not work, but i cannot find how the math is wrong. Fade in works, but fade out does not. Is this a case of to many decimals? Quote Link to comment Share on other sites More sharing options...
Tomm Huth Posted March 15, 2018 Author Share Posted March 15, 2018 Turns out x * 10 solved it! Man I suck at math lol Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted March 16, 2018 Share Posted March 16, 2018 naw, math just sucks. <3 glad you figured it out. I was gonna get at it for you this morning but you got it so cool! 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.