r1sc / Open76

Interstate '76 engine reimplementation
GNU General Public License v3.0
55 stars 3 forks source link

Transparancy issue (in car rear view mirror) #4

Closed r1sc closed 4 years ago

r1sc commented 7 years ago

Figure out how to parse the rear view mirror texture that's visible in the first person view. Currently that texture is not transparent at the edges.

JJJohan commented 6 years ago

I tried to take a look at this one. Simply treating palette index 1 as transparent technically works but it seems like a dodgy workaround.

I went through a few different game levels (a01, t01 and m01) and queried all texture files where palette index 1 occurred - interestingly enough the mirror texture was the only texture file that uses it.

I also took a look at some of the 'unknown' bytes to see if any would point at a range of palettes that should be treated as transparent but couldn't find anything like that. Finally I also took a look at the TBL file (xlucency) but this appears to be for the terrain based on what I see when I parse the contents as a 256x256 image.

I suspect the reason the mirror has this unique palette index is to act as a mask for the 'reverse camera'. If that is the case though it would make more sense if they only masked out the inside of the mirror rather than the outside.

Considering I've not been able to find any textures other than the mirror that use palette index '1' I'd be tempted to just treat it as transparent, perhaps with a sanity check that logs an error if any other texture uses this palette index to revisit the issue. It seems all cars use the same mirror texture for their first-person view anyway (which should make it easier to later implement the reverse camera with a render texture).

Thoughts 🤔 ?

r1sc commented 6 years ago

I think this is a good approach, considering the amount of research you have done. Treat it as transparent, but warn if any other texture uses palette index 1.

Off topic; that you've done this is awesome! It was a lonely road for a long time, glad to have another talented programmer onboard! :D Now to be fair I haven't looked at this codebase for a while, but if you'd like to contribute, surely interest will strike again!

JJJohan commented 6 years ago

Better yet, let's go one step further.. mirror

Slightly unrelated but I've set up a page to start mapping out the MSN action list. https://github.com/JJJohan/Open76/wiki/Mission-Action-Table-Overview