Material X has AmbRed, AmbGreen, AmbBlue at maximum.
If I assign Material X to a mesh, the mesh is displayed correctly (i.e. illuminated) as shown on the left.
If I create an object and assign the same mesh and Material X to that object, the mesh is not illuminated as shown on the right.
(This post was last modified: 03-29-2013 06:30 PM by mystara.)
If you're overriding Material using MaterialLock in codes (force material for object in World Editor) it will work correctly only if it's compatible with original mesh material.
Original mesh shaders are used for MaterialLock.
Please read comments on MaterialLock
Okay, I've reproduced the problem.
I'm using the editor that I downloaded from esenthel.com, so this isn't using any kind of custom code.
Two models:
GemTexture.mesh is a model with the material Light.mtrl already applied.
GemNoTexture.mesh is the same model with no material applied.
Both of these models are placed in the world editor. Ambient light and "sun" are disabled.
The object that uses "GemNoTexture.mesh" has the material overridden to use Light.mtrl.
As far as I can tell, this should produce two identical objects. However, as, you can see below, the object that already has the material applied (GemTexture.mesh) is correctly displayed and the other model (GemNoTexture) does not. In particular, the overriden material does not use the correct ambient R, G, B values.
World file, material file and model files provided for reproducibility.
Original mesh material has zero ambient (ambient shader disabled), but new material has ambient (ambient shader exists), therefore materials are not compatible, and results will not exactly be the same.