x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

ConvertWorldLocationToScreenLocation frame lag?

I have a UserWidget with an Event Tick function and I am using the blueprint node ConvertWorldLocationToScreenLocation on a static actor location then [Set Position in Viewport] on widget -- when I run the game and shake the FPS camera up/down or left/right the widget appears to lag behind by a frame. The problem is very noticeable if I add a DrawDebugString() to the same actor. The distance between the widget and the text will vary while the head moves then stabilize when the head stops. Looking at the code for DrawDebugString() it seems to delay the Canvas->Project() until just before rendering.

My character class has a UCameraComponent attached to the CapsuleComponent which I think is pretty standard.

I'm not sure if I need change the TickGroup of something... FSlateApplication::Tick() seems to be called very late already.

Has anyone heard of this issue before... any suggestions?

Paul

Product Version: UE 4.10
Tags:
more ▼

asked Feb 24 '16 at 12:55 AM in Rendering

avatar image

pci
76 2 7 12

avatar image pci Feb 25 '16 at 12:27 AM

I have discovered a work-around that seems hacky.

Using APlayerController::ProjectWorldLocationToScreen() from ACharacter::Tick() produces bad results. Internally it uses PlayerCameraManager which relies on something called CameraCache which is not updated until TG_PostPhysics. I am hesitant to move our entire character class to a later TickGroup. I discovered that I can override APlayerController::GetPlayerViewpoint() and not use the PlayerCameraManager but just use the controller rotation etc. which is updated immedately after input.

void AMyPlayerController::GetPlayerViewPoint(FVector& out_Location, FRotator& out_Rotation) const { Super::GetPlayerViewPoint(out_Locatoin, out_Rotation);

 if (!IsInState(NAME_Spectating))
 {
     out_Rotation = this->GetControlRotation();
 }

}

With this I can call ProjectWorldLocationToScreen() and get accurate values. This works because I know my camera uses bUsePawnControlRotation.

None of that would be necessary if Widgets had a native Event that occured after PostPhysics but before the frame was rendered.

Here's my understanding of the order of events:

TG_PrePhysics (0) PlayerController::PlayerTick() => movement & rotation Character::Tick() => (calculate screen position with controller view info) TG_PostPhysics (6) PlayerCameraManager::UpdateCamera() FillCameraCache()


Render

FSlateApplicatoin::Tick() => calculating screen position here is too late

Thoughts?

Paul

avatar image pci Feb 25 '16 at 07:46 PM

Another work-around highlights the fact that the Widget default Tick event is questionable.

You can add a SecondaryActorTick to your Character class and set it to TG_PostUpdateWork -- this ensure that it is AFTER the TG_PostPhysics update used by the PlayerCameraManager

If you bind that custom event SecondaryTick in your Widget blueprint and use that instead of Event Tick -- then you can use the standard ConvertWorldLocationToScreenLocation blueprint node and it will produce screen coordinates in synch with the latest camera movement.

It would be nice if you could just configure the Tick Group for User Widgets -- if that is not a viable default for all widgets.

(comments are locked)
10|2000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question