Red light on blue object (for graphics software) I'm trying to make a program that simulates shadows in a 2D environment and I need some help in determining how things should look.
For example, if my light source is red and the illuminated object is blue (only radiates light in the blue frequency), how should it look when I shine red light on it?
How about the other way around? Since blue light has higher frequency/energy than red light, will the result be different if the light is blue and the object is red?
If these things depend on a lot of factors (like the properties of the material), I would rather not go into that, the simulation does not need to be that realistic. I would just want an approximate idea of what should happen.
 A: A blue object is one that only reflects  blue light  - assuming you don't mean an object that is heated to a temperature where it is glowing blue ( like a 10,000deg C star)
So shining red light on a blue object would, in an ideal world, show it as black. In the real world no object is perfectly blue, it will reflect some light outside the blue. So if you want to simulate photo realism rather than a computer graphics look then you need to have it reflect some small percentage of other colours. Actually to make it properly realistic you also have to handle the fact that the amount of other colours it reflects also depends on the angle - but that gets very complicated.
And no the energy of the photons doesn't have any effect. Colour is really a physioligical effect more than optics, you eye sees a certain colour because of the relative number of red, green and blue (approx) photons arriving.
A: Its easy to understand - object always PICKS UP his own color from the ray of light which is shining on it. If the ray of light has no spectrum (which means as in your case its only red light) then all objects will be black except for those whose color is same as the color of the ray of light. So in red light all non red objects are black, and all red objects are red. For the blue light source its same all non blue objects are black and only blue ones are blue.
General case is like this - we have a white  light source (which has ALL the colors in it) and all objects reflect (pick up) only their corresponding color. 
Blue sun - everything is black or blue, Red sun - everything is red or black.
A: Not quite that simple because of spectrum analysis. A light source is never "pure".  So an orange (type-K) sun would make our colors here different, but bluish would still exist because of the range of wavelengths of the source.  But it would be less common.
