Material problems and requests

I made a post yesterday in Problems That Don’t Need Their Own Thread about the material property “$nodecal” not being able to be set or get. There is another problem I have noticed about IMaterial:GetColor which takes an x, y coordinate pair and only works for materials constructed with a PNG file. This is a problem because of properties such as “$phongfix” and “$forcedcolor” which are colors and the incorrect way of getting them is to use IMaterial:GetVector. Likewise, they can be set using IMaterial:SetVector (Which takes a normalized vector) which works.

As for the request part, I’d like to request that we get IMaterial:GetColor(string) and IMaterial:SetColor(string, color) and I’d also like the “$nodecal” problem solved if possible.

All colors in vmts are defined as vectors, not actual colors, you’d retrieve them with GetVector.

GetColor is only for getting a colorf of a pixel of the texture made from a .png, it is nothing to do with the MATERIAL, the .vmt. That is why there’s no SetColor, and there will not be.

All of this is documented on the wiki. GetVector is the correct way. SetVector does not take a normalized vector, it takes any vector.

What if the VMT property accepts only normalized vectors? (ie. properties that concern colors)
In VMTs color-accepting properties can be expressed as ‘{255 128 255}’ -or- ‘[1 .5 1]’

In TDM cars skins, some of them have this:

"$phongfresnelranges" "[1 1 1]"
"$phongfix" "{254 113 0}"
"$forcedcolor" "{100 0 100}"

I assume that “$phonefresnelranges” is a vector and that “$phongfix” and “$forcedcolor” are colors (Not vectors).

on VDK {}s are never referenced, so it is an undocumented feature of sorts, regardless of whether you can use them or not though, you should use s.

GetVector seems to get the values correctly from both.

Any idea about the “$nodecal” problem I’m having?

No. I know of a bug with the Get functions where if the value in .vmt is not defined in quote marks

$model 1

It will not be picked up by Get functions, which is weird.

The “$nodecal” in question is in quotes and so is it’s value so perhaps its a separate issue?

As I said, I do not know what is wrong.

Maybe make sure all other stuff is in quote marks too?

Well I can IMaterial:Get/Set on other things in the VMT and it works as it should and also the VMT’s arent mine.