PDA

View Full Version : Roads in TANE



andi06
June 14th, 2015, 03:58 AM
Since all of my other projects are currently on hold pending game development I though that I would re-visit roads which look absolutely dreadful in TANE.

1. The main issue is that roads float above the terrain and in doing so they cast a shadow on the baseboard. There are various things that can be done with the road mesh to work around or prevent this but none of them are entirely satisfactory. Is is possible to prevent roads from casting shadows, either as a class or by way of a config tag? This might not be much of a solution but at least we wouldn't be drawing attention to the problem.

2. We seem to have lost the ability to use alpha-blended meshes parallel and close to the ground, this affects groundplane shadows cast by cars onto the road surface (and by trains onto track), headlights in night-mode, light pools and various other effects. Presumably this is a bug which will be fixed?

3. I'm still seeing road traffic with wheels buried in the asphalt. I've tried to measure the ride-height of these vehicles but they keep moving and I'm not quick enough. How high above the spline origin do you actually insert the traffic these days?

WindWalkr
June 14th, 2015, 04:09 AM
Is is possible to prevent roads from casting shadows, either as a class or by way of a config tag?

Not currently. It's fairly trivial for us to add this, so if we can't find a better solution then this is always available as a fallback.

In the real-world sense, obviously roads do not float above the ground, and raised roads also do cast shadows, both of which suggest that the above is a poor first choice as a solution. In Trainz, the issue is always going to be that road splines which are too close to the ground height will either (1) z-fight with the ground, or (2) actually interpenetrate the ground, if it's not sufficiently flat. Solving this is difficult and suggests that we will always want the road to be raised to some degree, which in turn suggests the use of some edging polygons similar to how ballast is formed for track splines.



2. We seem to have lost the ability to use alpha-blended meshes parallel and close to the ground, this affects groundplane shadows cast by cars onto the road surface (and by trains onto track), headlights in night-mode, light pools and various other effects. Presumably this is a bug which will be fixed?

You don't specify what you mean by "lost" here? Certainly you can still do that, so it's clear that you mean the visual result is unsatisfactory rather than that it's not possible. There are a variety of ways in which this may be unsatisfactory, so it might help if you give some examples of what you've tried and in what way it has failed. Screenshots would be welcome.



3. I'm still seeing road traffic with wheels buried in the asphalt. I've tried to measure the ride-height of these vehicles but they keep moving and I'm not quick enough. How high above the spline origin do you actually insert the traffic these days?

At a casual glance, it seems to be 0.22m - and I would think that this relates to ground height, not spline height.

chris

andi06
June 14th, 2015, 05:21 AM
Not currently. It's fairly trivial for us to add this, so if we can't find a better solution then this is always available as a fallback.
I think that you will have to deal with legacy roads in this way.

603

In the screenshot the road and pavement both float and in TS12 this looks OK as a quick representation because the ground texture reads under the edges of the splines and the observer doesn't recognise that there is a gap. The shadows added by TANE destroy the illusion. Some roads use transparency at the edges to allow the ground texture to bleed through and avoid the hard edge, again this works well enough in TS12 but edge transparency and shadows don't mix well in TANE.

If this configuration were to be modelled as a single asset for TANE the outer edge of pavement would probably be at least 300mm high, even on flat ground and this would again cast a shadow where we don't want one.


Solving this is difficult and suggests that we will always want the road to be raised to some degree, which in turn suggests the use of some edging polygons similar to how ballast is formed for track splines.
Always is a dangerous word but I must admit that this was also my first thought.

604

Works well enough and when the shoulder gets too high you can substitute an asset which includes a retaing wall.

But one problem is that not all roads look like this. Another is how do we texture shoulders which are going to be stretched even on much smaller elevations than these - and how do we get sufficient variation in the edges to avoid a clinical appearance?


At a casual glance, it seems to be 0.22m - and I would think that this relates to ground height, not spline height.
Thanks, I'm not sure about the ground height bit. Certainly cars follow the baseboard surface rather than the spline when they are first placed (which looks rather strange) but by fixing the spline vertex heights you can get the traffic to follow the spline quite smoothly.


... the visual result is unsatisfactory rather than that it's not possible. There are a variety of ways in which this may be unsatisfactory, so it might help if you give some examples of what you've tried and in what way it has failed. Screenshots would be welcome.

605606

The headlight beam in the first screenshot (doctored because nightmode is virtually invisible) and the ground shadow in the second are both alpha textures with smoothly blended fall-off. This is rendered as intended in TS12 and was OK in some older TANE builds. But in 76401 this smooth fall-off is reduced to broad hard-edged zones. There were some cases in the past where this sort of thing was texture compression related.

WindWalkr
June 14th, 2015, 06:14 AM
Another [problem] is how do we texture shoulders which are going to be stretched even on much smaller elevations than these

I'm assuming that you're setting it to follow ground height here? It's inevitable that stretching will occur in this scenario, and it's up to the route builder to ensure that the asset is used appropriately. I guess it would also be possible (looking forwards) to specify an upper limit on how far the engine will move any given vertex, to allow a small amount of ground-following without inducing excessive stretching if the asset is inappropriately placed.



..and how do we get sufficient variation in the edges to avoid a clinical appearance?

I'm not really sure what you're referring to here. If you're just talking about randomisation, then you've answered your own question.



Thanks, I'm not sure about the ground height bit. Certainly cars follow the baseboard surface rather than the spline when they are first placed (which looks rather strange) but by fixing the spline vertex heights you can get the traffic to follow the spline quite smoothly.

To some extent this also likely depends on whether you're talking about a pre-2.9 spline, or something newer. I'm assuming that you're referring to a modern spline here.



