I wrote some code which uses a BasicEffect with a DiffuseColor. I’m comparing the behavior between Microsoft XNA 4.0 and MonoGame DesktopGL.
I have code similar to:
effect.DiffuseColor = new Vector3(5, 5, 5);
spriteBatch.Draw(GlobalContent.Season_collection, new Vector2(0, 0), new Rectangle(0,0,100,100), Color.White);
effect.DiffuseColor = new Vector3(25, 25, 25);
spriteBatch.Draw(GlobalContent.Season_collection, new Vector2(200, 0), new Rectangle(0, 0, 100, 100), Color.White);
effect.DiffuseColor = new Vector3(.1f, .1f, .1f);
spriteBatch.Draw(GlobalContent.Season_collection, new Vector2(400, 0), new Rectangle(0, 0, 100, 100), Color.White);
I’m using a diffuse color of 5, 25, and 0.1 respectively.
In XNA the first two sprites are drawn with capped diffuse colors of 1, meaning they draw at normal color as specified by the texture. The third does in fact draw at 10% brightness, as shown in the following image:
However, in MonoGame (DesktopGL) the colors are multiplied by 5 and 25, so the first two images are far brighter, as shown in the following image:
Normally I’d say “This is wrong because it doesn’t match XNA 4 behavior” but I actually like MonoGame’s behavior more because it lets me “brighten” a sprite by setting a diffuse value greater than 1; however, I am concerned about using this in case it is “fixed” later.
Questions:
- Is this behavior intentional or accidental?
- Does anyone know if this is consistent on other platforms like iOS and Android?
- Is this behavior I can/should depend on, or will it change in future versions to make it match XNA 4.0?
Thanks in advance for any answers.