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

Road animation should be directional #22

Closed
nvkelso opened this issue Jul 27, 2016 · 9 comments
Closed

Road animation should be directional #22

nvkelso opened this issue Jul 27, 2016 · 9 comments
Assignees
Milestone

Comments

@nvkelso
Copy link
Member

nvkelso commented Jul 27, 2016

  • If it's a oneway road, all animation in one direction (as it is now, but confirm it'll go the "right" direction)
  • If it's not a oneway road, then the animation should go 2 directions (like in v1)
@patriciogonzalezvivo
Copy link
Contributor

this trick needs some changes on the layer. The oneway yes/no is passed as a 'color:'

Look here: https://github.com/tangrams/tangram-sandbox/blob/gh-pages/styles/tron.yaml#L37-L43

Then in the shader we interpret the red color as bidirectional:

https://github.com/tangrams/tangram-sandbox/blob/gh-pages/styles/tron.yaml#L139-L148

@nvkelso nvkelso added this to the 2.0 milestone Aug 31, 2016
@patriciogonzalezvivo
Copy link
Contributor

patriciogonzalezvivo commented Sep 1, 2016

I'm in cross road with this one (see what I just did there ; )
To do one/not-one way roads here I need to add this JS function on the road colors

layers:
    roads:
        data: { source: mapzen }
        draw:
            lines:
                order: 2
                width: 5px
                color: |
                    function() { 
                        if (feature.oneway) {
                            return [0.,1.,0.];
                        }
                        return [1.,0.,0.] 
                        }

Then in the shader "read" the red channel (or any other) and apply something like this . What's the problem?
Using the color pass data between JS and GLSL, makes the color not useful anymore... it over rides it. That in the old tron was solve by hardcoding the color on the shader. I can do that but first we need to simplify and unify this color transitions, if it's possible to one single color... or (if is not possible) a transition between color A and B using the function-zoom:

https://github.com/tangrams/tron/blob/gh-pages/layers/roads.yaml#L71
https://github.com/tangrams/tron/blob/gh-pages/layers/roads.yaml#L210
https://github.com/tangrams/tron/blob/gh-pages/layers/roads.yaml#L229
https://github.com/tangrams/tron/blob/gh-pages/layers/roads.yaml#L272

Here is an example of how hardcoding all the animated roads between COLOR_A: vec3(0.418,0.754,0.736) (for zoom 8) and COLOR_B: vec3(0.086,0.135,0.260) (zoom 13) will look like:

https://mapzen.com/tangram/play/?scene=https%3A%2F%2Fgist.githubusercontent.com%2Fanonymous%2Fb2addb1ee3ab51a6e635f3a7b397aa56%2Fraw%2Fe253d14b7c9ad1bc27ef427d254258426992d8fb%2Fscene.yaml#15.8243/40.7108/-74.0068

@sensescape What do you think? Should I proceed?

Note: this should not add to much GPU processing power...

@patriciogonzalezvivo
Copy link
Contributor

patriciogonzalezvivo commented Sep 7, 2016

@sensescape @nvkelso should I proceed w this changes?

note: is a destructive change... will to all roads to have a two points (A -> B) gradients and all other color rules for them will be lost

@sensescape
Copy link
Member

hmmm not sure, lots of details got lost: line widths look different, road casing is not visible, previous color work and the glow

z12
original:
screen shot 2016-09-07 at 2 29 30 pm
with change:
screen shot 2016-09-07 at 2 29 35 pm

z14
original:
screen shot 2016-09-07 at 2 29 51 pm
with change:
screen shot 2016-09-07 at 2 30 11 pm

@patriciogonzalezvivo
Copy link
Contributor

@sensescape it's possible to tweak the colors to match what it was

Colors A -> B are here in lines 12-14

Zoom for A and B are in lines 8-13

@patriciogonzalezvivo
Copy link
Contributor

@bcamper helps me with this different approach (abbaf7e) that relays on filter logic (which already is very complicated)

@patriciogonzalezvivo
Copy link
Contributor

00

@nvkelso
Copy link
Member Author

nvkelso commented Sep 12, 2016

Verified the directions are now correct for 1 way and 2 way roads (looking at SF).

@nvkelso
Copy link
Member Author

nvkelso commented Sep 12, 2016

@patriciogonzalezvivo If no more work is planned for this, please close issue.

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

No branches or pull requests

3 participants