Not directly answering your question, but I don’t see how it would help you if you want to use an Direction Light Actor anyway…
Simply move your light actor and then refresh the material on the Sky Sphere.
In your screenshot, you can see the “refresh material” checkbox. Look at the BP code of the Sky Sphere to see what it does and trigger it whenever you want.
Oh, i think I get it. Two easy mistakes to make with Sky Sphere and Direct Light Actor (DLA):
- First, the position of the DLA is irrelevant, only the rotation is important!
- Second, when you change the DLA’s rotation, the shadows and light source ajust immediately, but the sun stays where it is, because it’s just the material on the Sky Sphere. You need to check the “refresh material” checkbox on the Sky Sphere or call the Function UpdateSunDirection on it.
After creating a blank first_person project - the sun posistion rendered in the editor viewport (not during PIE!) has an arbitrary yaw and pitch (rotation).
If I CLEAR the light_source from SkySphereBlueprint (BP_Sky_Sphere) I can change the sun pitch/yaw
using the sun height and Transform.Rotation.Z.
However, want to do this WITH a Directional Light Actor assignment.
So, somewhere (possibly within in BP_Sky_Sphere) there is a default yaw/pitch applied when a Directional Light Actor is is in use, however, I just can’t find it anywhere.
How can I change the default sun position in the editor (not PIE) when a Directional Light Actor (light source) is assigned?
For example, I want the editor to start with the sun below the horizon, not above it.
Refresh material! Thanks , that was it!
A bit tedious, but the process is:
(1) go to the directional light and rotate it
(2) go back to BP_SkySphere and click Refresh material.
I was watching a video from an older version of the editor and the sun moved as they turn the directional light (in real time) - was this removed in a later version? You can see the video here: Unreal Engine 4 Beginner Tutorial Series - #11 Introduction to lighting - YouTube
Do you (or anyone) know how to get the actual DLA’s world xyz position?
Even though the DirLightActor works as expected (I can rotate it through day/night cycles) calling LightSource.[GetActorLocation] only retrieves the same static vector value that was set in the LightSource details panel (i.e. Location).
As you pointed out, only the material is updated, but presumably the DirLightActor.xyz is held somewhere in order to calculate dynamic shadow updates in the scene if you rotate the DirLight.
Basically, I need the DirLightSource.xyz to pass into a material.
Only the rotation is used and I think the dynamic shadow is calculated based on the actual sun on the texture. The DLA is really just the provider of the rotation value