Surface and Content flags of Sin SWL textures - Part II
by Eutectic


1. Surface types

So far, I have described the way to set the Flags register in Sinview to set the surf flags of a texture but there are some bits in there that remain obscure in the first and second nibble: 80000000 and surfbit0 - surfbit3. Let's look at the Flags register again but this time, I will only display the part that's relevant to this:

0 This part is reserved (do not use)
x
0 Bit 3 : 80000000
Bit 2 : surfbit3
Bit 1 : surfbit2
Bit 0 : surfbit1
0 Bit 3 : surfbit0


These bits, when set, will set the corresponding grayed out flags in SinEd's surface inspector but more importantly, they will set the Surface Type of your texture as can be seen as outlined in yellow in the image below:




First of all, let's take care of the 80000000 bit. It doesn't affect the surface type of the texture whether set or clear, in fact it doesn't do anything other than to put a check mark in the 80000000 check box in SinEd's surface inspector. Since it has no real effect, we can simply drop it and keep only the surfbit0 - surfbit3 bits as these are the only ones which really matter for surface types:

0 This part is reserved (do not use)
x
0 Bit 2 : surfbit3
Bit 1 : surfbit2
Bit 0 : surfbit1
0 Bit 3 : surfbit0


SWL textures have a choice of 15 surface types (none, metal, concrete, glass, etc.).

But wait! How are we going to be able to set 15 different surface types with only 4 bits? Well, that's why I made a separate section for surfbit0 - surfbit3. You see these work in a slightly different manner than the surf flag bits. Instead of assigning one type of surface per bit, it's a combination of 0's and 1's in all these 4 bits that are used to set all the possible surface types.

Now by a happy coincidence, the number of possible combinations of 0's and 1's you can get with 4 bits is 16 (0 to 15) which is one more than what we need. But the surfbits are straddled across the boundary of 2 separate nibbles which makes them a bit tricky to set if you don't know the values.

Ok, enough with binary stuff already. Here's the lowdown on how to set your surfbits with the required value for each surface type. Please note that the trailing 6 digits of the Flags register are not displayed in these tables as they are not relevant to surface type so just assume them to be all 0's:


0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 0 (clear)
surfbit1: 0 (clear)
value = 0
value = 0
value = 0
0 None
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 0 (clear)
surfbit1: 1 (set)
value = 0
value = 0
value = 1
1 Metal
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 1 (set)
surfbit1: 0 (clear)
value = 0
value = 2
value = 0
2 Concrete
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 1 (set)
surfbit1: 1 (set)
value = 0
value = 2
value = 1
3 Flesh
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 0 (clear)
surfbit1: 0 (clear)
value = 4
value = 0
value = 0
4 Glass
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 0 (clear)
surfbit1: 1 (set)
value = 4
value = 0
value = 1
5 Monitor
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 1 (set)
surfbit1: 0 (clear)
value = 4
value = 2
value = 0
6 Vegetation
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 1 (set)
surfbit1: 1 (set)
value = 4
value = 2
value = 1
7 Duct
0 surfbit0: 0 (clear)
value = 0
0

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 0 (clear)
surfbit1: 1 (set)
value = 0
value = 0
value = 1
1 Stone
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 1 (set)
surfbit1: 0 (clear)
value = 0
value = 2
value = 0
2 Dirt
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 0 (clear)
surfbit2: 1 (set)
surfbit1: 1 (set)
value = 0
value = 2
value = 1
3 Grill
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 0 (clear)
surfbit1: 0 (clear)
value = 4
value = 0
value = 0
4 Fabric
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 0 (clear)
surfbit1: 1 (set)
value = 4
value = 0
value = 1
5 Gravel
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 1 (set)
surfbit1: 0 (clear)
value = 4
value = 2
value = 0
6 Paper
0 surfbit0: 1 (set)
value = 8
8

0 This part is reserved (do not use) 0 Surface type
x x
0 surfbit3: 1 (set)
surfbit2: 1 (set)
surfbit1: 1 (set)
value = 4
value = 2
value = 1
7 Water
0 surfbit0: 1 (set)
value = 8
8


So now you know what value to assign to the Flags register according to what surface type you want to assign to your texture. But what if you also want to set surf flags? How do you figure out what final value to assign to the Flags register to include everything?

Simple. You just add the value you calculated for the surf flags (in Part I of this tutorial) to the one you looked up in the tables above to set the right surface type. The total is the final Flags register value to set in Sinview before you hit the Save SWL button. Just don't forget that the register is in hexadecimal and that values of 10 to 15 are A to F.

In the third and last part of this tutorial, we will look at how to set the Contents register in Sinview to give the content properties you want for your textures.


Part I

Part III