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

Lane connection overlay and performance improvements #985

Merged
merged 13 commits into from
Jun 8, 2021

Conversation

krzychu124
Copy link
Member

@krzychu124 krzychu124 commented Aug 4, 2020

Closes #282
Fixes #654

  • more accurate lane connection arcs
  • performance improvements by decreasing render box height to minimum value
  • variable line visibility through objects, depends on intersection position (above/under ground)

Accurate arcs:

image

No overdraw below road:

image

Overdraw when underground connection (to be changed):

image
image
image

Issue 1 - circles at ground level, but lane connections on road level

image

Issue 2 - underground connections visible in non-underground mode

image

Issue 3 (another PR?) issue with intersection circles - I need to click on road level, not on circle to enable edit mode

image

Questions:

What should we do with overlay of underground lane connections?
Hide by default and assign new button (which one) to show underground connections on demand?
Turn visibility on, automatically when camera is in Underground mode?
Maybe hide non-underground by default and invert Show on demand button action from previous question?

What to do with markers and lane previews? Should I also decrease render box height to minimum value?

To do list:

  • add reliable function to detect current camera view (over/underground) - camera InfoView.None/InfoView.Traffic
  • correct node marker position (3d space - minimal overdraw)
  • correct lane connector marker position (3d space - minimal overdraw)
  • when overground, disable interactions and make underground lane connections semi-transparent (invert colors. maybe change thickness - need check what looks best)
  • fix calculation of lane markers height
  • fix mouse interactions for underground connections

Low priority (nice to have):

  • change cursor on hover above disabled node - add tooltip info?

Latest build of this PR is available here
No need to build it manually if you want to try it live

…sing render box height to minimum value. Variable line visibility through objects, depends on position (above/underground)
@krzychu124 krzychu124 added enhancement Improve existing feature Accessibility Color blindness, etc. performance Make it faster! LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. labels Aug 4, 2020
@krzychu124 krzychu124 added this to the 11.6.0 milestone Aug 4, 2020
@krzychu124 krzychu124 self-assigned this Aug 4, 2020
Copy link
Collaborator

@kvakvs kvakvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@originalfoo
Copy link
Member

originalfoo commented Aug 5, 2020

Maybe some indented options in mod options > overlays > lane connectors?

  • Filter based on above/below ground view

Render height on lanes (lower is faster): (slider)

@krzychu124
Copy link
Member Author

I need more feedback what to do with underground overlays. Please try it in the game and you will see where is the problem now.

@kvakvs
Copy link
Collaborator

kvakvs commented Aug 18, 2020

Do not use projection textures when rendering underground, draw in 3d space where the junction should be.
Make underground not editable and look different from overground. When the user switches to white underground view, let them edit the underground and make overground not editable and look different.
Lane connectors could also look different like thin hint lines, not projected but rendered in 3d space?

@krzychu124
Copy link
Member Author

Yup, that's the plan.
Height of intersection marker is ok, but I noticed that height of markers (lane connectors) is completely wrong - they position was calculated at ~1/4 of distance between terrain level and expected underground position, so I have to fix that first.
I'll create a checklist :)

@krzychu124 krzychu124 changed the title Lane connection performance improvements Lane connection overlay and performance improvements Aug 18, 2020
@krzychu124 krzychu124 added the ⏸Paused Paused for now label Dec 26, 2020
@krzychu124 krzychu124 added in-progress The problem is being solved currently and removed ⏸Paused Paused for now labels May 29, 2021
…s-Traffic-Manager-President-Edition into lane-connections-accuracy

� Conflicts:
�	TLM/TLM/UI/SubTools/LaneConnectorTool.cs
- changed overlay position for underground,
- added color and cursor for nodes if editing is disabled,
- reduced overdraw of nodes, lane connections and lane helpers,
- improved raycast detection for underground operations
- overground connections are not visible in underground mode and other way around
@krzychu124 krzychu124 marked this pull request as ready for review June 1, 2021 20:47
@kianzarrin
Copy link
Collaborator

