Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Very strange behavior of a Shader

Discussion in 'General Graphics' started by DuvE, Feb 13, 2019.

  1. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    167
    Hi,

    I'm making a simple ground shader with traces from characters feet. So my setup is pretty simple. I just put the orthographic camera under the plane and render only intersecting feet. Then I took this texture and place it a ground shader itself to make a feet traces mask. My ground plane is a bit bigger than the camera texture, so every few meters I need to transform the ground camera and modify the UVs of this texture in the ground, plus UVs of the render texture itself (I'm using Custom Render texture for this).

    But I ran into a very weird behavior, all the UV's and textures updates simultaneously in a single tick. But for some reason, I have some weird hiccups on my ground plane. But the strangest thing is that if I decrease the size of a ground plane to make it really small, the hiccups are gone. I think the issue is somehow connected to vertex data and UV generation on each frame. Maybe there is some desynching, I've recorded a short video, in this video, you can see the big ground plane and the same plane but in a much smaller size.



    PS: Sorry, posted this in a "General Graphic"

    UPDATE: Fixed, I didn't know that changing any parameter in an Update Material of Custom Render Texture actually updates it too. I was calling the update function after some parameter changer, so the texture was updated 2 times per frame instead of one.
     
    Last edited: Feb 14, 2019
    swanijam likes this.