I just downloaded the master from Github (perhaps I should have posted the issue there?). I am importing/exporting a custom model that was extracted from WoW. I don't remember where I took it (I didn't extract it myself) but if you need it for testing I could send it to you.
Have you tried if the original model has the same issues?
If not, have a look at the console window (Can be opened on Windows via the window menu I think). Maybe there was an issue at import time which aborted the import process. If in doubt make a screenshot of the console window and attach it to your next post.
I think we can safely ignore all the warnings regarding the Textures; or do I have to make sure that the textures are there when I import a model, even if I only want to change the name of an attachment point?
The problem is not present in the “original” model. The reason why I needed to import it, is because I wanted an “overhead” attachment point to be available. That's pretty much it.
Thank you a lot for your work and your support, by the way!
The model contains an invalid tight hit test. Blizzard added a detection for models with invalid hit tests. I adjsuted the m3addon to also detect and ignore invalid hit tests. While it might work now, it is highly recommended to add fuzzy and hight hit tests. It's good for the performance.
That's awesome, thank you for the explaination. It didn't work like that though, I still had to add hit test. But that was definitely learning something new. Now I can fix some selection issues that I was having with other models as well.
If I may abuse your patience, I would like to ask another question. It is about adding team color to models: I seem to recall to have read in one of your post that this can be done by setting the material color channel (perhaps for the diffuse?) to RGBa, and then painting on the alpha channel of the texture to reveal the team color. What am I getting wrong? I can't seem to make it work.
What you describe sounds correct (if you picked RGBA and not RGB). Did you actually import you texture into SC2 via the importer module of the Starcraft 2 Editor? Also did you restart the editor after reimporting a texture? The SC2 editor had or still has a bug that it does not update textures properly after you reimported them.
Also if you need an example for an material which uses team colors: Import a simple Starcraft 2 model like the marine and have a look how Blizzard did it.
What you describe sounds correct (if you picked RGBA and not RGB). Did you actually import you texture into SC2 via the importer module of the Starcraft 2 Editor? Also did you restart the editor after reimporting a texture? The SC2 editor had or still has a bug that it does not update textures properly after you reimported them.
Also if you need an example for an material which uses team colors: Import a simple Starcraft 2 model like the marine and have a look how Blizzard did it.
Mmm, I tried to look at how the Marine is done. Of course, to a 3D modelling noob like me, there are so many fields I might be missing something, but it looks like it's very similar to what I am doing.
I set the diffuse material color channel to RGBa
I set the Alpha Mask to Alpha Only.
I set the Alpha Mask 2 to RGBa (though my model doesn't have any material there, so I guess this is pointless).
I paint the parts I want team colored on the texture black in the alpha channel.
That's it. What I get is simply: the painted parts of the textures disappear.
The only difference that I am being aware of is that I am working with .tga files, while most of those textures are .dds. Do you think this might be the problem? (I can't really test, because I am on a Mac and I can't seem to find something to convert files to .dds). Another difference was Tint Strength: 4 on the Marine; setting it to the same number just turned my model black, actually.
What you describe sounds like you configured a texture in the alpha mask. The alpha mask is for making thinks transparent. In your case you should leave the image path in the alpha mask layers empty. The diffuse layer alone will give you the wanted team color if you set it to RGBA.
To exclude that it is an issue with your texture you could reference an existing starcraft 2 texture in your model. e.g. the one from the marine for a test.
Hi, I have a problem that might or might not be a m3addon issue.
I needed to modify the "SpacePrisoner_00.m3" model to have a right hand attachment. It took me the whole day (including the time until I found this tutorial) but in the end I managed to modify the model (I failed to add an attachment point, but I modified the "overhead" one I don't need). The trouble is, I can't seem to be able to use the model with the Prisoner unit, the editor gives me "Unable to create this model" (yes, even after restarting the editor).
The odd thing is, the model works for some units - I've tried "shape - banana" and barracks and both worked, Zealot on the other hand didn't. Maybe the issue is in actor events, but then, the new model should be almost identical to the original, right?
I've also tried importing the model into blender and exporting it right away without changing anything and I ran into the same issue. When I tried exporting the model from the editor and importing it without it ever touching Blender, it worked.
There is a "M3 Attachment Points" panel in the Scene tab of the Properties Editor. It includes a + button for adding new attachment points.
I think there is a naming convetion or requitement in SC2. I think "Weapon Right" would be the correct name for your attachment point.
I tried to reproduce the bug, but it worked for me. I tried the following:
I exported the SpacePrisoner_00.m3
I imported it via my m3addon
I exported it via my m3addon
I imported the reexported model in the Starcraft 2 Editor under the import path Model.m3
I Changed in the Models tab of the Data Module the model path of the Zealot to Model.m3
I placed some zealots on the map
I started the map
Walking and standing worked, when I attacked modified Zealots with modified Zealots there were some warnings about a missing shield attachment point. But otherwise it worked :)
Aha! Problem solved. I've tried it again and it indeed worked on the zealot, but still failed for the actual prisoner. Don't know why it was throwing errors for the zealot yesterday (maybe I messed something up, I've been trying to resolve this issue whole day) but I realized the Prisoner (large) unit has a couple of variations. Removing them from the model in the data editor fixes it.
I'll see if that is the case with a unit with modified attachments. Incidentally, I did find the way to create new attachment point but failed at attaching this new point to a bone of the model. I'm not using the "Overhead" attachment point for anything, and I was able to move it and lock it together with right fist, so that should work fine.
Thank you very much for your help! If you want to check out what I'm working on, search for "Escape from Death Row" on battle.net. There's only the intro cinematic so far, but cinematics are what I'm known for...
Edit: The edited model works in the editor as well... except that the attachment point kinda floats around the unit depending on current animation =(
I think I'll figure it out eventually though. Once again thanks for your help.
Edit 2: Figured out how to attach a new attachment point to a bone, it should be working properly, but the weapon is still flying in space, albeit much less chaotically. I believe it's the attachment point of the custom model I'm trying to attach, so I'll hopefully be able to fix that as well. I'll focus on other things for now (and to think I started to mess around with the modeling because I was tired of building inventory screen!)
first of all i have to say: GREAT importer! But i have a question, maybe a stupid one. I understand, the importer imports m3 files to Blender. That works like charm, but i want render the textures in blender, too. In your menu -> m3 materials layers -> diffuse shows a texture path within the mpq file. i cant manage to change this to a local stored dds file with the result of a model with a texture within blender. im quite new at blender and there is a huge possibility im blind or something. what is the correct way to add the texture? i can only see the teamcolor.
If u want to answer in german, u can :) im german, too. you can write a pm aswell, if u want :)
Btw im an it-geek/worker , so pointing to a direction will help me and im looking for further guides.
The materials you can configure via "M3 Material *" panels specify only how the material will look in Starcraft 2. Those m3 materials have nothing to do with Blender materials, which define how stuff looks in Blender. When you import a model, or when you click the button "Generate Blender Materials" in the M3 Import panel then the addon will try to create Blender materials based on the configured M3 materials.
M3 files don't contain any textures, but reference them by name. So when you click the button for generating blender materials it will search relative to the configured root directory ( In m3 import pane) for the textures. You can see at the console the exact path where it is looking at. You can open the console via the windows menu in Blender (but be aware, closing it closes blender).
You may also want to have a look at my m3addon FAQ.
If you want to render things, you may also want to google for "Blender Cycles Tutorial", Cycles is the new render engine in Blender, which uses new types of Blender materials.
I've been trying to export models of terran console panels with poorly results :(
Assets\UI\Console\Terran\ConsoleTerran\ConsoleTerran_02.m3 (command card panel)
Does export, but incorrectly - command card frame resize horizontally and overlap with portrait.
Assets\UI\Console\Terran\ConsoleTerran\ConsoleTerran_00.m3 (minimap panel)
Doesn't import at all. Error i get:
ImportConsoleTerran_00.m3Traceback(mostrecentcalllast):File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\__init__.py",line4401,inexecutem3import.importM3BasedOnM3ImportOptions(scene)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3import.py",line1857,inimportM3BasedOnM3ImportOptionsimporter.importM3BasedOnM3ImportOptions(scene)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3import.py",line398,inimportM3BasedOnM3ImportOptionsself.model=m3.loadModel(fileName)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line1176,inloadModelsections=loadSections(filename,checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line1119,inloadSectionssection.determineContentField(checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line45,indetermineContentFieldself.content=self.structureDescription.createInstances(buffer=self.rawBytes,count=indexEntry.repetitions,checkExpectedValue=checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line170,increateInstanceslist.append(self.createInstance(buffer=buffer,offset=instanceOffset,checkExpectedValue=checkExpectedValue));File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line150,increateInstancereturnM3Structure(self,buffer,offset,checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line236,in__init__self.readFromBuffer(buffer,offset,checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line254,inreadFromBufferfield.readFromBuffer(self,buffer,fieldOffset,checkExpectedValue)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line553,inreadFromBufferraiseException("Expected that field %s of %s (V. %d) has always the value %s, but it was %s"%(self.name,structureName,structureVersion,self.expectedValue,value))Exception:Expectedthatfieldunknown4ofEVNT(V.1)hasalwaysthevalue0,butitwas20
I've tried to comment part of the code that checks for expected value, but of course it didn't help. I got this:
ImportConsoleTerran_00.m3WARNING:CHARV0(20repetitions)got0timesreferenced->Foundareferenceatoffset88inasectionoftypeEVNTV1OffsetsofEVNTinversion1:0:name12:unknown016:unknown118:unknown220:matrix84:unknown388:unknown492:unknown596:unknown6100:unknown7WARNING:CHARV0(21repetitions)got0timesreferenced->Foundareferenceatoffset88inasectionoftypeEVNTV1OffsetsofEVNTinversion1:0:name12:unknown016:unknown118:unknown220:matrix84:unknown388:unknown492:unknown596:unknown6100:unknown7WARNING:CHARV0(21repetitions)got0timesreferenced->Foundareferenceatoffset88inasectionoftypeEVNTV1OffsetsofEVNTinversion1:0:name12:unknown016:unknown118:unknown220:matrix84:unknown388:unknown492:unknown596:unknown6100:unknown7Traceback(mostrecentcalllast):File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\__init__.py",line4401,inexecutem3import.importM3BasedOnM3ImportOptions(scene)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3import.py",line1857,inimportM3BasedOnM3ImportOptionsimporter.importM3BasedOnM3ImportOptions(scene)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3import.py",line398,inimportM3BasedOnM3ImportOptionsself.model=m3.loadModel(fileName)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line1178,inloadModelcheckThatAllSectionsGotReferenced(sections)File"C:\Users\KK\AppData\Roaming\Blender Foundation\Blender\2.69\scripts\addons\m3addon\m3.py",line1173,incheckThatAllSectionsGotReferencedraiseException("Unable to load all data: There were %d unreferenced sections. View log for details"%numberOfUnreferencedSections)Exception:Unabletoloadalldata:Therewere3unreferencedsections.Viewlogfordetails
Any chance for fix?
I've attached the models to this post so you dont have to dig for them.
I fixed the issue with the import of ConsoleTerran_00.m3. The issue with ConsoleTerran_02 is actually an import issue as you can see the same issue in Blender. It might be based on a common scale import issue which can't be fixed easily.
Maybe this has been covered in here somewhere but.....
I have a problem with imported models in blender and assigning textures to them.
As near as I can figure: I import a model, and on the mesh (lets assume for argument sake there's just 1) I can assign textures in the materials tab and then navigate to textures. -> Then I choose "Image or video" and use the 'browse' function to find the diffuse, emissive etc etc.
These are then applied to the model (you can see them in the previewer)
BUT!!!! -> then I want to export the model again with textures and all, but when I import that new model in SC2 edit.... nothing.
I still end up getting a flashy-white polygon... and no textures of any kind.
I discovered when I imported my new model back into blender that the textures I assigned were gone (hence why they didn't show in SC2 edit)
-> Why haven't they been saved along with the model? and how do I fix this?
@println: Go
I just downloaded the master from Github (perhaps I should have posted the issue there?). I am importing/exporting a custom model that was extracted from WoW. I don't remember where I took it (I didn't extract it myself) but if you need it for testing I could send it to you.
@sunyatasattva: Go
Have you tried if the original model has the same issues?
If not, have a look at the console window (Can be opened on Windows via the window menu I think). Maybe there was an issue at import time which aborted the import process. If in doubt make a screenshot of the console window and attach it to your next post.
@println: Go
I'm on a Mac. Indeed it outputs some warnings and errors, here is the output:
I think we can safely ignore all the warnings regarding the Textures; or do I have to make sure that the textures are there when I import a model, even if I only want to change the name of an attachment point?
The problem is not present in the “original” model. The reason why I needed to import it, is because I wanted an “overhead” attachment point to be available. That's pretty much it.
Thank you a lot for your work and your support, by the way!
@sunyatasattva: Go
The model contains an invalid tight hit test. Blizzard added a detection for models with invalid hit tests. I adjsuted the m3addon to also detect and ignore invalid hit tests. While it might work now, it is highly recommended to add fuzzy and hight hit tests. It's good for the performance.
In the last part of my tutorial I explain how to create tight and fuzzy hit tests.
Basicly the tight hit tests defines where a model can be box selected. The fuzzy hit test defines where the unit can be selected by clicking.
@println: Go
That's awesome, thank you for the explaination. It didn't work like that though, I still had to add hit test. But that was definitely learning something new. Now I can fix some selection issues that I was having with other models as well.
If I may abuse your patience, I would like to ask another question. It is about adding team color to models: I seem to recall to have read in one of your post that this can be done by setting the material color channel (perhaps for the diffuse?) to RGBa, and then painting on the alpha channel of the texture to reveal the team color. What am I getting wrong? I can't seem to make it work.
@sunyatasattva: Go
What you describe sounds correct (if you picked RGBA and not RGB). Did you actually import you texture into SC2 via the importer module of the Starcraft 2 Editor? Also did you restart the editor after reimporting a texture? The SC2 editor had or still has a bug that it does not update textures properly after you reimported them.
Also if you need an example for an material which uses team colors: Import a simple Starcraft 2 model like the marine and have a look how Blizzard did it.
@sunyatasattva: Go
What you describe sounds correct (if you picked RGBA and not RGB). Did you actually import you texture into SC2 via the importer module of the Starcraft 2 Editor? Also did you restart the editor after reimporting a texture? The SC2 editor had or still has a bug that it does not update textures properly after you reimported them.
Also if you need an example for an material which uses team colors: Import a simple Starcraft 2 model like the marine and have a look how Blizzard did it.
double post due to delay...
@println: Go
Mmm, I tried to look at how the Marine is done. Of course, to a 3D modelling noob like me, there are so many fields I might be missing something, but it looks like it's very similar to what I am doing.
That's it. What I get is simply: the painted parts of the textures disappear.
The only difference that I am being aware of is that I am working with .tga files, while most of those textures are .dds. Do you think this might be the problem? (I can't really test, because I am on a Mac and I can't seem to find something to convert files to .dds). Another difference was Tint Strength: 4 on the Marine; setting it to the same number just turned my model black, actually.
Any pointers? I seem to be stuck.
@sunyatasattva: Go
What you describe sounds like you configured a texture in the alpha mask. The alpha mask is for making thinks transparent. In your case you should leave the image path in the alpha mask layers empty. The diffuse layer alone will give you the wanted team color if you set it to RGBA.
To exclude that it is an issue with your texture you could reference an existing starcraft 2 texture in your model. e.g. the one from the marine for a test.
Hi, I have a problem that might or might not be a m3addon issue.
I needed to modify the "SpacePrisoner_00.m3" model to have a right hand attachment. It took me the whole day (including the time until I found this tutorial) but in the end I managed to modify the model (I failed to add an attachment point, but I modified the "overhead" one I don't need). The trouble is, I can't seem to be able to use the model with the Prisoner unit, the editor gives me "Unable to create this model" (yes, even after restarting the editor).
The odd thing is, the model works for some units - I've tried "shape - banana" and barracks and both worked, Zealot on the other hand didn't. Maybe the issue is in actor events, but then, the new model should be almost identical to the original, right?
I've also tried importing the model into blender and exporting it right away without changing anything and I ran into the same issue. When I tried exporting the model from the editor and importing it without it ever touching Blender, it worked.
Any kind of help would be appreciated.
@KKlear: Go
There is a "M3 Attachment Points" panel in the Scene tab of the Properties Editor. It includes a + button for adding new attachment points. I think there is a naming convetion or requitement in SC2. I think "Weapon Right" would be the correct name for your attachment point.
I tried to reproduce the bug, but it worked for me. I tried the following:
@println: Go
Aha! Problem solved. I've tried it again and it indeed worked on the zealot, but still failed for the actual prisoner. Don't know why it was throwing errors for the zealot yesterday (maybe I messed something up, I've been trying to resolve this issue whole day) but I realized the Prisoner (large) unit has a couple of variations. Removing them from the model in the data editor fixes it.
I'll see if that is the case with a unit with modified attachments. Incidentally, I did find the way to create new attachment point but failed at attaching this new point to a bone of the model. I'm not using the "Overhead" attachment point for anything, and I was able to move it and lock it together with right fist, so that should work fine.
Thank you very much for your help! If you want to check out what I'm working on, search for "Escape from Death Row" on battle.net. There's only the intro cinematic so far, but cinematics are what I'm known for...
Edit: The edited model works in the editor as well... except that the attachment point kinda floats around the unit depending on current animation =(
I think I'll figure it out eventually though. Once again thanks for your help.
Edit 2: Figured out how to attach a new attachment point to a bone, it should be working properly, but the weapon is still flying in space, albeit much less chaotically. I believe it's the attachment point of the custom model I'm trying to attach, so I'll hopefully be able to fix that as well. I'll focus on other things for now (and to think I started to mess around with the modeling because I was tired of building inventory screen!)
Hi println,
first of all i have to say: GREAT importer! But i have a question, maybe a stupid one. I understand, the importer imports m3 files to Blender. That works like charm, but i want render the textures in blender, too. In your menu -> m3 materials layers -> diffuse shows a texture path within the mpq file. i cant manage to change this to a local stored dds file with the result of a model with a texture within blender. im quite new at blender and there is a huge possibility im blind or something. what is the correct way to add the texture? i can only see the teamcolor.
If u want to answer in german, u can :) im german, too. you can write a pm aswell, if u want :)
Btw im an it-geek/worker , so pointing to a direction will help me and im looking for further guides.
Thank u very much.
Arno
@penticrack: Go
The materials you can configure via "M3 Material *" panels specify only how the material will look in Starcraft 2. Those m3 materials have nothing to do with Blender materials, which define how stuff looks in Blender. When you import a model, or when you click the button "Generate Blender Materials" in the M3 Import panel then the addon will try to create Blender materials based on the configured M3 materials.
M3 files don't contain any textures, but reference them by name. So when you click the button for generating blender materials it will search relative to the configured root directory ( In m3 import pane) for the textures. You can see at the console the exact path where it is looking at. You can open the console via the windows menu in Blender (but be aware, closing it closes blender).
You may also want to have a look at my m3addon FAQ.
If you want to render things, you may also want to google for "Blender Cycles Tutorial", Cycles is the new render engine in Blender, which uses new types of Blender materials.
WOW ...thank you very much! Pasting the right directory into the root dir field followd by "generate blender materials" does the trick!
\*facepalm* i tried a pasting the dir of textures or working dir, but only pressed generate at texture dir.
So again: thx !! and thx for the cycles hint, too!
I've been trying to export models of terran console panels with poorly results :(
Assets\UI\Console\Terran\ConsoleTerran\ConsoleTerran_02.m3 (command card panel) Does export, but incorrectly - command card frame resize horizontally and overlap with portrait.
Assets\UI\Console\Terran\ConsoleTerran\ConsoleTerran_00.m3 (minimap panel) Doesn't import at all. Error i get:
I've tried to comment part of the code that checks for expected value, but of course it didn't help. I got this:
Any chance for fix? I've attached the models to this post so you dont have to dig for them.
@SomeoneTookMyNameTT: Go
I fixed the issue with the import of ConsoleTerran_00.m3. The issue with ConsoleTerran_02 is actually an import issue as you can see the same issue in Blender. It might be based on a common scale import issue which can't be fixed easily.
Yeah, i meant "import" when i was saying "export" :)
Anyway i manually fixed ConsoleTerran_02 by editing bones. It fit my needs, cause i just wanted to cut off info panel.
Thanks.
Maybe this has been covered in here somewhere but.....
I have a problem with imported models in blender and assigning textures to them. As near as I can figure: I import a model, and on the mesh (lets assume for argument sake there's just 1) I can assign textures in the materials tab and then navigate to textures. -> Then I choose "Image or video" and use the 'browse' function to find the diffuse, emissive etc etc. These are then applied to the model (you can see them in the previewer) BUT!!!! -> then I want to export the model again with textures and all, but when I import that new model in SC2 edit.... nothing. I still end up getting a flashy-white polygon... and no textures of any kind.
I discovered when I imported my new model back into blender that the textures I assigned were gone (hence why they didn't show in SC2 edit) -> Why haven't they been saved along with the model? and how do I fix this?
Custom Campaign Initiative