Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any ways to create BevelFilter? #1018

Open
CrazyFlasher opened this issue Feb 2, 2018 · 9 comments
Open

Any ways to create BevelFilter? #1018

CrazyFlasher opened this issue Feb 2, 2018 · 9 comments
Labels

Comments

@CrazyFlasher
Copy link

Are there any ready implementations of BevelFilter?
Something like in native flash display list?
gif
32aaacf545

@varadig
Copy link

varadig commented Feb 3, 2018

@CrazyFlasher
Copy link
Author

Yes, I know about dynamic lightning. But I have kinematic animation (not sprite sheet) with starling display object tree created with Flump. I cannot create normal maps in my case

@CrazyFlasher
Copy link
Author

I really don't want do dig into AGAL to write custom shader, so any help will be appreciated :)

@devon-o
Copy link

devon-o commented Feb 3, 2018

That makes sense. I'll drop an email later (may be tomorrow) for more details.

@oskaraqp
Copy link

oskaraqp commented Feb 5, 2018

Just as a suggestion your kinematic animation works moving images(textures extracted from your spritesheet) around so probably the dynamic_lightning approach would work if you can modify Flump in order to use the normal maps and overlap it with the texture(copying the moving and applying it), also a workaround could be to copy the sprite currently being using into a bitmap and apply the filter, time ago I was trying to get the bevel filter to work on Starling but there were some issues to replicate as it was needed a bitmap anyway in order to duplicate the borders.

@CrazyFlasher
Copy link
Author

If I apply filter to each body part used in animation, I'll get bad result:
Expected result:
ex

Actual result:
ac

@CrazyFlasher
Copy link
Author

Btw, inner glow can be used instead of bevel in my case. But I think the problem to implement inner glow is the same as bevel?

@PrimaryFeather
Copy link
Contributor

PrimaryFeather commented Feb 5, 2018

Mhm, with the existing filters, only the Dynamic Lighting extension will give you a bevel-like result. However, it is rendered per mesh, thus the result you're seeing is different than what you'd get with a filter.

It would be possible to create an inner glow filter — with a few adaptations of the Starling code. The DropShadowFilter and the GlowFilter actually work in two steps:

  1. Blur the original object (using a BlurFilter) and tint the result with a single color.
  2. Combine blurred object with original object using a CompositeFilter.

Right now, the CompositeFilter can only draw textures on top of each other. But it was always designed to get a "knockout" mode, where the alpha of one layer is inverted. With that implemented, it should work, in theory.

However, there's still the performance penalty, of course: a blur filter takes several passes, and then it needs to be combined with the original texture. If that makes sense for you depends on the number of objects you need to process like this, and the devices you want to target.

@hardcoremore
Copy link

Yes, Bevel filter would be great addition to Starling!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants