flowtsohg / mdx-m3-viewer

A WebGL viewer for MDX and M3 files used by the games Warcraft 3 and Starcraft 2 respectively.
MIT License
132 stars 47 forks source link

m3 models #57

Closed Ralle closed 3 years ago

Ralle commented 3 years ago

Hey Chananya,

I am unable to render m3 models. I am adding all these loaders:

viewer.addHandler(handlers.mdx);
viewer.addHandler(handlers.dds);
viewer.addHandler(handlers.blp);
viewer.addHandler(handlers.tga);
viewer.addHandler(handlers.m3);

and my code works fine for WC3 models. Last we talked you said it wasn't updated for SC2 yet. Any progress?

flowtsohg commented 3 years ago

I was so lazy I just got Baneling.m3 from the CDN and tested against it when I fixed M3. It does work, albeit I can't see if the textures are working correctly. Can you setup a thing that I can check that doesn't work? or actually make SC2 resources accessible again via the API? :P

Ralle commented 3 years ago

I am testing with a secret upcoming version of the site. I wouldn't mind showing you, but I am afraid of the other lurkers on this github :). I got an error when I sent you an email. Is that one still valid?

flowtsohg commented 3 years ago

I got the police officer link if that's what you mean

flowtsohg commented 3 years ago

I got also the Baneling textures from the CDN, and it seems to work fine. What doesn't work?

Ralle commented 3 years ago

Sorry for being a bit slow. I will reply when I look further into it :).

Ralle commented 3 years ago

Can you try the HIVE beta and go to Off Topic - Gamers Hub -> Starcraft -> Resources. In there you will find models that don’t seem to work.

I think I figured out it’s because of zoom. The are very far away and I’m not sure I can control it.

On Tue, Dec 22, 2020, at 19:45, Chananya Freiman wrote:

I got also the Baneling textures from the CDN, and it seems to work fine. What doesn't work?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/flowtsohg/mdx-m3-viewer/issues/57#issuecomment-749713924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSC3ISQKBLKBAICQN2FBTSWDSNZANCNFSM4U6HFKIA.

flowtsohg commented 3 years ago

The resources page gets a 500 error.

You are correct that scale is the most common reason to think M3 isn't working though, I forgot to mention it. I suggest to scale SC2 models by 100, which was the estimation I made years ago by comparing the Zergling models of both games. E.g. with model instanceof handlers.m3.resource. You can also look for .m3 in model.fetchUrl, but this isn't recommended because there is no assurance fetchUrl exists, or has the full file name (but you as the client control this, so you know the best).

E.g.

let instance = model.addInstance();

if (model instanceof handlers.m3.resource) {
  instance.uniformScale(100);
}
Ralle commented 3 years ago

That did it!