Page 1 of 1

Change material color

Posted: Tue Aug 16, 2005 3:31 pm
by WToma
Hi!
It's me again :) I try to change the color of some loaded meshes.
I use

Code: Select all

node->getMaterial(i).AmbientColor.set(0,0,255,0);
, but nothing happens. When I try to changle all colors (excepted emissive) of all materials, I still cannot notice any changes. (If I change emissive color it works, but looks ugly.)
Any ideas?
Toma
edit: the entered values are stored, I check it out by printing the color values.

Posted: Wed Aug 17, 2005 12:50 pm
by WToma
Up!
Nobody got the faintest idea :?:
Toma

Posted: Thu Aug 18, 2005 12:16 pm
by bearSoft
hmm have u tried the same on a different pc?
some graphic card may act weird with some modes / some methods
-perhaps u can make an example file demonstrating this?
u can use http://www.uploadr.com/ as a 'fileserver' if u do nat have ur own

Posted: Thu Aug 18, 2005 2:14 pm
by WToma
I've made up a little test to demonstrate what happens. Zip includes c++ source, Dev-C++ project file and an example model.
Maybe the error is in my environment because I had build the lib myself and also changed some little modifications (see the "yet another lighting question" topic).
You can download the example from here: http://file.uploadr.com/19a5 (thx for mentioning uploadr, really great service!)
Toma

Posted: Fri Aug 19, 2005 8:16 pm
by WToma
OK, I have found it. In this case, the problem was that I should have set up the new color before creating the IAnimatedMeshSceneNode from IAnimatedMesh. Working with EmissiveColor results an acceptable lighting/shading. In other cases, however, the usage of EmissiveColor is not a good solution because it results flat shaded surfaces that I don't want at all. And I can still notice strange/undocumented/unseen (by me ;)) things with other models. (Not all other, though.)
Looking forward for your brighter ideas :)
Toma

Posted: Sun Aug 21, 2005 3:22 pm
by WToma
Here you can see the problem: http://file.uploadr.com/1ae5
The original color is that you can see on the left. I try to paint this car blue. On the left picture, I use this code:

Code: Select all

model->getMaterial(1).SpecularColor.set(0,255,255,255);
model->getMaterial(1).AmbientColor.set(0,0,0,255);
model->getMaterial(1).DiffuseColor.set(0,0,0,255);
model->getMaterial(1).Shininess=20.0f;
(model is an IAnimatedMeshSceneNode*)
On the right:

Code: Select all

model->getMaterial(1).EmissiveColor.set(0,0,0,255);
As you can see, the first doesn't work, the car is still red. The right works, but looks ugly, because it doesn't fade into the darkness.
Hope somebody has some ideas, because it drives me mad ;)
Toma