Shader for light simulation in 2d scene.

I need shader that I will put on plane, so all objects behind that plahe will be lighten. I just started to learn shaders and tryed simple blending modes but it’s not what i looking for. And I need objects to be lightened based on their Z distance from my light plane.

I need the same lighting effect and options that are available in point light. Is that possible?

So far I have no idea how to do it. Any suggestions?) All help is appriciated!

What is wrong with point lights in this situation?

Or I can just use pixel point lights? I need to do some research here. The “fantastic” quality setting is containing only 3-4 pixel lights so I thought that it is very “expensive” way. But it is the easyest way. Unfortunately I cant use lightmaps.

Will pixel light work on iPad, Android? Ah… Anyway its the same as shaders…

EDIT: I did some testing. I will use light.

Pixel lights are expensive, because they are evaluated per-pixel. Vertex lights are usually cheaper, because they are evaluated per-vertex, and the result is interpolated across each triangle. If vertex lighting looks too low-resolution, try increasing the tesselation of your geometry.

A custom lighting solution like what you describe is not really a beginner project, and depending on how you implement it might not even get you any performance increase.

I’m using Ragespline and tesselation here is not very good. There is lots of thin long triangles that not look good in the vertex light. Pixel light rendering time depends on its size in pixels on screen?

That’s right.

How many lights do you need?

On the size in pixels multiplied with the number of pixel lights. Make sure to set “Pixel Light Count” in “Project Settings” > “Quality” high enough. (Or set the “Render Mode” of all light sources to “Important”.)

Does it mean that with increasing number of lights render time grows exponentially?

I need about 1-4 lights per screen as static and some more for special effects. I already stress tested it with lots of geometry and 60 lights on screen, so up to 10 lights will be fine.

And its working on iPad, right?

And one more thing.It looks like I have 16 bit color. Look at the screenshot please:

It looks much worse in original picture. Should it be like this??

Thank you for help!

It grows linearly, but that can still kill performance if you’re not careful.

You’re in the best position to answer that question if you did stress testing.

What is that screenshot of? Is it on a computer or an iPad? What texture formats are you using for the platform? If on iOS hardware, do you have 32-bit display buffer enabled in Player Settings?

It’s PC png true color. But its not about textures. I deleted textures and now it’s just white surface with Defuse shader, but I still see al the color grages in the dark regions of the map.

Big image, click:

And with textures it looks terrible:

Are you using forward or deferred rendering path? Check both the Player Settings, and the Camera, which can override those settings.

Forward.

This effect is taking place when several week light sources are overlap. There are 3 lights in one point here.

It looks better with one brighter light.