Mugen87 / three-m2loader

three.js loader for importing M2 assets from World of Warcraft.
MIT License
25 stars 8 forks source link

Better support for early game assets. #8

Closed sudolink closed 1 year ago

sudolink commented 1 year ago

Hey I basically used the code in your ./test dir to test how it loads vanilla .m2 files.

I get this RangeError: Offset is outside the bounds of the DataView at DataView.getUint32 (<anonymous>) at BinaryParser.readUInt32 (M2Loader.js:1875:25) at M2Loader._readTrack (M2Loader.js:1176:25) at M2Loader._readBoneDefinition (M2Loader.js:802:27) at M2Loader._readBoneDefinitions (M2Loader.js:828:22) at M2Loader.parse (M2Loader.js:150:32) at Object.onLoad (M2Loader.js:66:10) at three.module.js:39951:38

Any ideas?

Mugen87 commented 1 year ago

That's an interesting asset since it's from the WoW Classic era. I have not tested the loader so far with assets from that release.

Anyway, the loader has issues with parsing bone related animations. When commenting out that part of the parsing process, the error goes away. I'll try to figure out what's going wrong.

BTW: When skipping the bones parsing, the loader still complains about a missing texture. It seems dwarfmale.blp is missing in your archive.

sudolink commented 1 year ago

Those aren't classic assets (from the recent rerelease from Blizzard) these are files from the original unchanged client. I'm really new to .m2 files and don't know much about how they work. I commented out the bone.rotation, translation, and scale portions of the parser, like you mentioned. I renamed one of the blp's to what the loader defaulted to, .blp, and then it failed to load it the texture (not a 404). Maybe the vanilla files are structured so differently. I'll try with blizzard's classic client files and report back.

Mugen87 commented 1 year ago

I've added a commit so the track parsing is now skipped for this asset, see a4f50c898220e0423aaf4a04e3e3b01a8a276f31.

Since skeletal animation is not yet supported, you do not really lose something.

Mugen87 commented 1 year ago

I've renamed DwarfMaleSkin00_00.blp to dwarfmale.blp and tested again. The internal BLPLoader can't handle the pixel format of the texture yet. It is PIXEL_UNSPECIFIED (see https://wowdev.wiki/BLP).

I'm not sure what means UNSPECIFIED.

Mugen87 commented 1 year ago

We also need to solve #3 so the asset can be loaded.

Those aren't classic assets (from the recent rerelease from Blizzard) these are files from the original unchanged client.

Since the version number is 256, you usually refer as Classic to such assets (see https://wowdev.wiki/M2#Versions).

sudolink commented 1 year ago

here are the assets from the updated classic client., tried to load the Burning Crusade Classic (Wotlk classic uses the same ones i think) models too, and I can't load these either, even after hardcoding the .blp filename on line 485 to try and force the load. Haven't tried retail yet downloading the client right now.

Since the version number is 256, you usually refer as Classic to such assets (see https://wowdev.wiki/M2#Versions).

did not know that!

Mugen87 commented 1 year ago

With 89f443dbc26f6a5d86e15d5a14f9d1568f45ac2d and f3f1000b40a08aafbec8176679c7420a0a8040cd, I'm now able to load the asset. However, it seems the dwarf asset only represents some sort of base model. So it does not look like a real character from the game yet.