4
\$\begingroup\$

I've implemented a simple script to simulate Sun Rotation (day/night cycle).

In my "Update" i Rotate main Directional Light (the sun). What i've noticed is that my FPS dropped from 60 to 20-25 fps.

I can understand why: recalculate all light each frame can be (euphemism) cpu-consuming.

So i switched approach using an InvokeRepeating with a repeating time of 0.25f seconds (4 "movement" per second).

Also with this approach my frame rate drop from 60 to 50 (unacceptable).

So my question is : is there a way to move/rotate a light (simulating a day/night cycle for instance) without meet a so big fps-dropping but mantaining realism ?

Thanks

\$\endgroup\$
3
  • 1
    \$\begingroup\$ How are you calculating light e.g. are you using deferred lighting? Are you mapping shadows that are dependent on the position of the sun? What part of your code forces the gpu to recalculate light? \$\endgroup\$ Commented Jul 20, 2018 at 14:14
  • \$\begingroup\$ Does the profiler give any insights as to what operation is taking up so much extra time? \$\endgroup\$ Commented Aug 8, 2018 at 13:54
  • \$\begingroup\$ Workaround: can't you rotate the light once minute? It's a day night cycle after all... \$\endgroup\$ Commented Aug 12, 2018 at 13:08

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.