Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question Game View Lighting Calculation is Laggy but Scene View is Not

Discussion in 'Editor & General Support' started by EliBrick, Oct 11, 2022.

  1. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    Video compression makes it tough to see, but the Game View's lighting per face of the mesh lags while the Scene View's lighting is entirely smooth. Look at the bottom right triangle of the center hexagon in the video.
    How do I fix this?
     
  2. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    Hi, you mean lagging in time comparing to the editor window or has more discreet changes happening in right window ?
     
  3. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    The scene view seems to be recalculating the lighting more times per second than the game view.
     
  4. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    Try to check with editor view disabled or in build, does this also happen in those ?

    Also do you do the updates in Update function without any timers ?
     
  5. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    The build looks like the Game View. Minimizing the Scene View does nothing to change the Game View. All mesh movement is handled in a shader, nothing in a Monobehavior.
     
  6. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    hm, maybe that is the issue, try to pass a constant time to the shader as input from c# side and see if helps, if replace the shader time
     
  7. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    No dice. Performs the same when passing time with mat.SetFloat("_MyTime", Time.time);
     
  8. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    i see, maybe can post the update code to check, as cant tell why may not work if the timer is not the issue

    Normally the lighting should just update on every frame in all cases
     
  9. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    upload_2022-10-11_0-46-48.png upload_2022-10-11_0-47-40.png
    First pic is the code for passing Time, second pic is where I use it in the shader.
    I don't think it has to do with Time not updating properly, but rather something to do with a renderer or some quirk with the Scene View.
     
  10. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    I see, all look normal so is bit hard to understand

    Is it same slow when you build the game ?
     
  11. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    Yes
     
  12. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    Is Vsync on in the quality settings ?
     
  13. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    Vsync was on, but changing the setting doesn't seem to affect the issue. upload_2022-10-11_17-55-17.png
     
  14. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    Indeed looks like a strange problem, since most obvious reasons seems not affect it, the only way could tell more is if had a tiny version of the project, like a base poly plane and the shader applied to check on my side.
     
  15. EliBrick

    EliBrick

    Joined:
    Jun 1, 2020
    Posts:
    10
    When attempting to create a new project so that I could display the issue, I selected the template: 3D (URP). After importing my shader and mesh, it seems as though the problem has disappeared.
    I have a feeling that there are settings automatically set in the template that were never set in my other project.
     
    nasos_333 likes this.
  16. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    12,947
    interesting :)

    I wonder what those might be for sure