Sharpleaf

Members
  • Content Count

    44
  • Joined

  • Last visited

  1. Sharpleaf

    Stoppted for short time with heavy sprite

    I gotta ask.... what in the WORLD are you making that is THAT huge?!
  2. Sharpleaf

    V3 Displacement Filter Help

    We finally solved the problem! For posterity, I'm adding my answer. The problem was that we were culling the children of map1 (a container) which included the filters texture. As such, the filter could no longer update its matrix. Once I added a check for filterTexture.renderable in my culling conditional so that it ignored the filter texture sprite, it worked
  3. Sharpleaf

    pixi-spine plugin WIP GPU patch

    This plugin had DOUBLED the frame rate for most people that play my game! Thank you Ivan for making this Seriously, if you use Spine and PIXI, load this plugin as well!! It will throw a lot of the calculations over to the GPU and increase the performance dramatically!
  4. Sharpleaf

    WebWorkers and Particles

    In my function which updates the particles positions, I do now use renderer.width and height instead of the container. I think the hack is to make sure that if anything ever calls the containers .width or .height, that updateTransform doesn't get called on every child in the ParticleContainer as it does by default.
  5. Sharpleaf

    WebWorkers and Particles

    For posterity, here's what solved my performance problems! We overwrote the getLocalBounds function of my mote containers. var rect = new PIXI.Rectangle(0, 0, renderer.width, renderer.height);frontMoteStage.getLocalBounds = function() { return rect; }; mote_container1.getLocalBounds = function() { return rect; }; mote_container2.getLocalBounds = function() { return rect;};mote_container3.getLocalBounds = function() { return rect;};frontMoteStage.filterArea = rect;frontMoteStage is the parent of mote_container1 and mote_container2, and and since we update the getLocalBounds, it's _bounds is not reporting the correct values. Since Filters need that value, that's why we added the frontMoteStage.filterArea = rect;
  6. Sharpleaf

    WebWorkers and Particles

    Sorry There is a total of 80 between the 3 containers. Though, there' s ONLY 80 because if there are too many more, performance suffers.... we would like more in the background I will ABSOLUTELY buy you a beer if you help us (again!!) Wold you like to chat in an outside room? Maybe Google Hangouts?
  7. Sharpleaf

    WebWorkers and Particles

    Wow! I uhh... don't understand.... So, I'm not sure what a shader, vertex,or uniform really are. So... can I ask for a more laymans explanation of what you mean?
  8. Sharpleaf

    WebWorkers and Particles

    Hey Ivan, I don't understand what you mean :/ .... could you explain?
  9. Sharpleaf

    WebWorkers and Particles

    if you go to the Monster Island game and move the island around, the little floating things in the foreground and behind the island are the particles I'm messing with.
  10. Sharpleaf

    WebWorkers and Particles

    Basically, I loop through every child in each of the 3 ParticleContainers, and then I update the position, rotation, and alpha of each child. There's also code in there that check where they are so that if they go offscreen, they "wrap around" to the other side. More specifically.... (here's the function, it gets called every RAF loop. function animateMotes(){ if(intent) if(intent == "arena" || intent.indexOf("adventure") >= 0) return false; if(mote_container1) for(var c in mote_container1.children){ var mote = mote_container1.children[c]; if(mote.position.x <= -200 || mote.position.x >= mote_container1.width + 200 || mote.position.y <= -200 || mote.position.y >= renderer.height + 200){ if(mote.position.x >= mote_container1.width + 200){ mote.visible = false; mote.position.x = 0 - Math.round(Math.random()*100); }else{ if(mote.position.x <= -200){ mote.visible = false; mote.position.x = mote_container1.width + Math.round(Math.random()*100); } } if(mote.position.y >= mote_container1.height + 200){ mote.visible = false; mote.position.y = 0 - Math.round(Math.random()*100); }else{ if(mote.position.y <= -200){ mote.visible = false; mote.position.y = mote_container1.height + Math.round(Math.random()*100); } } }else{ mote.visible = true; var cur_t = (new Date()).getTime()/1000; var distance_traveled = mote.speed * (cur_t - mote.last_run); mote.position.x -= distance_traveled * 20; mote.position.y += Math.sin(mote.position.x) * ((Math.random()*0.08)) + mote.angle_quotient; if(mote.rotation_direction == 1){ mote.rotation += mote.acceleration * (3.14/180); }else{ mote.rotation -= mote.acceleration * (3.14/180); } if(mote.alpha_direction == 1){ if((mote.alpha + mote.alpha_speed) > 1){ mote.alpha = 1; }else{ mote.alpha += mote.alpha_speed; } if(mote.alpha >= mote.alpha_max){ mote.alpha_direction = 2; } }else{ mote.alpha -= mote.acceleration/200; if(mote.alpha <= 0){ mote.alpha_direction = 1; } } mote.last_run = (new Date()).getTime()/1000; } mote = null; } if(mote_container2) for(var c in mote_container2.children){ var mote = mote_container2.children[c]; if(mote){ if(mote.position.x <= -200 || mote.position.x >= mote_container2.width + 200 || mote.position.y <= -200 || mote.position.y >= renderer.height + 200){ if(mote.position.x >= mote_container2.width + 200){ mote.visible = false; mote.position.x = 0 - Math.round(Math.random()*100); }else{ if(mote.position.x <= -200){ mote.visible = false; mote.position.x = mote_container2.width + Math.round(Math.random()*100); } } if(mote.position.y >= mote_container2.height + 200){ mote.visible = false; mote.position.y = 0 - Math.round(Math.random()*100); }else{ if(mote.position.y <= -200){ mote.visible = false; mote.position.y = mote_container2.height + Math.round(Math.random()*100); } } }else{ mote.visible = true; var cur_t = (new Date()).getTime()/1000; var distance_traveled = mote.speed * (cur_t - mote.last_run); mote.position.x -= distance_traveled * 5; mote.position.y += Math.sin(mote.position.x) * ((Math.random()*.05)) + mote.angle_quotient; if(mote.rotation_direction == 1){ mote.rotation += mote.acceleration * (3.14/180); }else{ mote.rotation -= mote.acceleration * (3.14/180); } if(mote.alpha_direction == 1){ if((mote.alpha + mote.alpha_speed) > 1){ mote.alpha = 1; }else{ mote.alpha += mote.alpha_speed; } if(mote.alpha >= mote.alpha_max){ mote.alpha_direction = 2; } }else{ mote.alpha -= mote.alpha_speed; if(mote.alpha <= 0){ mote.alpha_direction = 1; } } mote.last_run = (new Date()).getTime()/1000; } } mote = null; } if(mote_container3) for(var c in mote_container3.children){ var mote = mote_container3.children[c]; if(mote) if(mote.position.x <= -200 || mote.position.x >= mote_container3.width + 200 || mote.position.y <= -200 || mote.position.y >= renderer.height + 200){ if(mote.position.x >= mote_container3.width + 200){ mote.visible = false; mote.position.x = 0 - Math.round(Math.random()*100); }else{ if(mote.position.x <= -200){ mote.visible = false; mote.position.x = mote_container3.width + Math.round(Math.random()*100); } } if(mote.position.y >= mote_container3.height + 200){ mote.visible = false; mote.position.y = 0 - Math.round(Math.random()*100); }else{ if(mote.position.y <= -200){ mote.visible = false; mote.position.y = mote_container3.height + Math.round(Math.random()*100); } } }else{ mote.visible = true; var cur_t = (new Date()).getTime()/1000; var distance_traveled = mote.speed * (cur_t - mote.last_run); mote.position.x -= distance_traveled * 2.4; mote.position.y += Math.sin(mote.position.x) * ((Math.random()*0.02))+ mote.angle_quotient; if(mote.rotation_direction == 1){ mote.rotation += mote.acceleration * (3.14/180); }else{ mote.rotation -= mote.acceleration * (3.14/180); } if(mote.alpha_direction == 1){ if((mote.alpha + mote.alpha_speed) > 1){ mote.alpha = 1; }else{ mote.alpha += mote.alpha_speed; } if(mote.alpha >= mote.alpha_max){ mote.alpha_direction = 2; } }else{ mote.alpha -= mote.acceleration/150; if(mote.alpha <= 0){ mote.alpha_direction = 1; } } mote.last_run = (new Date()).getTime()/1000; } mote = null; } }
  11. Sharpleaf

    WebWorkers and Particles

    I was reading up on WebWorkers and I feel like they could be used to process particles and alleviate the strain that function currently has on my animation loop. I have a few hundred particles floating around in various ParticleContainers (they're magical little "motes" that add to the ambiance). Every animation loop iteration, I have to update their position among many other things that have to happen in the same loop. When looking at what takes the most time per frame, updating the positions of the particles by far takes up the most time. I was wondering if I could offload the processing of the particles positions to a WebWorker. However, I'm not sure how to pass the data back and forth appropriately becuase WEbWorkers don't see any globals or other variables in other scripts. And, if I passed updated messages from the worker to the main thread and then the main thread had to "Apply" those changes, wouldn't that be just as slow? Does anyone have any input on how or if this could work? Thanks!
  12. Sharpleaf

    Particle containers inside a regular container

    Hi Ivan!! I have 2 PIXI.ParticleContainer's inside 1 PIXI.Container Just curious if throwing those 2 particle containers inside a regular container defeats the purpose if the performance gains of the particle containers. Thanks!
  13. I have a few particle containers that I wanted to add a filter to. Now, I know that this can't be done, I've tried And I understand why you can't. So, my solution was to take those particle containers and add them to a regular container and then add my displacement filter to the regular (parent) container. My question is: does this defeat the purpose of the using the particle containers in the first place (performance)? I don't know if this "undoes" what particles containers "do". Thanks!
  14. Sharpleaf

    Render a container to another renderer?

    I don't have much of an answer for you, but when I put the renderTexture.render(stage, null, true); in the animation loop, I got SERIOUS performance problems. Though, my containers were quite large. The problem was so significant that I abandoned the idea pretty much altogether.
  15. Sharpleaf

    Filters on Sprites used as masks

    ok, so I would have to apply the tint to the container before I put it through RenderTexture to get a solid black version of it? Thanks!