Multiple Displacement Filters = Black Flickering
See original GitHub issueI made a “water ripple effect” that demos the issue: (Just click to add a displacement filter.) http://commins.ca/pixijs-ripple/
Every time you click, a new filter is added, and the screen flashes black.
Issue is present on latest release and dev builds.
<!DOCTYPE html>
<html>
<head>
<title>PixiJS Ripple</title>
<script src="http://pixijs.download/dev/pixi.min.js"></script>
</head>
<body>
<script>
var stage = new PIXI.Container();
var renderer = PIXI.autoDetectRenderer(512, 512);
document.body.appendChild(renderer.view);
// load assets
PIXI.loader
.add("background.jpeg")
.add("map.png")
.load(setup);
var ripples = [];
function setup() {
// background
var bg = new PIXI.Sprite(PIXI.loader.resources["background.jpeg"].texture);
bg.anchor.set(0.5);
bg.scale.set(0.6);
bg.position.set(renderer.view.width/2, renderer.view.height/2);
stage.addChild(bg);
// add new ripple each time mouse is clicked
renderer.view.addEventListener('mousedown', function(ev) {
ripples.push(new Ripple(ev.clientX, ev.clientY));
stage.filters = ripples.map(function(f) { return f.filter; });
}, false);
gameLoop();
}
function gameLoop() {
requestAnimationFrame(gameLoop);
// update ripples
for(var i=0; i<ripples.length; i++) {
ripples[i].update();
}
renderer.render(stage);
}
function Ripple(x, y) {
// sprite
this.sprite = new PIXI.Sprite(PIXI.loader.resources["map.png"].texture);
this.sprite.anchor.set(0.5);
this.sprite.position.set(x, y);
this.sprite.scale.set(0.1);
stage.addChild(this.sprite);
// filter
this.filter = new PIXI.filters.DisplacementFilter(this.sprite);
}
Ripple.prototype.update = function() {
this.sprite.scale.x += 0.025;
this.sprite.scale.y += 0.025;
}
</script>
</body>
</html>
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Multiple Displacement Filters = Black Flickering · Issue #3609
Multiple Displacement Filters = Black Flickering #3609 ... Every time you click, a new filter is added, and the screen flashes black.
Read more >Screen flickering & Turns black
Hi All, I have been facing this issue on 2 different versions. When i open photoshop there is no issue however when opening...
Read more >Camera movement makes displacement map flicker
It happens everytime I try to add displacement mapping to an object. I tryed in both Arch and design, but also standart maps....
Read more >Horizontal black flickering lines after screen replacement? - ...
I had the same problem with horizontal lines. I tried unplugging and plunging the cables many times and it did not work. I...
Read more >How to fix flickering in animations?
Solutions: - Render your frames in a higher resolution and downscale them in postproduction. - Use an Image Filter with a higher Width...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I still get a flicker in Chrome with this - ah wait, I didn’t update my Pixi yet 😃
@kaansoral , your issue is different from this issue.
I’ve fixed this issue, but I am powerless about yours.