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

Question Unity - hdrp - fast instantiating bullets are stretching first 1-2 frames

Discussion in 'Entity Component System' started by bb8_1, Dec 11, 2022.

  1. bb8_1

    bb8_1

    Joined:
    Jan 20, 2019
    Posts:
    98
    Have this problem when fast instantiating entities (bullets in this case) (unity hdrp) - they are stretching in different directions - not sure if it is a bug or maybe hdrp needs some extra adjustments to work properly with dots? This happens only in first 1-2 frames then everything works fine. Stretching happens even when camera does not move and "bullets" also do not move just stay at position where they are spawned - in this simple example shown on the vid. Strange distorted artefact is more noticeable if i a'm farther away from the origin at least it seems to me - so maybe this is some hdrp graphics issue? This doesnt happen when i use urp. Here is video that explains the problem(using 2022.2.0f1 and pre.15 packages, not used physics in the simple project from the vid, also in project behind the video are used simple unity primitives so no scaling and no parenting) :
     
    Last edited: Dec 11, 2022
  2. philsa-unity

    philsa-unity

    Unity Technologies

    Joined:
    Aug 23, 2022
    Posts:
    113
    Looks like it might be caused by motion blur or TAA or something that uses motion vectors in some way. To try & confirm this, you could try setting "Motion Vectors" to "Force No Motion" on the meshes you spawn:


    If that is indeed the culprit, I have an idea of something you could try if you want to keep motion vectors: make sure your prefabs are spawned before the TransformsSystemGroup in the frame.

    Let's say you're currently spawning them in EndSimulationEntityCommandBufferSystem, that means they'll be spawned after the TransformsSystemGroup but before the PresentationSystemGroup. The result is: your meshes appear at the world origin for 1 frame because their LocalToWorld has not yet been updated by TransformsSystemGroup, and then on the next frame they get rendered at the correct position. From the renderer's perspective, the object has moved from origin to current pos in one frame, and I assume that affects motion vectors
     
    Last edited: Dec 11, 2022
    Jonas_DM_, thelebaron and bb8_1 like this.
  3. bb8_1

    bb8_1

    Joined:
    Jan 20, 2019
    Posts:
    98
    Yeah - big thx @philsa-unity this solved the issue
     
    philsa-unity likes this.