Elvas Tower: Close surfaces are rendered differently (z-clipping?) - Elvas Tower

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Close surfaces are rendered differently (z-clipping?)

#1 User is offline   jonas 

  • Fireman
  • Group: Status: Active Member
  • Posts: 243
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 03 December 2018 - 12:58 PM

Maybe this is already known here and discussed in a thread. In any case, it seems like a bug or at least as not intended in OR.

With different cameras, the same scenes are rendered differently when it comes to close arranged surfaces (terrain):

Attached Image: Schotter.jpg
As a result, it is often difficult for me as route builder to precisely raise the terrain for OR and some signal signs (right buffer) are not displayed properly or only at close proximity.


Attached Image: Gully.jpg
Even tracks are often shown as interrupted (red highlighted gaps) and here the drain is not displayed at all.

Is it possible to adjust the different cameras uniformly?
The Key 8 camera should be the reference like corresponds to the view in MSTS where the bug does not occur.

#2 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,072
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 11 December 2018 - 01:10 PM

View Postjonas, on 03 December 2018 - 12:58 PM, said:

Maybe this is already known here and discussed in a thread. In any case, it seems like a bug or at least as not intended in OR.

With different cameras, the same scenes are rendered differently when it comes to close arranged surfaces (terrain):

The reason that this occurs at all is because different cameras have different "near plane" distances (the closest distance from the camera for things to render before being cut-off) and, unfortunately, the near plane does affect the quality of the z-buffer (depth buffer used for clipping and figuring out what is on top of what).

The current values are:

  • Passenger/3D cab camera: 0.1 m
  • Brakeman/head out: 0.25 m
  • Everything else: 1.0 m

The problem with just changing the near plane to 0.1 m (the closest value) for all cameras is that, although it lets you render things up to 10cm from the camera and close-by surfaces might have less z-fighting (where things get layered incorrectly, sometimes flickering), it makes the further-away surfaces worse.

You might even be seeing this in your first screenshot, where the close terrain looks better in the head out camera (because of the lower near plane value) but one of the buffers has lost its icon/sign, likely for the same reason (lower near plane).

This means that it is unfortunately a trade-off, and even if you find the "perfect" value the quality of the z-buffer actually varies by depth. Further away has less precision - this is intentional, by the way - but how quickly it gets worse is affected by the near plane.

As a content creator, I'm afraid you'll have to work to the "worst" of these at all times; camera 8 will give you the worst up-close experience but the best in-the-distance experience, while the passenger/3D cab camera will be the opposite.

#3 User is offline   jonas 

  • Fireman
  • Group: Status: Active Member
  • Posts: 243
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 13 December 2018 - 01:19 AM

Thanks James for the detailed insight on how the cameras near plane and z-buffer are related. I have come up with even more questions.

The camera 8 seems to give me the best result in almost every situation. Especially in my first screenshot it is just to see on the left that the terrain is displayed over the track ballast, what actually corresponds to the scene. The terrain is slightly higher than the base plate of the track and only the rails should be visible. The right one with the headout camera (key "End") sees through the terrain to gravel of the track shape, whats not correspont to the scene. Also, the signal sign on the buffer pile is displayed correctly with the camera 8.

What do you mean by „it makes the further-away surfaces worse.“ A loss of visual quality of distant objects? In my second screenshot I can hardly see any differences of objects in the distance. Only in the foreground, the gully is not displayed and the rails are seen as interrupted, if you do not use the camera 8.

What near plane adjustment does MSTS have for its yard cam? In MSTS, I always have a WYSIWYG impression when I adjust objects. What I build and adjust with the MSTS RE is shown in the (MSTS) game as well. But unfortunately not in OR. There I regularly get a lost buffer signal signs :-) and the track gravel often breakes through the terrain.
Attached Image: NearPlane.jpg


Do you mean it is possible to make the near plane pro camera user-adjustable? Maybe under Experimental or with the middle mouse button + another button.
I would find it easier to work, if at least the camera 8 in OR corresponds more to the yard cam of MSTS.

#4 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,072
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 19 December 2018 - 11:03 AM

View Postjonas, on 13 December 2018 - 01:19 AM, said:

The camera 8 seems to give me the best result in almost every situation. Especially in my first screenshot it is just to see on the left that the terrain is displayed over the track ballast, what actually corresponds to the scene. The terrain is slightly higher than the base plate of the track and only the rails should be visible. The right one with the headout camera (key "End") sees through the terrain to gravel of the track shape, whats not correspont to the scene. Also, the signal sign on the buffer pile is displayed correctly with the camera 8.

