Ligthsystem Simple Darkness

Hi guys,

ich have a Problem regading the implementation of a Darkness System, i’m looking for help all over the net and after days of searching im now writing a Thread.

What i need:
A black Background (that can scale in alpha) to be used as “Night”
The “Lights” would be simple Quads with a Texture that has RGB and Alpha.
Those RGBA.pngs would lay over the black Background and turn it off, tintet by color, where there is Alpha.

Here is a Screenshot of it:

How to go about it?

My First Idea:
Find/Change or Implement a Shader. But for the love of god i was not able to do it. Searching did not help either. By this point i think its not even possible to do with a Shader in Unity because the Queue does not allow it?
Also, i dont know the correct name for this:
Its like there is so much but nothing like this “simple” thing…
Is this called Alpha Blending or Buffered Blending or Transparency Overlay Multiplication Shader?

My Second Idea:
2 Cameras, 1 Only sees those white Dot.png’s and a Black background. The other one (the Main Camera) uses this and somhow multiplies both Images together.
I dont like this because alot of Posts say its 2* your Meshes for Rendering.

My Questions:
How is this shader/technice called properly? What is the official name for it? (Then i could possibly google better)
What to look for in a Shader when i would try again to implement it ?
Is it even possible to do it all in a Shader?

If non of this does work iwould also be very thankful for hint towards how to get it working with 2 Cameras.

Bump

What you’re doing is lighting. No other fancy terms to look for, you’re just going about it in a very old school fashion so the existing information on the topic probably won’t be so helpful. Ultimately you can render each object in a forward style with full knowledge of lighting (the location, size, and texture of your light quads and the “night”) being passed to the shader and handle it all there rather than render them as separate objects, or you can do it in a deferred style where you cache the diffuse color or lighting and combine the two when you render the other.

Your best option really is the second one, or something like it. You should render everything unlit, then render to texture “off screen” the darkness and lights. Then you can apply this texture to your unlit scene as a multiply pass. It’s kind of a backwards version of most deferred techniques but works perfectly well for your use.

Look up “unity off screen particles”. It’ll lead you to a more complex system than you need, but it has all of the major parts you do need so you can pick apart what they’re doing. If you use it as a base it’ll also have reduced resolution rendering built in for the lighting pass which can save you a lot of perf and memory.