Here's one possible way to do what you want, if I understand your request properly.
The mix shader on the lower left is just the one that comes from the Images as Planes addon. That could just as easily be the direct Color out of the Image node. What I'm doing here is crushing the darker areas so that the image is mostly just the lights and the skyline. ...
Use a texture to drive a bump node. Plug Bump's "normal" output into the normal input of the Principled BSDF node. I can make a voronoi texture small enough to represent closely packed balls or bubbles. Then I can colour them as a group with a noisy texture. This hides the fact that each ball is not really coloured. Finally I use a 4D texture to animate the ...
So after playing around with math and vertor math for some reason it gives interesting effects but not what i was looking for, so i found the solution after someone above in the comments give me an idea which was quite the solution, i just had to invert the mapping node inputs and then it worked
There is many possibilities to do separation, but also with so many limits, that make it almost nonsense.
First limit is 8bit depth of your JPEG, should be 32bit like Open EXR. 32bit gives you much wider color range (especially to separate sky).
Second limit is bouncing light that make it totaly impossible to separate all indirect light for re-lightning ...
Personally, I would create a 'Sea Level' object and extract the Z of its Object Space like this:
Now the Z output is a number; the height above/below sea level in Blender units. You can scale that number, map it to another range, put it through curves or a color ramp.. whatever you need. If you put this pair of nodes into a little group, you can quickly ...
Add a "Texture coordinate" node, and plug the "Generated" output into a "Separate XYZ" node.
The "Z" output will take values between 0 for the lowest point to 1 for the highest point.
Plug it into a "color ramp" or a "Map range" in order to fine-tune the output value.
Unless you have special reasons to use Cycles, I would consider using EEVEE for, at least, the main passes of your work, because of the Shader to RGB node.
The Shader to RGB node, which really can't be implemented in a path-tracer like Cycles without calling the whole renderer twice, allows you to take the actual light-response of a surface, capture that ...
Simple control of emission without affecting source appearence.
Quite surprised how light wrapped Sphere just from front direction.
But object is not lighted from front (black faces in center), because there is not any light behinde camera.
You can also use the image as World material mapped for Camera window (Texture ...
Good news! I managed to figure it out. I found this thread here, recreated the node map in the last picture on that thread, and lowered the emission strength so the villager wasn't blindingly bright.
Edit: Turns out replacing the Emission node with a Diffuse BSDF node works as well. Good to know.