From Valve Developer Community
Revision as of 20:21, 18 September 2011 by Shawnolson (talk | contribs) (Solid Color)
Jump to: navigation, search

Does $color apply to the whole material, or just the RGB of the $basetexture ?

Solid Color

The docs state:

This parameter can be used without an albedo to display a solid color without the need of a texture

But when I use a VMT like this:


	 "$color" "{165.0 150.0 218.0}"

The material is always just white. Is this limited to a certain shader?

The material is loading on the model... but it is simply white. Is there some special step for this?

Brain fart... tried without the quotation marks around the $color and it's working. [EDIT]... not really true... see below. --Shawnolson 15:00, 17 September 2011 (PDT)

What, around the value? --Artfunkel 03:06, 18 September 2011 (PDT)
No... actually around the $color like "$color" ... but I'm not certain that has anything to do with it now... probably because I am not clear on some docs regarding this. Without quotes around the value it won't work at all... but for some reason it seems to only show purple and black with the $color in quotes (though I'm certain I've done that before with parameters with no problems). I may have assumed the quotes had an issue because of the following inconsistencies during testing and I didn't take notes on specifically what I was doing originally.
What I'm now noticing is that it's working on LightmappedGeneric but not VertexLitGeneric. For VertexLitGeneric it seems to always be white with the example above (in Hammer and in game). But when I use it on LightmappedGeneric it will work.
Also I've noticed that the LightmappedGeneric VMT with just $color often displays as a purple-and-black texture in Hammer for a minute... then magically assumes the color. But in game the LightmappedGeneric version works fine always.--Shawnolson 07:24, 18 September 2011 (PDT)
The quotes around the values are required because otherwise it would cut off the string at the first space. I also noticed that you are mixing integers and floats there, that can't be good. I've personally never used the {int int int} syntax for anything yet, maybe you have more luck using [float float float]?
It's rather likely that this behaves differently between shaders, after all the way this feature is implement is not globally defined somehow, so it could be working fine in one situation while it's broken in another. --Biohazard 08:51, 18 September 2011 (PDT)
Yeah the floats were something I didn't look at as it's part of a script I'm working on and haven't yet converted to Int for this (and manually changed them to ints with same results above)... but it seems to work as noted above in the LightmappedGeneric. Also, using floats arrays like [0.5 0.25 0.1] was giving me the same results. Anyway, thanks for feedback and I'll share the sum of my understanding in a week or two.