cleod9
July 25, 2020, 11:29pm
1
Just wanted to bring this to someone’s attention so it hopefully gets escalated, but it appears Starling’s DisplacementMapFilter implementation is broken in OpenFL and has been for quite awhile. I found out the solution from this thread here:
made it work thanks anyways
if someone wants the same result update DisplacementMapFilter like this
/ / =================================================================================================
//
// Starling Framework
// Copyright Gamua GmbH. All Rights Reserved.
//
// This program is free software. You can redistribute and/or modify it
// in accordance with the terms of the accompanying license agreement.
//
// =====================================================…
For comparison:
I don’t know if the problem here is the same issue as what Giorgi experienced, but one thing for sure is that Giorgi’s code appears to be the correct implementation of what DisplacementMapFilter should be doing.
I’ve opened up a ticket on Github as well:
opened 11:21PM - 25 Jul 20 UTC
closed 09:12PM - 19 Sep 22 UTC
For reference: https://forum.starling-framework.org/d/21156-how-to-create-a-shoc… k-wave-effect-with-displacementmapfilter-like-this
I spent hours trying to figure out why it was impossible to get my displacement filter code to work like the one linked above, even when I was able to confirm I was placing the effect at the correct coordinates. At first I thought it was some issue with too much Sprite nesting, since the result I was seeing was spitting out pixels that were wildly out of place. But I ended up finding out the DisplacementMapFilter code is incorrect.
**I was able to confirm this by copying code from the user Giorgi on OpenFL's forums, and it actually started working correctly:**
https://community.openfl.org/t/shock-wave-effect-with-displacementmapfilter/11686/2
The easiest way to demonstrate the issue is by compiling the Starling sample demo with Giorgi's code instead of the latest code on 2.5.1 and/or master.
Have a look at a comparison:

If you compare the two images, Starling's code looks rather strange while Giorgi's appears to match the exact behavior on the official Starling website:
https://gamua.com/starling/demo/
I attempted to figure out which line of code exactly is the source of the problem, but unfortunately I wasn't able to figure it out (it's more than just the AGAL code since simply copying that portion from Giorgi's code doesn't work). But overall it appears Giorgi's code is the correct implementation.
Anyway, it seems like a serious issue since the filter is most likely unusable in its current state. Though I imagine it was probably overlooked since these types of effects are a bit complicated for your average every day project.
Is anyone able to speak more to this issue? I could submit a pull request with Giorgi's code if desired but I want to make sure it's safe to do so without breaking existing projects that may rely on the broken code (since i imagine there could be a scenario where the code does in fact work)
Seems like a pretty big issue so it would be great to get some action on this (I’d be happy to open a PR if Giorgi’s code is stable, but I can’t be certain since I don’t understand the diff between the two implementations)
2 Likes