@denisT.MaxDoctor написал (-а):
I get the impression that you didn't read my explanation carefully.
I'm pretty sure that the scene you're looking at was made (bitmap texture assignment) by some script. And it's the user's prerogative to set the AlphaSource state. But the system, even if the user hasn't set the state, should be able to render the materials somehow. In this case, it makes its own decision. This is reflected in the user interface.
So if you see 0 in the dotnet method, it means that the state is not yet defined, but in case of empty filename it will be "None (Opaque)"!
That's what your and Serejah's tests confirm.
Also, I'm pretty sure that if the state is undefined and the texture file has a valid file, but the texture file doesn't support or doesn't have an alpha channel, the system will also pick the "None (opaque)" state.
If the texture file has an alpha channel, there are only two options - "Image Alpha" or "None (Opaque)"... what the system will choose in this case you can check yourself and tell us the result.
It seems to me that you did not carefully read all my messages. But maybe it's because of the difficulties of translation (I don't speak English very well). Although it looks like @Serejah got the gist of the problem. The problem is that maxscript incorrectly takes the values from the "alphaSource" property in Bitmaps even when the user has previously specified this value. And this applies not only to the scene that I indicated as an example. This applies to all scenes that I personally created earlier and in which I personally set the desired values in the "alphaSource" property in the Bitmaps when they were created in the material editor.
Everything you wrote is correct. But only for those cases when a new map is created. When creating a Bitmap in the Material Editor and loading a 3ds max texture image into it, it first determines whether this image has an alpha channel, and if it does, then sets the "Image Alpha" value in the "Alpha Source" property, if the image does not have alpha channel, then 3ds max sets this value to "None (Opaque)". The user (i.e. me) then changes this value to what I think is the correct one to use in that particular location.
I will try again to explain the situation in more detail...
Let's say I have a finished scene that uses materials with Bitmap texturemaps in a diffuse slot.
I created each of these maps manually in the material editor, without using maxscript and regardless of whether the image in these maps has an alpha channel, I always specified "None (Opaque)" for the "Alpha Source" property (for a diffuse slot, I it is not necessary). When creating these maps and loading texture files into them, 3ds max first set the "Alpha Source" value itself, depending on whether this image has an alpha channel or not. In some maps, the "Alpha Source" value was set to "Image Alpha" because an alpha channel was found in the loaded texture, but I immediately toggled "None (Opaque)".
Next, I open this scene in 3ds max and want to check if I missed something and if all my maps are set up correctly. To do this, I run the code above. As a result, I see that for Bitmap maps, in which I myself set the necessary values for the "alphaSource" property, maxscript took the values not the ones that I set, but those that 3ds max usually sets when creating a map in the default material editor, depending on whether the image has an alpha channel or not, while ignoring the values that I specified in the material editor earlier.
The problem is that maxscript (.net too) ignores the values that I manually set in the material editor for each Bitmap, and takes the ones that 3ds Max automatically sets when loading the image into the map.
I hope I was able to explain and you will understand the problem correctly.