-
Notifications
You must be signed in to change notification settings - Fork 2.3k
add some comp-op blend modes #380
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
Conversation
currently only hard-light and multiple are exposed
|
Awesome! Not sure we want to complicate the style format with the concept of "base" layers though. Moreover we're trying to get on parity with Mapnik here, and the styles there just blend over layers below it, right? |
|
This is great! I'm imagining one potential option where the blend only gets applied within the specified 'layer group'. {"layers": [
{"id": "one"},
{
"id": "two",
"layers": [
{"id": "three"},
{"id": "four"}
]
},
{"id": "five"}
],
"styles": {
"three": {"comp-op": "multiply"},
"five": {"comp-op": "multiply"}
}}If a layer is within a composite, the comp-op gets applied to all layers under it within that group (ie. applied to "four" only affects "three"). If the layer with the comp-op is not within a composite group or the comp-op is applied to the composite layer itself, the comp-op is applied to all layers beneath it (ie. applied to "five" affects all). This is similar to how photoshop blend modes work. Not sure if that makes sense or if I'm understanding this correctly. Either way, I like the idea of removing the base layer complexity. |
|
@edenh yes, I think this is the right way they should work implicitly — makes perfect sense. |
|
@ansis any updates? |
I think we should introduce base into the style, because it's closer to how the rendering actually works. The implementation renders two separate groups and then blends them together. If we don't have it this way in the style, we'd need to automatically group layers when processing the style. Having to explicit specify base makes some uses more awkward, but I think that's ok. comp-op use should be careful and infrequent. |
|
@ansis when you define a composite layer that specifies some base, is the place of this base layer within the layer structure irrelevant and gets superseded because it's drawn only as a part of composite? |
I'm not sure I understand what you're asking. When its time to render the blended layer, it first renders both child layer groups into separate, blank textures. It blend the two together and draws the result onto the main canvas. Both layer groups are only used within the blended layer. |
|
Oh, I misunderstood the sample config. It's clear now. |
|
OK, I thought about this in context of a real style (outdoors) and now I see what's the issue. If it works magically and you're not careful, it's very easy to screw up the performance. Explicit compositing makes it much harder to do this. So good to merge from me 👍 |
|
As I'd also love to see blend modes for my own hill-shading layer... |
|
Any news on getting comp-op back to life? If luma.gl can do it, MapboxGL can do it too |
Partial support for blending layers with compositing operations.
The layer looks like this:
The layerGroup
layersis blended on top ofbase.And the style:
Two comp-ops are exposed right now:
hard-lightandmultiply.More are implemented in the shader, but the way they are exposed right now involves compiling a separate shader for each one. This means we'll need to:
Should we drop having
baseexplicitly specified, and instead use all the layers below it in the style?