[Solved] Texture issue

How to create models in XSI and other 3D applications and make them work in Battlefront 1 & 2. Post models, tips for application usage and share anything XSI, 3DMax, SketchUp, etc.

Moderator: Moderators

Post Reply
kiprobin
First Lance Corporal
First Lance Corporal
Posts: 120
Joined: Wed Dec 11, 2019 3:52 pm
Projects :: Trench War
Games I'm Playing :: Swbf2
xbox live or psn: No gamertag set

[Solved] Texture issue

Post by kiprobin »

So I've been trying to make the fallen statue in Jedha, and I did it using an rescaled, edited version of the statue from the coruscant assets. In XSI, the textures look fine:

https://drive.google.com/file/d/1UW7BIz ... sp=sharing

Yet in ZE and in game the textures look like this:

https://drive.google.com/file/d/1Zi3g9t ... sp=sharing

The sword and the statue use the exact same tga files, so why they work properly for the sword but darken in ZE for the statue I have no idea. I removed all phongs and materials from the whole statue in xsi, then re-did the textures, but no change. Any ideas about what's causing the discrepancy between the xsi textures and the ZE and in game textures?
Last edited by kiprobin on Sat Dec 26, 2020 6:56 pm, edited 2 times in total.
Sporadia
Corporal
Corporal
Posts: 151
Joined: Thu Jan 24, 2019 11:02 pm
Projects :: No Mod project currently
Games I'm Playing :: None
xbox live or psn: No gamertag set

Re: Texture issue

Post by Sporadia »

I have some guesses but I haven't tried these. Also this is assuming that you know how to hex edit.

A note on hierarchy in the msh file:
Hidden/Spoiler:
Each msh file contains a MATL chunk which assign all the model's textures. That MATL chunk will contain every MATD chunk (one for each material, including materials you don't see), and each MATD chunk contains a NAME, a DATA and an ATRB. Some MATD chunks load texture files so they also contain a TX0D.

Simplified:
HEDR
- MSH2
- - MATL
- - - MATD
- - - - NAME
- - - - DATA
- - - - ATRB
- - - - TX0D

Also note that every chunk in a msh file will start with a longint saying how long that chunk is. If you add data to a chunk then you need to update the size of the chunk. You will also have to update the size of every parent chunk (eg if you change the size of a NAME, then you will have to update the longint at the start of the NAME, MATD, MATL, MSH2 and HEDR, because the parent chunks have changed size too).
There's a better doc for that stuff on the sticky: http://schlechtwetterfront.github.io/ze ... s/msh.html.

First, open your exported model's msh in a hex editor, find the MATD containing the rock's texture (ie find the MATD which contains a TX0D with the right .tga). There will be an ATRB section inside that MATD, set the hex for the ATRB to 04 00 00 00 00 00 00 00 if it's not already (ie ATRB, longint 4, longint 0). The ATRB is a render setting so it might have something to do with this.

Next thing to try is checking for differences between the entire MATL section of the sword, and the MATL section of your dark models. I don't think materials used for things like collision primitives matter, but if a MATD has a texture (ie a TX0D) then check that MATD to make sure it has the same ATRB and DATA chunks to what the sword msh uses.

A note on msh materials:
Hidden/Spoiler:
Every material is defined as a MATD (in the MATL) at the start if the msh file. Things like bones, roots, collision primitives, the dummy root etc are all MODL chunks. If a MODL chunk is using a material (ie if that MODL chunk has a texture), then the MODL will contain a MATI section. The MATI chunk (in the MODL) points to a MATD chunk (in a MATL). And it does this based on the order that the MATD's appear in so MATI 0 points to the first MATD in the list, MATI 1 points to the second MATD and so on. The MATI, like every chunk, starts with a longint saying how big the MATI is (and it's always 4 bytes). So MATI 0 actaully looks like MATI, longint 4, longint 0 (or MATI, 04 00 00 00 00 00 00 00). And MATI 1 looks like MATI, longint 4, longint 1 (or MATI, 04 00 00 00 01 00 00 00). You can use this to check what MODL chunks use what materials, because some materials are used for weird things that I think you don't even see.

If the issue isn't in the MATL, then I guess it's something to do with how the shadows are set up? Maybe? I can't really help you there.
kiprobin
First Lance Corporal
First Lance Corporal
Posts: 120
Joined: Wed Dec 11, 2019 3:52 pm
Projects :: Trench War
Games I'm Playing :: Swbf2
xbox live or psn: No gamertag set

Re: Texture issue

Post by kiprobin »

I fixed it, though I'm not sure what precisely did it. I noticed when I had removed all phongs from both the working sword and the statue, the sword had the standard gray texture in the texture decal view mode, but the statue was darker for some reason. I don't know how to msh edit and wanted to try a few last ditch things before I devote such a large amount of time learning that just for a small problem, so I opened the statue in xsi and went to the polygon mesh section of it's drop down menu in explorer, you know where it has the things like "secondary shape modelling" and "animation" and stuff. I don't know what this section does - all I know is very basic modelling. So I went to the "world edges op" and "clusters" sections and deleted absolutely everything indiscriminately. When I removed the phongs, it was the standard gray instead of the darkish blue it was before. Hopeful, I reapplied the phongs, exported, and now it displays correct textures in ZE and in game. Not sure what did it, but it had something to do with deleting a lot of stuff in the "polygon mesh" dropdown menu of my object in XSI
Post Reply