That's to be expected of camera 8, as it uses the 1.0 m near plane, just like cameras 2, 3, 4, 6 - the further away it is, the better the depth buffer quality.

View Postjonas, on 13 December 2018 - 01:19 AM, said:

What do you mean by „it makes the further-away surfaces worse.“ A loss of visual quality of distant objects? In my second screenshot I can hardly see any differences of objects in the distance. Only in the foreground, the gully is not displayed and the rails are seen as interrupted, if you do not use the camera 8.

I think the concept of what is near and far to you and I is different to that of the computer; when you turn the near plane down to 0.1 m (like the passenger camera does), even objects just a couple of metres away could become incorrectly displayed if they are sufficiently close in 3D space.

The only solution at present is to make the objects further apart, so that the less accurate depth buffer still gets the ordering correct.

View Postjonas, on 13 December 2018 - 01:19 AM, said:

What near plane adjustment does MSTS have for its yard cam? In MSTS, I always have a WYSIWYG impression when I adjust objects. What I build and adjust with the MSTS RE is shown in the (MSTS) game as well. But unfortunately not in OR. There I regularly get a lost buffer signal signs :-) and the track gravel often breakes through the terrain.
Attachment NearPlane.jpg

According to my original MSTS camcfg.dat file, all the cameras use a near plane of 0.5 m, except the passenger camera, which uses 0.1 m.

View Postjonas, on 13 December 2018 - 01:19 AM, said:

Do you mean it is possible to make the near plane pro camera user-adjustable? Maybe under Experimental or with the middle mouse button + another button.
I would find it easier to work, if at least the camera 8 in OR corresponds more to the yard cam of MSTS.

I am not entirely sure what you mean here; are you saying Open Rails' camera 8 is not doing what you want?

#5 User is offline   jonas 

  • Fireman
  • Group: Status: Active Member
  • Posts: 243
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 20 December 2018 - 06:23 AM

View PostJames Ross, on 19 December 2018 - 11:03 AM, said:

... are you saying Open Rails' camera 8 is not doing what you want?

Yes, in a way: In medium distance (lets say 10m to 20 m) the OR camera 8 is ok to me (see picture 1 in post #1). But at a larger distance it is different compared to the MSTS yard-cam 7 (see comparing picture in post #3).
That's why I asked for a way to make the cameras in OR user adjustable - according to the ZClip (...)-parameter in the "camcfg.dat" in MSTS.

#6 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,072
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 21 December 2018 - 01:10 AM

View Postjonas, on 20 December 2018 - 06:23 AM, said:

Yes, in a way: In medium distance (lets say 10m to 20 m) the OR camera 8 is ok to me (see picture 1 in post #1). But at a larger distance it is different compared to the MSTS yard-cam 7 (see comparing picture in post #3).
That's why I asked for a way to make the cameras in OR user adjustable - according to the ZClip (...)-parameter in the "camcfg.dat" in MSTS.

The differences could be due to the depth buffer (0.5 m vs 1.0 m near planes) or other differences in the rendering system - for example, MSTS draws some things in a specific order (e.g. ballast always appears under other scenery), where as OR generally draws things only according to their 3D location.

It might not be a good idea to let anyone change the near plane easily, because it does have effects on the rendering and the effects are only actually fixed by the content creator placing items appropriately. If you change your near plane and then place items for that value, you might create lots of content that won't display right without everyone else changing their near plane - a quite unacceptable situation IMHO.

#7 User is offline   jonas 

  • Fireman
  • Group: Status: Active Member
  • Posts: 243
  • Joined: 04-April 14
  • Gender:Male
  • Simulator:MSTS & OR
  • Country:

Posted 25 December 2018 - 10:12 AM

View PostJames Ross, on 21 December 2018 - 01:10 AM, said:

... you might create lots of content that won't display right without everyone else changing their near plane - a quite unacceptable situation IMHO.

You will be right with that. This would probably lead to a visibility chaos - leads to inconsistent render results.

I have set for testing purposes different NearPlane settings for the cam 8 in the code. I've got the impression that the well differentiated display of near surfaces is probably solved dynamically by MSTS. In OR, only a 2.5 m NearPlane-value achieves a similarly good result from a bigger distance (height) as in MSTS:
Attached Image: NearPlan_in_OR.jpg
But since in the camcfg.dat of MSTS the ZClip is set to 0.5 m, I wondered how it was solved in MSTS that good. Hence, my idea that MSTS take in to account the camera-height above the ground as a dependency-factor. The higher the camera, the higher the NearPlane value (of course, only for outdoor cameras). Possibly 1/10 of the height, e.g. a height of 25 m = 2.5 m factor for the NearPlane-Value. Could that solve the near-surface problem in OR?

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users