BGE Realtime Color-Picker Without Using ObjectColor

if you want to change an object’s color in game, you can use objectColor, but this tints the whole package, including the specularity, and is sometimes unattractive/unusable. For example, you can’t use objectColor to turn a white shiny object into a black shiny object.

This method moves some uvmaps around to different pixels of a color grid in order to change only the diffuse whithout bothering the specular color. It’s limited as a result of being tied to the object’s uv maps, but looks nicer


Attachments

bgeColorPickerDiffuseOnly.blend (2.66 MB)

for Blender 2.77+ add the following line at the begining of python files :

“import bge”

Since Blender 2.76 it is possible to change the material color.
https://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.76/BGE

Blender API.
https://www.blender.org/api/blender_python_api_2_78a_release/bge.types.KX_BlenderMaterial.html?highlight=diffusecolor#bge.types.KX_BlenderMaterial.diffuseColor