Download

Changing the lighting method in the material

I have wondered about this from time to time, but I have never found an answer about how to actually do this.

How can I change the basic way lighting effects a material? To intercept the lighting data and make its effect on the material do something other than the default darken/brighten?

Two examples that I often think I’d like to do in my projects:

One, make the shading look hand-drawn, like in Valkyria Chronicles. Instead of darkening the material, it draws a hatch texture over those pixels in screen-space.
To do that, I would need the material to never actually be darkened by its lighting, but use the lighting data to dictate where on the screen I draw the texture.

Two, replicate the creepy lighting effect from old sector-based engines. Instead of just drawing the material darker according to its shading, also factor in the pixel’s distance from the camera. So dark things become visible if they are close, but fade away as they get further away. But unlike a fog effect, it responds to lighting, so some things that are far away can still be plainly visible.
To do that, I would basically need to intercept the lighting values sent to a material, and then apply some calculations to that data as I see fit.

In both of these examples, these would be things that would actually work on all the lighting in the scene, so perhaps it doesn’t have to be an actual option in the material itself. (Although I seem to recall in UDK there was some way to create materials that weren’t applied to objects but instead applied to the camera, thus creating rendering effects on your scene that you built in the material editor. I’d imagine that feature still exists in UE4 but I can’t recall what it was called or how to access it, let alone where to find it now.)

I also often find myself wanting a way to adjust how the engine handles when a material gets too bright. In both of these examples, we’d need to be able to adjust that. In both cases, we’d probably just want the materials to never exceed the brightness of their original texel value. Honestly I’d like to be able to control and tweak that for a lot of different projects, so I can fine-tune the visual aesthetics.

Can someone show me how to adjust how the engine handles lighting values? Or send me to a tutorial, or tell me what the feature is called? Something?
This is possibly the most powerful engine ever created, but I’m stuck with only one visual aesthetic.

You should look into post processing materials. Those can be used to create exactly the kinds of effects you are describing here.

Thank you.
This is a start, but I still can’t seem to find anything pertinent to the lighting. I see nothing mentioned about it in the article, (except to say that “some parts of the lighting” are available) and don’t see any node I can add in the material that seem to be relevant to that.

I also can’t seem to find a (depth buffer? Z buffer? Data for how far away something is from the camera) that I could plug into the material, although I seem to recall seeing that in UDK.