Download

Dynamic Lights on Mobile?

I recently watched a Bioshock gameplay for iOS and saw some dynamic lights on it, like a spotlight and flickering lights…
How’s that possible ?
Can UE4 do that ? ( I can’t test it, I don’t own an Mac =/ )

I answered a very similar question in the Android section.

Basically, UE4 uses a simplified forward rendering pipeline on mobile that doesn’t support dynamic lights or shadows (yet). If you’re using non-HDR standard shading models, it is possible to render dynamic lights on mobile. There is a pretty neat “Core Framework” set of shaders (built to replace Unity’s light system) that does a lot of per-vertex optimizations to allow for up to 6 dynamic lights on a mobile device.

I have an example in that other thread of adding simple per-vertex lighting to a mobile material. If you wanted per-pixel lighting, you would need to dig into the engine a bit and it would likely be pushing the limits of even the fastest mobile devices. UE4 can do really fantastic static lighting on mobile, and I imagine as mobile devices get faster they will prioritize adding more dynamic features into the mobile rendering pipeline.

Oh wow… Thank you :smiley:
Mobile hardware are becoming really fast. Can’t wait for full dynamic lights !
Thanks for the response :slight_smile:

Hey! What are the non-HDR standard shading models? How can I make one?

I was talking about older, non-physically based shading methods likeold school OpenGL. You can do calculate simple Lambertian reflectance by taking the dot product of the light direction and the surface normal for every vertex, and then you use Gouraud shading to interpolate across the entire polygon (by plugging the light intensity into a custom UV). It’s a relatively low-quality light but even a very simple dynamic element can add a lot to certain games.

On mobile you only have one extra set of UVs to work with (if you’re using one for texturing and one for light maps) so you have 2 free variables. They’re cheap enough you could probably do two dynamic lights, but they will be white unless you add the color in per-pixel. If you aren’t using light maps (or are using your texture mapping for light mapping as well), you will have 4 variables to work with–enough to pack in an RGB light if you wanted.

I’m interested to know what a Gouraud shader setup would look like. I haven’t really done any work with the custom UVs , could you show me how it would be done? I’m not targeting mobile over here.