Moving light sources on mobile?

I am doing similar thing for planet shader. It uses normal map to create fake shadows on planet (from mountains canyons etc), and light vector (is direction to sun) is fully dynamic in game. Works great.
Even more: my game does not use lights at all, everything is dynamic, looks nice for mobile, just no shadows

Awesome stuff there CaptainScience, I had thought custom UV was for tiling only,too ,very impressing

fyi link on more info (how to get custom UV’s to show up) Customized UVs in Unreal Engine Materials | Unreal Engine 5.3 Documentation

also I was looking at the github feed today and noticed this

so maybe 4.9?

I looked on the Trello (haven’t been checking it much lately), and it looks like it in indeed coming for 4.9:

Although packing a couple dynamic lights into the custom UVs will probably still be useful for improved performance with unimportant lights, it will be nice to have the option to have a fully dynamic point light.

I’ve been trying to get this kind of lighting style in my mobile game

I am doing mobile and I’ve switched my materials to be unlit and emissive only - I’ve been trying to use this technique but I think what I really want to do is just change the color based on the direction of the camera to my materials normal - could anyone help me with the materials, would I use this custom UV technique for that?

I’ve tried switching to a normal material w/ emissive AND having a dynamic light but I kind of like the idea of doing it all in shaders.

Any comments or suggestions would help, I’m in a total “i dont know what i dont know” situation here

Maybe show how your material blueprint currently looks?

In 4.8 there’s a RayTracedProceduralSphere node in the material editor.

This is possible now:

Z-enzyme do you know how to use the ProceduralRaytracedSphere node, I can’t find any information on the node and how to use it?

Allright.

What I’m using is material parameter collection to control that thing. Cause I can have access to it from blueprints and use one collection for all materials. My set up:

ac2a5a894a65b668f279087f75fe550b858e005d.jpeg

Simple material and Material Parameter Collection. In the Material Parameter Collection (MPC) I set up variables which I can later change via blueprints:

60ed51a5d8e142a2331e1bc517ec2d57319001be.jpeg

Then I make a blueprint class (it can be a player, a torch, whatever) where in tick I add stuff. What you need is Set Vector Parameter Value i Set Scalar Parameter Value.

a74dcf57f3f69aab1b5f7a0dd551551c1a308cfb.jpeg

Then I build a blueprint with same function in the TICK and CONSTRUCTION SCRIPT so you can see how it works in the editor.

dcc18c782f78336a9e18109ceab719e08a778ca2.jpeg

Awkay, lets look at the ProceduralRayTracedSphere (This is what I learned through try and error and NO WAY it’s accurate) :

e1f7c0b5e84766a9945699dbc34addf0eb21c970.jpeg

Inputs:
Sphere Radius - well, self explonatory. How big the sphere is.
Ray Direction - which way the sphere should be projected (probably)
Receive to sphere center - no idea.
World Position - No idea, I know that it breaks stuff :stuck_out_tongue:
Sphere Position - The location were the sphere is.

Outputs (ones I know and I use):
Intersection Surface Normal - best thing ever - projects Spherical Normal on the raytraced geometry.
Distance alpha - The distance of a ray to the sphere center displayed in grayscale.

I don’t use the rest. At least didn’t use them yet.

So, if you build your material like this [see below] you’ll more less understand things.

a4e5271cdf8eef7626e75851b51a5e1e03bd200a.jpeg84c52678176f568c7829b646342ae42945440b60.jpeg

Lets use that projected sphere normal to get rid of backlit surfaces (no idea if I did that right, but it worked):

Now, we can project a cubemap on that thing using projected normals:

97edbed199bb02cfa46cdaf78eea94afcac38b23.jpeg

Later you can just rotate normal to rotate the cubemap, multiply it with color to get a color, light power and stuff.
Works beautifully on Nvidia Shield with 5 lights. No framerate drop.

7a15282e89e9356ae4bff2cb2386b8b821a2c2cd.jpeg

Great explanation, I will look at this when I am at my machine, I was looking to use this for VR stuff as dynamic lighting cost were very high.

Thanks for getting back to me so quick.

No problem.

Just discovered it doesn’t really work with Adreno 330 chipsets, no idea why. It does work with Nvidia K1 though. The mobile stats in the editor or the HTML5 preview worked fine. Gotta figure it out.

This is very cool, thanks for this, took me a while to get it hooked up right (user error) but certainly interesting. Shame we can’t get some attenuation there :wink:

I just can’t seem to get this to work :frowning: ill keep trying but I don’t understand why I can’t get a simple sphere (sun) to cast the fake light described above by CaptainScience

What a pity it doesn’t work - also does not work on the Mali-T760 (Note 4 Exynos version)

The thing that should work on every device with at full ES2 support is this:

And then, as a function to find 1 closest light you do this:

Works beautifully on Adreno 330 phone (Xperia Z1 Compact: 50-40 fps).

Hello! I’m trying to reproduce your work for movable lights, but i have no idea on how to do this. Could you please post a simple project with an example of movable light working with mobile devices? Thanks in advance!

I have succesfully reproduced your method, but i have a question: If I have a large landscape, and I have more then one movable lights material lighting up the landscape, will work just one light?

I’m trying to get a flashlight example for use on a FPS for the Gear VR. Is there anything missing from the blueprint image your provided? I’m a bit new with UE4 and I’m not sure how to get this started.

Any help would be appreciated.

Mike

I too can’t get any of the above examples working. I setup everything exactly the same, I tried materials like CaptainScience and I tried enzyme’s way and nothing.

There is something small yet crucial that I’m missing here.

Necroing the thread here…
This is just what I’ve been looking for! It works wonders for my Mobile App, however I have some questions that hopefully someone will be able to answer.
Using Z-enzyme method.
1: How do I make it cast shadows?
2: All the normals are removed, all surfaces became flat… I tried playing with roughness but this isn’t my forte so any input would be greatly appreciated here

Thanks!