Understanding light usage with quad mesh approach

Godot Version

4.2 - 4.3.beta1

Question

I’m trying to achieve a simple light posterization as a test.

I did look at the advanced_postprocessing tutorial, but it doesn’t go into any details of how to make use of the light function so I tried to figure it out on my own by looking at examples on godotshaders.

I noticed is that almost all shaders are set on the mesh which is what I’m trying to avoid. I want a post processor to cover everything possible in the view.

If anyone could point me in the right direction, I would greatly appreciate it.

My test scene

What it looks like with the quad mesh on

My post process light function

void light() {
	float dot_nl = clamp(dot(NORMAL, LIGHT), 0.0, 1.0);
	float nl_att = dot_nl * ATTENUATION;

	float light;
	if (nl_att < 0.5) {
		light = 0.1; // with 0.0 the weird light doesn't exist
	}
	else if (nl_att < 0.75) {
		light = 0.5;
	}
	else {
		light = 1.0;
	}

	DIFFUSE_LIGHT += light * LIGHT_COLOR;
}

As far as I know there is no global shader. It has to be applied for every mesh object.

If you go the full quad route the light function will be of no use since you can only reference the quad`s mesh.

But to do a posterizing effect you should use the quad mesh and the screen texture to do a fragment shader process.

I think you could also potentially use a compute shader. There are some videos out there doing raytracing with a. Computer shader in Godot.