Custom Lighting On Mobile Devices

Is there a way to do this?

I’m trying to do something like the team fortress shading style on a mobile device. I’ve been told that unreal 4 uses deferred lighting and therefore all lighting is basically post processed and therefore the only way to have custom lighting is to do it with post processing.

Does the mobile rendered also use deferred lighting and if so, is there any way to get anything except for the regular lighting style?

Hello Feanix,

There is definitely a way to get the custom lighting style you wish to acheive through mobile. Keep in mind mobile is a bit limited due to hardware specs, so have a read of the documentation on how to develop for mobile devices. It is broken up into sections so you can find the information you are looking for really quickly.

Mobile Game Development

https://docs.unrealengine.com/latest/INT/Platforms/Mobile/index.html

Thanks,

Andrew Hurley

Hi Andrew! I’m excited to hear its possible but after scouring that section I’m none the wiser :frowning: Could you give me any more info to help?

Hey again Feanix,

The information provided is the extent of the knowledge I know currently for developing game for mobile. I would suggest going onto the Forums as well as the Wiki to gain further knowledge and find some good places to start.

Unreal Engine Forums
https://forums.unrealengine.com/

Unreal Engine Wiki

I hope this helps as well.

Thanks,

Andrew Hurley

Hey Feanix,
another approuch to do custom lighting is to fake forward rendering, since deferred rendering can be quite costly for mobiles.

To do this first disable the G-Buffer with the command ‘r.GBuffer 0’. This disables all postprocessing buffers UE generates for deferred rendering.

Now you could create a material parameter collection where you store your sundirection, suncolor etc. You can easily access your sunlight and get the forward vector (that is the sundirection) per level blueprint.

Using this you can create an unlit material and create a dot product between the sundirection and the PixelNormalWS (or VertexNormalWS, per pixel is more precise).

Finally this should be sufficiant as a start and you could convert this shader code into a shader graph http://wiki.unity3d.com/index.php/TeamFortress2Shader.
The interesting part is the function LightingTF2.

Hope it helps.