kianzarrin commented Jun 2, 2021

[medium priority UI issue]
there is difference between rendered node and select-able node
image
(my cursor over the top node)

@kianzarrin
Copy link
Collaborator

image
I can't select under ground node if there is an over ground road passing by.
over ground roads should be ignored in underground view.

I am not sure if this is withing the scope of this PR. if it is not please create/reference issue.

@krzychu124
Copy link
Member Author

Interesting cases, I'll check why it does not work 🤔

Copy link
Collaborator

@kianzarrin kianzarrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comments above

@krzychu124 krzychu124 removed the request for review from originalfoo June 4, 2021 16:34
@krzychu124
Copy link
Member Author

@kianzarrin
I fixed multiple issues with overlays and lane ray casting underground and elevated roads and improved accuracy.

Minor thing but acceptable: rendered underground lane overlay does not match segment shape (although ray casting is accurate), it always render bezier on the same height (lowest Y of bezier) - that's shader limitation for underground rendering 🙁

With regards to hovered node detection it should work slightly better now but I'll create new issue because to completely fix that we need to build custom ray caster with features like ignoring segments or nodes based on selected mode.
Default tool ray caster is pretty limited in that matter.

@kianzarrin
Copy link
Collaborator

Default tool ray caster is pretty limited in that matter.

the bulldoze tool does not seem to suffer from this problem.

@kianzarrin
Copy link
Collaborator

image
what is the deal with that node in the center of the train station?

@kianzarrin
Copy link
Collaborator

OK I will look more into this.

@kianzarrin
Copy link
Collaborator

why are you using ray-caster from default tool? didn't we wrote our own ray-caster?

@krzychu124
Copy link
Member Author

what is the deal with that node in the center of the train station?

I didn't change anything with regards to detecting which node overlay should be shown (only removed those from dead-ends). I'll check what rules are set there.

why are you using ray-caster from default tool? didn't we wrote our own ray-caster?

We didn't write own ray-caster, you've just added few hacks to correctly detect clicks on the terrain if node/segment is underneath. I don't need that code anymore since I'm rendering overlays where they should be and I don't need default ray-caster for that.

The only problem with ray-caster is detection of which node is hovered when ray intersects with other segments or nodes which we want to ignore. It's not game breaking problem because you can move camera. Probability that users will be changing lane connections underground is pretty low. Most of the times you click on the node and then use "stay-in-lane" feature.

TLM/TLM/UI/SubTools/LaneConnectorTool.cs Outdated Show resolved Hide resolved
TLM/TLM/UI/SubTools/LaneConnectorTool.cs Show resolved Hide resolved
TLM/TLM/UI/SubTools/LaneConnectorTool.cs Show resolved Hide resolved
TLM/TLM/UI/TrafficManagerTool.cs Show resolved Hide resolved
TLM/TLM/UI/TrafficManagerTool.cs Outdated Show resolved Hide resolved
TLM/TLM/Util/Shortcuts.cs Show resolved Hide resolved
TLM/TLM/UI/TrafficManagerTool.cs Show resolved Hide resolved
Copy link
Contributor

@chameleon-tbn chameleon-tbn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ingamte tests:

150 mods
12k assets

All standard stuff seems to work as it should :) Faster... hmmm i can't say... maybe my system is just too powerful ;)

@krzychu124 krzychu124 merged commit 4374f80 into master Jun 8, 2021
@krzychu124 krzychu124 deleted the lane-connections-accuracy branch June 8, 2021 18:19
@originalfoo originalfoo modified the milestones: 11.6.0, 11.6.0.2 Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Color blindness, etc. enhancement Improve existing feature in-progress The problem is being solved currently LANE ROUTING Feature: Lane arrows / connectors Overlays Overlays, data vis, etc. performance Make it faster!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Monorail node circles are projected on the road under
6 participants