STEAM GROUP
Blender Source Tools BleST
STEAM GROUP
Blender Source Tools BleST
229
IN-GAME
1,638
ONLINE
Founded
November 8, 2013
All Discussions > Bug Reports > Topic Details
Pte Jack Mar 10, 2021 @ 9:22pm
Not sure if this is a Blender or Add-on Bug. Same Material Names - Different models
I just noticed this in Blender 2.92:

If I import models that have the same Material names, but use different textures, new materials are not being created for the second model imported.

For example, if I import the Sniper, the head has materials named eyeball_l and eyeball_r,

If I import a scout model, the head also have materials named eyeball_l and eyeball_r

Blender is not creating new materials for the second model like eyeball_l.001 and eyeball_r.001

If I change the material for the eyeballs in anyway (name, textures, or whatever), Both models make the change.
Looking at the Data API, there are only 2 materials for the eyes, eyeball_l and eyeball_r.

Same applies if I import 2 of the same model. All Objects except materials get appended names (.001, .002 etc) however the material names all stay the same and are shared by the different models.

Sample of changing materials:
https://i.imgur.com/cMoHasK.gif

Blender Data API Materials:
https://i.imgur.com/0z8Zi6y.png

If this is a Blender bug, please advise and I'll raise a bug report there....

Thanks Boss!
< >
Showing 1-10 of 10 comments
Zappy Mar 11, 2021 @ 3:27am 
It's not a Blender Source Tools bug nor a Blender bug. That's completely intentional.

Think of it this way: If you import the Scout's body and then import the Scout's legs body-group, would you want the latter to use "scout_red.001" instead of "scout_red" when the body already uses that material?
No, chances are, you probably want to use the same material on both things. That's what StudioMDL does, too.

So how should it tell that two same-named eye materials should be different when two same-named body materials shouldn't?

Originally posted by Pte Jack:
- All Objects except materials get appended names (.001, .002 etc) -
You can't(/aren't supposed to) have two objects with the same name, and importing multiple meshes into the same object is bad too, so adding ".001" is necessary to avoid conflicts here.

But again, for materials, you probably/usually want to use the same material on both things, so it just doesn't make a new material like it makes new objects.
Last edited by Zappy; Mar 11, 2021 @ 3:28am
ZeqMacaw Mar 11, 2021 @ 5:26am 
This sounds like a new option should be added to the import options pane, similar to the "Bone Append Mode" option, but for materials.
Pte Jack Mar 11, 2021 @ 8:28am 
Originally posted by Zappy:
It's not a Blender Source Tools bug nor a Blender bug. That's completely intentional.

Think of it this way: If you import the Scout's body and then import the Scout's legs body-group, would you want the latter to use "scout_red.001" instead of "scout_red" when the body already uses that material?
No, chances are, you probably want to use the same material on both things. That's what StudioMDL does, too.

So how should it tell that two same-named eye materials should be different when two same-named body materials shouldn't?

Originally posted by Pte Jack:
- All Objects except materials get appended names (.001, .002 etc) -
You can't(/aren't supposed to) have two objects with the same name, and importing multiple meshes into the same object is bad too, so adding ".001" is necessary to avoid conflicts here.

But again, for materials, you probably/usually want to use the same material on both things, so it just doesn't make a new material like it makes new objects.


Sorry for re quoting Zappy, but, this does not make sense to me. especially in the case of the sniper/scout instance where the sniper (eyeball_l / eyeball_r) might be brown and the scout's blue. When I import both are going to be the same and it will be based on the first model imported when the material is created. AFAIC model materials should be as unique as the rest of the model to as you put it, avoid conflicts.

It's not often that I import multiple models into a scene and I just went back to see if this was happening in 2.xx and it is. In fact, duplicating objects doesn't create new materials either, so I guess it's just something I hadn't noticed before. So sorry for rabbit holing here, but if possible, would it be possible to add a switch as Zeq suggested to create new materials on import for materials that already exist?

Think of it this way, I want to create a city, and I want to 4 different houses (bungalow, Ranch, 2 story and apartment building) but they all have the same material names, (wall, window, roof and door) that have different textures. What skin are they going to wear on import?

