Game Development Community

Change color at runtime for Material

by Lateral Punk · in Torque Game Engine Advanced · 06/25/2007 (2:07 pm) · 1 replies

Does anyone know how to change the color (tint) of the diffuse property of a material at runtime? I want to basically tint things during execution, but can't seem to figure how to do it. Moreover, it seems that the diffuse[] property of Material doesn't even have any effect at start-up. I set it to being fully red, but I see no difference in the world. Do I have to use a CustomMaterial with a simple shader that uses the new diffuse? Seems like a lot of work if I have to do it that way.

thanks

#1
06/25/2007 (3:51 pm)
Stock only works with emissive turned on atm... on a related note: have yet to see on forums, docs, or code, just how one would link say, a scripting *variable* to a shader to begin with... hoping i'm just missing something there... at least dynamicly speaking...

can say that

new Material(buggy_body001a)
{
	baseTex[0] = "./microt";
	bumpTex[0] = "./microtb";
	glow[0]          = false;
	emissive[0]      = true;
	pixelSpecular[0] = true;
	specular[0]      = "0.5 0.5 0.5 0.5";
	diffuse[0]      = $diffusebar;
	specularPower[0] = 128.0;
	cubemap[0] = WChrome;

	baseTex[1] = "./microt_decals1";
	preload = true;
};
$diffusebar = $redshading @ " 0.0 0.0 0.0";

gets it as far as : img406.imageshack.us/my.php?image=wtfxzm6.jpg

course, could be i just found a bug in the guiobjectview we're workin on over

www.garagegames.com/mg/forums/result.thread.php?qt=58720

dunno. if you've got a similar setup to check it on, would be interested to see where that test takes us.