Notifications
Clear all

[Closed] Creating materials

I am having some trouble creating new materials. I have noticed that when I do this

mymat = meditMaterials[1]
 show mymat

I get a list of all the properties, and I can change them at will. But when I do this

mymat = standardMaterial
 show mymat

I get

No Info Found on: Standardmaterial
 OK

likewise, I cannot access or change any of these properties, or assign my new material to a material editor slot. Why is this?

5 Replies

try StandardMaterial()

Thanks. So without the () the constructor is not being called? What type of value is being stored, in that case?

Okay, another question. I have written this:

mymat = StandardMaterial()
  basefilename = "C:\blah	exture.png"
  mymap = Bitmaptexture filename:(basefilename) monoOutput = 1
  mymat.diffuse = mymap
  mymat.opacity = mymap
  
  meditMaterials[2] = mymat

So, I would expect the Materials editor to update to show my new material with the same map in the diffuse and opacity slots. However, when I look at slot 2, it is a default grey material called “Standardmaterial” with no maps in any slots. Why is this?

Edit – I added the map to the material as part of the constructor, like so:

mymat = StandardMaterial name:"Foo" diffuseMap:mymap opacityMap:mymap

and the maps are being assigned.

About your first question, check “When do I use () after a function?” in the maxscript reference.

As for the maps issue, the problem was that you were calling the wrong property (as you laterd discovered). In fact you can do:


mymat = StandardMaterial()
basefilename = "C:\blah	exture.png"
mymap = Bitmaptexture filename:(basefilename) monoOutput = 1
mymat.diffuseMap = mymap
mymat.opacityMap = mymap
  
meditMaterials[2] = mymat

I would look up the items you are trying to create in the maxscript help as it will give you more info than show.

StandardMaterial : Material[left]<Standard>.diffuse Color default: (color 149.94 149.94 149.94) – animatable, alias: Diffuse_Color
[/left]
[left]Controls the diffuse color. The diffuse color is the color in direct light.

StandardMaterial : Material[left]<Standard>.diffuseMap TextureMap default: undefined – alias for maps[1]
[/left]
[left]Get/Set the diffuse map.
You also need to make sure your match your inputs with what the parameter is expecting. .diffuse (Diffuse_Color) : RGB color requires a color value and won’t except a bitmap.

-Eric
[/left]

[/left]