#Unable to rotate directional light during runtime

1 messages · Page 1 of 1 (latest)

weary solar
#

All of the game takes place at night except this one part that's in the morning. I have a run in editor script that rotated the directional light (and toggles pp) for better visibility but it doesn't seem to work during runtime. I don't particularly need it during runtime either, I just have to load the scene with the directional light rotated downwards once.

I know this is most likely a problem with my lighting settings, but I'm relatively new to 3d games so I don't really know how to configure that and where to check settings and which pipeline I'm using

#

the run in editor script has the same effect too when I try it during runtime

dapper fjord
#

can you explain again

#

really unclear what you are trying to achieve

weary solar
#

I'm trying to rotate the directional light when the scene starts so it doesn't feel dark

#

but when I rotate it during runtime, it doesn't update

dapper fjord
#

maybe something else is overriding the rotation then

compact shuttle
#

It's not clear what the video is about. Why are you immediately exiting play mode?

#

Anyways, you should start with rotating the light manually in play mode. If it works, then the issue is in code.

unique marlin
#

It's definitely not clearly demonstrated
But I think the issue is assuming that GI is supposed to update at runtime at all

dapper fjord
#

yeah sounds like it

unique marlin
#

It's hardly documented anywhere but I believe you need to call DynamicGI.UpdateEnvironment and also have a reflection probe in either realtime mode or updated with ReflectionProbe.RenderProbe together with the other method

#

Or you need to be using Realtime GI with at least one light probe and one (realtime) reflection probe
(But usually you only need Realtime GI if you also want to bake realtime indirect lightmaps)

#

If no lighting is generated, the editor uses these methods automatically in the background for preview purposes, giving the false impression that light form the sky is supposed to be dynamically changing

#

The sky itself is just a material, actually on a spherical mesh I believe, so renderers in the scene that need it for light information cannot automatically access it
So it needs to be baked onto a cubemap texture and a spherical harmonics function in a separate step for lit materials to be able to use the cubemap for specular lighting and the SH for diffuse lighting

weary solar
#

thanks

#

how do I mark a thread as solved

#

got it

unique marlin