Talk:$color

From Valve Developer Community
Revision as of 02:30, 25 June 2015 by CK1 (talk | contribs) ($color2)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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

It changes just the tint of the $basetexture. $detail, $phong, $selfillum and possible others do also have parametres to change their tint independently. --rozzy85 11:33, 17 April 2012 (PDT)

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:

"VertexLitGeneric"
{

	 "$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.
Try removing the decimal values - the article sais to input an integer, not a float--Pandaboy 08:30, 15 November 2011 (PST)

$color2

In Team Fortress 2 the $color2 parameter seems to be used to tint basetextures in DirectX 8 and 9, where as $color only works in DirectX 9. It seems to be usable with non-model shaders too. Is there any more information about this? Tumbolisu (talk) 11:31, 24 June 2015 (UTC)

$color2

$color2 is supposed to be used for VertexLitGeneric; but in my experience it works on both brushes and models. I am using the Garry's Mod Engine BTW.