scurest / apicula

Convert Nintendo DS .nsbmd models
BSD Zero Clause License
160 stars 19 forks source link

Wrong texture applied in the viewer or when converted #39

Open SameplayerDE opened 2 years ago

SameplayerDE commented 2 years ago

I dont know if this is by design or me not doing it correctly but it seems like palettes are not used when viewing the model in the viewer or when converted

scurest commented 2 years ago

I don't know what you mean. Please attach the file you're trying.

SameplayerDE commented 2 years ago

Im am trying a nsbmd extracted with apicula from pokemon platinum. In the txt file you can see the info output of all nsbxx files. The nsbmd I tried is called map01_08c.

There is a material that uses a texture, called ngrass. This material has a palette but in the viewer the palette is not applied to the texture. I am not sure if apicula applies palettes or not to the textures that use palettes.

log_all.txt

scurest commented 2 years ago

I mean the .nsbmd, and also the relevant .nsbtx.

SameplayerDE commented 2 years ago

Output.zip

scurest commented 2 years ago

It's using the wrong texture. Here's what happens.

The map01_08c.nsbmd file has a material with a texture named ngrass and a palette named grass. Since the .nsbmd file does not contain any textures, it looks for them in a separate .nsbtx file.

Both a9_criff.nsbtx and allpeak.001.nsbtx have textures named ngrass.

ngrass

apicula just picks the first one in its internal list, which happens to be the one from a9_criff.nsbtx (that's what it means when info says it "matched texture, but tentatively"; there were other candidates it could have used). But the correct texture looks like the one from allpeak.001.nsbtx.

So you can make it work by passing just the .nsbmd and the .nsbtx it should use (and nothing else).

apicula v map01_08c.nsbmd allpeak.001.nsbtx

I think apicula could figure out it should use allpeak.001.nsbtx on its own in this case though, since allpeak.001.nsbtx can supply textures for all materials in the .nsbmd, but a9_criff.nsbtx can't. I'll leave this issue open for a future enhancement.