0xd0 – Fix Scenery Texture

--
By: Tim de Klein (TdK), August, 17th, 2008.
First off all:
This document explains how the 0xd0 command works, and what it can do. I discovered how this command works just by experiment during the making off my Mid-Ohio and Zolder tracks. 
.
All the 0xd0 commands in the Zolder track have a function, those in the Mid-Ohio track are not all correct, but I can guarantee that everything within this document is for almost 100% accurate.
--

What 0xd0 does/can do:
It’s an simple command with 3 arguments that can eliminate flashing scenery panels and fences, and wrapping textures on a panel. A panel can be everything. A ribbon, verge, track, fence, etc…
.
But It can do more. Sometimes a track, or most likely, a pitlane road, gets disturbed. A great example is shown below:
-
As you can see the yellow lines on the right, but 
particularly on the left are straight!
..
But for sure this is a corner(!) in the exit of the 
pitlane…
...
With help of the 0xd0 command, this problem 
can be solved.
...
This is explained how, later on…
So simply said, it “can” solve every visual imperfection! Which is very useful with track making.
--

Standard 0xd0 information
The command makes use off 3 arguments. Named in the Track Editor as:
a1 = Unused
a2 = 1st  Ugly Factor – Location Code Type F
a3 = 2nd Ugly Factor – Location Code Type F
As we all know, a1 is the offset. So everything within the track length is allowed. But, a2 and a3 become more difficult. I discovered that:
-
a2 = Wrapping textures. This is simply a texture that won’t stand still on a panel. It just moves 
        around between the two swivel arms, or the begin and end of an (track)sector.
-
a3 = Flashing panels. Well, you would say ribbons, banks, verges, fences.. etc. NO! Wrong, 
        a3 only affects the ribbons and banks. So scenery structures.
-
But what to do if I have a flashing fence or verge?
That’s the weird thing about it. To prevent them from flashing (as you notice it), you need to set a location code in a2, and most off the time in a3. Don’t know why, but it works the best that way. Maybe we see it as flashing, but actually it’s wrapping/moving around within the sector offsets. A bit strange but true…
-
‘Location Code Type F’
Now we know what to do when. But, how does the “Location Code Type F” work?
-
From what has been discovered until now, only the codes for the left and right bank are correct. All the other codes are unknowns.
-
But not anymore! While making the Mid-Ohio track, and the under construction Zolder track, i had a lot off flashing panels, wrapping textures, to much to deal with. There was no reason to make several track sectors for every problem area, or insert more scenery commands to solve the problems. 
-
So I decided to explore how the 0xd0 command works. Which turned out to be more useful in more than one way. 
-
Because the track(s) had so many visual imperfections, I was able to find out every code from the “Type F” table.
-
This is how it should look:
Code Description Code Description
1 Trackside right 2 Trackside left
4 Type B kerbstone 8 Type A kerbstone
16 Right fence 32 Left fence
64 Right verge 128 Right verge (including a texture)
256 Left verge 512 Left verge (Including a texture)
1024 Bank left (Values 0, or below 0)------ 2048 Left bank
4096 Right bank 6144 Ribbon 2
8192 Ribbon 3 16384 Ribbon 4
-1 Ribbon 1(!) -- --
Explanations:
Why is the code from ribbon 1, the value -1?
I think this should be 32768. Only this value can’t be entered into the command. That’s why the -1 gives 32767+1=32768. Strange, but true.
--
What is a trackside?
The lines around the track. So the white ones on the track, the yellows in the pitlane. When both location codes used,  you will have the location code (3)
for the road.
--
Do kerbstones flash?
No. But they do deform a lot. That’s why both have a location code. One single value code (4 or 8) works for the left and right side. 
--
Kerbstone example:
The original MircoProse San Marino track. Track sector 61 has an 0xd0 command to correct the kerbstone. 
--
On the left is how it looks like with the command. On the right without the command. See how the kerbstone gets disturbed without this helpful command.
----
a1 = set at: --- 13 --- That’s where the kerbstone may go from a “Type B”, to a “Type A”.
a2 = set at: --- 4 --- The location code for the “Type B” kerbstone.
A verge including a texture?
On verges you place textures a lot. Gravel, tarmac, etc. Mostly in corners this textures can be disturbed. When you have a texture disturbed on a verge, use code value 128 or 512, depending on which side it is placed.
--
Bank left (Values 0, or below 0):
A strange location code. Only found it in F1ct06, and F1ct04 of the original MicroProse tracks. 
--
It’s for sure the left bank. But only if the Z value of this bank is 0, or below 0. In F1ct06 it’s used in the river on the left side down the long-curved straight, track sector 62. In F1ct04 it is used in the right-hand corner before “Loews Hairpin”, track sector 32.
--

Strange code values like 24576:
Maybe most off the track makers know this already, but for those who don’t: 
These kind off “weird” values are created by adding one code to another. 24576 is made out off the location codes from Ribbon 3 (8192) and Ribbon 4 (16384). 
--
The game itself is smart enough to sort out which panels are included within the “add-on” value. 
--
48 for an example consists out of both fence codes, 32 and 16.
--

Now, let’s go back to this:
---
I’ve already told that the 0xd0 command can do more than stop 
ribbons or fences from flashing and/or wrapping. 
--
Sometimes, but usually in the pitlane, the road gets disturbed.
--
When the track is deformed/disturbed, it’s most likely to be seen 
when in camera view.
To solve this type of visual imperfection, the 0xd0 command can be used with the value 39. At least, that’s the value I used within the pitlane off the Zolder track. What does 39 stand for than?
Trackside left ----- 2
Trackside right 1
Fence right 32
Type b kerbstone 4
--------+
39
I used code 4 because I first used this code for use within the track, where there was a type b kerbstone on the inside of that corner. But in the pitlane there’s no kerbstone, but that doesn’t matter. 35 (so all, but without the kerbstone) will give the same effect.
--

Some final notifications:
1)  Something i didn’t discovered, is how to integrate the -1 value for Ribbon 1, with other values. If you have flashing fences, and a flashing ribbon 1, 48 + -1 = 47, won’t work as an location code. I think it’s best when this happens, to make separate 0xd0 commands in that sector.
2) The Zolder and Mid-Ohio track are created with the Gp2 TrackEditor 1.9.1.488 by Paul Hoad. I think in older versions of the TrackEditor this information is as useful as it is with the newest version, but it’s not tested.
3)  Never insert a 0xd0 command with a scenery location code included, when scenery at that point is turned off. This is the same for fences, when they are turned off. This will give strange effects on other textures. It can affect the cars driving around, or (maybe) the objects. There is even a change of creating GFX bugs.

‘Disclaimer’:
The reason i wrote this document, was to let other track makers learn how to fix visual bugs/imperfections in their own tracks. 
--
I can always give (some) assistance, but only if this document doesn’t help, and/or you’ve tried your best to fix the problem.

--
TdK.