tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.22k stars 290 forks source link

Setting color to be transparent also makes dash_background_color transparent #741

Closed rwrx closed 4 years ago

rwrx commented 4 years ago

I would like to kindly ask you a question regarding color transparency. I have this use case:

The first color track_background_color is set as transparent. The second color track_color is not transparent, this color is used in style dashed_grade5 as dash_background_color. When this style is applied, all lines are transparent although the dash_background_color is not set as transparent and we want to have it opaque. Should it be like this or is it an error which can be fixed? Here are snippets from actual scene file:

global:
    ...
    track_background_color: [1.0, 1.0, 1.0, 0.3]
    track_color: [0.6, 0.4, 0.0]
    ...

styles:
    ...
    dashed_grade5:
        base: lines
        blend: translucent
        dash: [1.5, 2.5]
        dash_background_color: global.track_color
        material:
            diffuse: 1.0
            ambient: 1.0
    ...

layers:
    ...
    roads:
        ...
        grade5:
            filter: { tracktype: grade5 }
            draw:
                lines:
                    style: dashed_grade5
                    color: global.track_background_color
                    width: [ [13, 1px], [16, 3px]]
                    visible: true
                    outline:
                        color: global.track_background_color
                        dash_background_color: global.track_background_color
                        width: 5px

dashed

bcamper commented 4 years ago

Hello, thanks for your example styling -- I do think this is a bug. Based on your description and style, I think this is what you would have expected, can you confirm?

tangram-@17 8875 37 7936 -122 4628_2020-01-10_00 54 50

rwrx commented 4 years ago

Yes, this is what I expected to see with that styling. I am also not sure if this is also present in Tangram-ES.

bcamper commented 4 years ago

Thanks, I've opened the #742 PR to fix this (and related logic issues with dash/line texture/blend mode behavior). This issue does appear to exist in Tangram ES as well, we will take care of opening a corresponding issue there.

rwrx commented 4 years ago

Thank you a lot.

bcamper commented 4 years ago

Fix released in v0.20.1