The headlight beam in the first screenshot (doctored because nightmode is virtually invisible) and the ground shadow in the second are both alpha textures with smoothly blended fall-off. This is rendered as intended in TS12 and was OK in some older TANE builds. But in 76401 this smooth fall-off is reduced to broad hard-edged zones. There were some cases in the past where this sort of thing was texture compression related.

This is likely the result of alpha-to-coverage being used for this material. That likely happens in TS12 as well in most cases, but it is very subject to the level of anti-aliasing in use. What we really want here is a decal material that uses unsorted alpha blending instead of alpha-to-coverage. Improving our selection of materials is definitely something to investigate in the near future.

chris

clam1952
June 14th, 2015, 07:23 AM
Roads.... yes it's now glaringly obvious where they are not sitting tight to the ground.
Ride-height issue I have sorted on my own roads, I use z=0.15 for the road surface assuming flat surface, which solves the carz digging into the road surface issue, value arrived at by a lot of to and fro from modeller to Trainz. Annoyance of the ride-height issue was the reason I started rolling my own roads. Not going to get away with just laying the road on the terrain at that height though without some adjusting unless on flat ground.

A no shadow tag for roads and similar would probably be the simplest approach, bearing in mind a lot of routes contain roads that are just plonked down and have lots of gaps! maybe I'm too fussy but now it's become an issue.

Edit: Put wrong z height, measured the first mesh I found, the wrong one!

TRam__
June 14th, 2015, 07:52 AM
A no shadow tag for roads and similar would probably be the simplest approachNot only for roads, but for scenery also :) . Best solution will be to add it as a mesh-table tag, in this case it will be possible to add it to a traincar's static shadow.

Oh, if we will have a tag for invisible object that casts shadows (and do not cast on discussed before :udrool:)

andi06
June 14th, 2015, 11:19 AM
This is likely the result of alpha-to-coverage being used for this material. That likely happens in TS12 as well in most cases
I've never seen this in TS12, nor in earlier TANE builds. I've never changed anti-aliasing from the default in any build or version.

Roads
I've looked at these in more detail today and I'm more convinced than ever that we need a tag to disallow shadows which should probably default to true for pre TANE spline assets. In most routes roads are just decoration - a floating plane, hard edged or with an alpha gradient, will always be relatively inexpensive and perfectly adequate for background scenery. There are going to be other situations where shadows should be suppressed so I think this should be introduced for general scenery assets as well.

607

The road in the screenshot has ground anchored shoulders and can be rendered by the existing spline system, traffic moves smoothly in both planes and I think that its pretty close to what we need for more detailed roads.

The spline has smooth transitions both in plan and in section and to do this you need to have fixed track vertices wherever there is a change of gradient. This makes it easy to edit the spline height or position or to edit the terrain without affecting the spline.

As far as I can see though there is no combination of tags at present that can get even close to this by default and you need to do quite a lot of editing to get the road behaving this way.

As you said, this particular road has 'follows-spline-gradient 1' and when first placed the spline is drawn in a straight line ignoring any changes of baseboard level. Cars moving along such a spline follow the spline centre in plan but move along the ground itself in section, which is amusing but unhelpful.

With 'follows-spline-gradient 0' cars follow the spline but there is no smoothing whatsoever in section and I don't see how such a spline can be edited to get smooth changes of gradient.

Even on far less extreme ground than this the shoulders get horribly stretched and will be next to impossible to texture successfully, is there any possibility of:

1. A material using a fully tileable texture that retains its UV co-ordinates relative to the real world even when the mesh is stretched (and preferably retains its horizontal plane so that brick or stone courses don't acquire a slope) or

2. A material that acts like a baseboard section and will accept ground-texture application (this might have far wider application).

Lastly and for reasons made clear in discussions about super-elevation we would ideally need the ability to supress the 'adjust-height-to-ground-threshold' behaviour when such a spline is part of a bridge or tunnel.

andi06
June 17th, 2015, 04:57 AM
Additional circumstances in which mesh level shadow suppression is needed:

1. Ground plane shadow meshes currently cast shadows!

2. Transparent roofs:
612

3. Graphic indicators like the mouseover rectangle in this shot:
611
this is more of an issue in Surveyor where the additional shadows can be very distracting, but it happens in Driver as well.

norfolksouthern37
June 17th, 2015, 08:36 AM
Not only for roads, but for scenery also :) . Best solution will be to add it as a mesh-table tag, in this case it will be possible to add it to a traincar's static shadow.

Oh, if we will have a tag for invisible object that casts shadows (and do not cast on discussed before :udrool:)

Agreed fully. Made the suggestion long ago and got zero or unrelated response as usual. several splines are intended as road markings for example, those should not cast shadows. Some track splines are intended to appear to be embedded in pavement but are in reality floating just above. In TANE the shadows give this away.

JCitron
June 17th, 2015, 12:11 PM
These are the two things that always annoy me too; floating track and floating roads. The roads I think look worse because they're thin and appear more like a ribbon than a road. This becomes an issue too, as has been mentioned, when using ground-plain light spots and even other assets such as static carz, lamp posts, etc. as they punch through the surface or don't display properly due to the floating tape-roads being above the ground-level.

Maddy's YARN series resolved the floating bit by making the road parameters thicker on top, but perhaps roads that are at the ground-level, but thicker on the bottom would be better.

There are some parameters which allow the track splines to be buried beneath ground-level so they don't float.

Is there a reason why roads and other splines aren't treated like track and make use of these track-parameters?

This may, or may not be a more complicated approach to the floating and shadow issue, but I am all for seeing some kind of resolution to a long-time Trainz issue.

John