The International Simutrans Forum

 

Author Topic: Way drawing order related to tunnel images  (Read 514 times)

0 Members and 1 Guest are viewing this topic.

Offline Phystam jp

  • *
  • Posts: 140
  • (=*^ω^*=)
  • Languages: JP, EN
Way drawing order related to tunnel images
« on: May 05, 2018, 05:35:02 PM »
I am playing simutrans-extended now, but I found some drawing bug(?) related to tunnel images.
1. Tram track on the portal of tunnel is not drawn --- probably behind the backimage of tunnel
2. Track catenary behind terrain is drawn
These images (ways, tunnels, way-objects, vehicles, ...) should be drawn behind the front terrain.
So I propose the drawing order like this:
(back terrain) -> image (way) -> backimage (tunnel) -> backimage(tram) ->backimage (wayobj) -> vehicles -> frontimage(wayobjs) ->frontimage(way) -> frontimage (tunnel) -> (front terrain)
However the importance is low... I will try it.


[note] This issue can also be seen in standard version.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 17765
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Way drawing order related to tunnel images
« Reply #1 on: May 05, 2018, 05:39:59 PM »
That is an interesting observation. I have not looked much into the graphics code (and certainly nothing to do with drawing order), so if you are able to look into this, that would be most useful.

Offline Phystam jp

  • *
  • Posts: 140
  • (=*^ω^*=)
  • Languages: JP, EN
Re: Way drawing order related to tunnel images
« Reply #2 on: May 05, 2018, 06:09:16 PM »
I cannot understand this behaviour...



Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 17765
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Way drawing order related to tunnel images
« Reply #3 on: May 05, 2018, 06:19:43 PM »
Nor can I - I am not familiar enough with the drawing routines to be able to decipher what causes this.

Offline Ranran jp

  • *
  • Posts: 119
  • Languages: ja
Re: Way drawing order related to tunnel images
« Reply #4 on: May 05, 2018, 10:19:02 PM »
 
Quote
1. Tram track on the portal of tunnel is not drawn --- probably behind the backimage of tunnel
This seems to be common issue both Standard and Extended.
I checked this issue in pak.nippon with both Standard and Extended.


 
Quote
2. Track catenary behind terrain is drawn
I think No.2 is pakset issue.
Generally, the catenary pole and overhead wire on the tunnel entrance tile are hidden by the tunnel image. And the part which does not hide is displayed as it is.

The near side pole is not necessary(except for the terminal end:Image[N],Image[E],Image[W],Image{S]), and it should be supported from the near side tile.
For example, North to South catenary image(Image[NS]) need the north side of pole, but the south side pole not needed.

Sorry for my poor Engrish thing. "far side" and "near side" means:

Red position is the "far side". Blue position is the "near side".
 
pak.nippon : Catenary pole is on the far side.
pak128.Britain : Catenary pole is on the near side...
So in the pak128.Britain, the near side of tram wire pole cannot hide in the opposite side tunnel image.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 17765
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Way drawing order related to tunnel images
« Reply #5 on: May 05, 2018, 10:34:08 PM »
Thank you for confirming. I have moved this to the Standard bug reports section, as this issue can be reproduced there.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4494
  • Languages: EN, DE, AT
Re: Way drawing order related to tunnel images
« Reply #6 on: May 06, 2018, 10:08:02 AM »
@Phystam: I cannot  reproduce the issue with catenary behind terrain and with catenary painted on tunnel walls in standard. There are some issues with catenary poles visible on tiles to the side of tunnel portals.

Changing the drawing order to show tram tracks inside tunnel portals is possible but it would be quite hackish.

Edit: with commit r8427 some glitches should be fixed: catenary images that were drawn onto adjacent tiles is now hidden behind the terrain.
« Last Edit: May 06, 2018, 10:42:20 AM by Dwachs »

Offline ACarlotti

  • *
  • Posts: 245
Re: Way drawing order related to tunnel images
« Reply #7 on: May 06, 2018, 10:46:37 AM »
@Phystam: I cannot  reproduce the issue with catenary behind terrain and with catenary painted on tunnel walls in standard. There are some issues with catenary poles visible on tiles to the side of tunnel portals.

Having just checked Standard (and seen results as you describe), that seems to be exactly the same underlying issue; any difference in presentation appears to be due to the differences in the pakset (pak128.Britain has more elaborate catenaries with more widely spaced poles than pak64 does).

The issue in pak128.Britain Extended appears to be because the catenary is rendered after the rendering of the ground of the tile to the south or east. There is some clipping applied to objects, but as far as I can tell this is only for the purpose of rendering vehicles that are straddling multiple tiles. In this case it is evident that we also need to either render the ground after the catenary, or apply more clipping to cover this scenario.
In pak64 Standard, the issue is in fact more difficult, because the depicted catenary occupies (3D) space that is not within the tunnel. This suggests that a full solution of this problem requires separate catenary images for use in tunnels, and use in tunnel mouths.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4494
  • Languages: EN, DE, AT
Re: Way drawing order related to tunnel images
« Reply #8 on: May 06, 2018, 10:59:01 AM »
I cannot reproduce the issue in post #3 in simutrans standard with pak64 or pak128.Britain. So at least this issue is not pak-set dependent, but a bug in simutrans extended.

The tile behind the tunnel portal should have flag draw_as_obj set, which then would paint the vertical wall after the catenary on the tunnel tile is drawn.

Offline Ranran jp

  • *
  • Posts: 119
  • Languages: ja
Re: Way drawing order related to tunnel images
« Reply #9 on: May 06, 2018, 11:30:19 AM »
Sorry, pak.nippon was a special case...
It is almost not covered with a cover, and the entrance is on the back side.
So it seems there is no tram track on the tunnel entrance tile, but it is just one image with road and concrete cover (not separated).
If you try to display tram track here, it is certainly hackish... Dwachs and ACarlotti are right.
« Last Edit: May 06, 2018, 11:54:05 AM by Ranran »

Offline ACarlotti

  • *
  • Posts: 245
Re: Way drawing order related to tunnel images
« Reply #10 on: May 06, 2018, 11:59:26 AM »
I cannot reproduce the issue in post #3 in simutrans standard with pak64 or pak128.Britain.

Oops, retested using the latest version and it is indeed fixed there (wasn't fixed in Standard 120.2.2). Once that fix is included in Extended, then I think the only catenary issue remaining that I know of will be that pak64's catenary doesn't fit inside the tunnel. (It still seems reasonable to aspire to separate graphic - in reality you wouldn't generaly put up ordinary poles inside a tunnel; you'd mount the catenary to the tunnel roof/walls).

I think, fundamentally, the problem in Extended is that we're not consistently picking up changes made in Standard (1354 revisions in Standard since the last merge, and I'm not sure wha tthe policy has been since then). I'm going to post about this in the Extended forums.