What if I duplicated or imported 100, I'm going to have to "fix" the number of models that aren't going to wear the correct textures. Now what if I only wanted to change textures on 30 of them (broken windows, different roof colours, different siding styles, etc). (I guess that situation would be a 2 way street discussion, but I think I would favor having individual materials for individual models because If they import textured, the shader nodes are gong to be already established and the materials unique.)

Anyway, just my feelings on this and again, I apologize for rabbit holing a situation that didn't really exist.
Last edited by Pte Jack; Mar 11, 2021 @ 8:30am
Pte Jack Mar 11, 2021 @ 8:45am 
I just figured out how this was handled in the past.
When models were imported, the materials were imported with their path as part of the material name. This made them unique to a model type (like class) and it was before path names were over 100 characters long or 70 levels deep. The Valve engine relies on the path to separate same named materials.
Zeq gives us the option to strip paths from materials when decompiling and It is easier to work with the short name of a material rather than the 150 character long one. But this now causes the conflict between same named materials. We need something to make them unique and break that conflict.
Last edited by Pte Jack; Mar 11, 2021 @ 8:49am
Zappy Mar 11, 2021 @ 8:56am 
Originally posted by Pte Jack:
-When I import both are going to be the same and it will be based on the first model imported-
The generated materials won't be "based" on anything. The Blender Source Tools only imports material names, not material settings or textures (since only the name is stored in DMX/SMD files).

Originally posted by Pte Jack:
- AFAIC model materials should be as unique as the rest of the model -
I repeat my previous point:

In Team Fortress 2, the Scout's legs are a different body-group from the rest of his body, but use the same material. In this instance, would you want the legs to have a separate material from the body, with the name changed to fit? Not at all.

The Blender Source Tools can't know whether you're importing an extra part of an imported character (where it should use the same material), or importing a brand-new character (where it should make new materials).



ZeqMacaw suggests having a new import setting for what to do with "duplicate" materials, which is a fine solution. But if a toggleable option is not going to happen, I wouldn't want "make new materials with numbers at the end" to be the thing that happens instead.
Last edited by Zappy; Mar 11, 2021 @ 8:57am
Pte Jack Mar 11, 2021 @ 9:12am 
I would think it would be a heck of a lot easier to identify and rename or copy to make a new material with a name like
hw2013_volatile_voodoo_1_blue_color.001 (39Characters)
than models\workshop\player\items\all_class\hw2013_volatile_voodoo\hw2013_volatile_voodoo_1_blue_color (97 Characters)
as we did in the past.

It doesn't have to be .001, it just has to be something to make the material name unique, if one already exists. hw2013_volatile_voodoo_1_blue_color_dup would do it or hw2013_volatile_voodoo_1_blue_color_a
Last edited by Pte Jack; Mar 11, 2021 @ 9:19am
Pte Jack Mar 11, 2021 @ 9:51am 
This isn't a Blender or Add-on problem, it a user's preference problem and only exists on models that are decompiled (or brought in from other sources). But it could be handled on decompile as well.

Zeq, you already give us the option to add a prefix to mesh names (model Name), could you add an option to add either a prefix or suffix to materials if we strip the path? This would get us back to Class uniqueness again.
Pte Jack Mar 11, 2021 @ 10:34am 
Submitted a feature request to Zeq to add an option to add (something) to to a material name if we strip the path from a material name on decompile.
(The condition also exists in DMX imports from the sourcesdk_content Reference models so an option in BleST would be nice as well. Like a 4 character random _rdm1rdm2rdm3 (rdm=Random) extension if a material already exists. This would definitely make any dupe material imported unique while retaining original material names if they don't already exist and would be easy to find if created.)
Last edited by Pte Jack; Mar 11, 2021 @ 10:34am
Artfunkel Mar 23, 2021 @ 12:07pm 
The only part of a material that the tools care about is its name, so there is no possibility of messing with it on import.

If you really want to have multiple materials with the same name, have you tried importing your meshes into different .blend files and then linking them together into a central one? That will give each mesh its own "namespace".
Pte Jack Mar 23, 2021 @ 3:28pm 
Thanks Artifunkel. I was hoping there could be something done during import (if more than one model existed that used same material names.) I've also passed this as a feature request for Crowbar to Zeq to see if there is something he can do if we strip material paths on decompile.
< >
Showing 1-10 of 10 comments
Per page: 1530 50

All Discussions > Bug Reports > Topic Details