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. Dismiss Notice

Vertex animation - very jumpy and jerky in scene view, fine in game view

Discussion in 'Shaders' started by Samhayne, Jun 5, 2020.

  1. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    44


    Hello,

    I'm a bit confused... I'm playing around with some water shader and I observe that the vertex animation is totally jumpy and jerky in the scene view while it's smooth in the game view.

    Is this normal?
    Does that ring any bell to someone?

    I already simplified my vertex shader to basically this...:


    Code (CSharp):
    1. v2f vert (appdata v)
    2. {
    3.    v2f o;
    4.    [...]
    5.    v.vertex.y = sin(v.vertex.x * _Time * 5) * 0.04;
    6.  
    7.    o.vertex = UnityObjectToClipPos(v.vertex);
    8.    o.screenPosition = ComputeScreenPos(o.vertex);
    9.     [...]
    10.    return o;
    11. }
    But the problem doesn't seem to be in the complexity...
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    It's not an issue with your shader. It's an issue with the update rate of the scene view. Unity doesn't always update the scene view every frame, especially when the scene view isn't the window currently in focus (ie: your mouse cursor isn't over or actively interacting with the scene view). The scene view's "Animated Material" option in the effects drop down will tell it to update more regularly so it will update when not being actively interacted with, but if the shader is updating at all when not in play mode, that's probably already enabled. Even when in play mode I've noticed sometimes the scene view appears to be running at a slower update than the game view.

    Basically, you're not doing anything wrong. Unity just doesn't always update the scene view at a consistent frame time. It's safe to ignore the problem and just focus on the game view.
     
  3. Samhayne

    Samhayne

    Joined:
    Jun 15, 2009
    Posts:
    44
    Thanks, bgolus.
    Good we have you in this forum.

    Yipp... I already enabled Animated Material in the SceneView. I just never observed this jumpyness... it totally looks like the shader is broken. And when I enable all the details it looks... really, really broken.

    It‘s pretty annoying but probably there is nothing that can be done about it.
     
  4. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,238
    It's plausible you could write a custom editor script that forces a scene view redraw ever editor update, but the editor update isn't consistent either...