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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

How to update the scene when exporting a RenderTarget from SceneCaptureComponent2D ?

Hi,

I'm trying to iteratively save images of a mesh from different viewpoints.

To do that, I have a mesh of the object, attached to this mesh I have a SrpingArm and attached to that spring arm I have a SceneCaptureComponent2D. I iteratively (in a For loop) rotate the spring arm to have a different viewpoint and then save the image that the SceneCaptureComponent2D is filming by using the UKismetRenderingLibrary::ExportRenderTarget function.
This works perfectly. However I am facing some issues when I want to iteratively add an SocketOffset to the SpringArm or change its TargetArmLength. What happen is that these parameters won't change in the loop.
If I run the loop, wait for it to finish, and run another loop then the TargetArmLength and the Offset would have change between the two loops but not within the loops. Even stranger, when I manually call the function that apply those changes (rotate the SpringArm, add a SocketOffset and change the TargetArmLength) and save the image then everything works as expected, but when I call this function in a For loop it doesn't. Which means that successively calling a function is somehow different from calling it in a For loop, and I don't understand how nor why.

It seems that, within the For loop, the scene doesn't get updated after the parameters changed. Which leads me to this question: When using a SceneCaptureComponent2D, how to be sure that the scene is up-to-date before exporting its RenderTarget into a png image ?

If you have any ideas what may go wrong, please feel free to tell, I've searching for a long time and I'm really running out of options right now. (ಥ﹏ಥ)

Thanks.

Product Version: UE 4.19
Tags:
more ▼

asked Sep 16 '18 at 09:28 AM in Rendering

avatar image

B.B.Fresh
6 1 2 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

My guess is that because it is in a loop, the loop does all its iterations before the next tick, and the next tick is what updates the scene capture to render again. So because it is all in a loop happening before the next tick the next tick doesnt happen for each loop and the render target doesnt update until after the loop is done.

That is just a guess but you can try using a separate index variable and running this every Tick and increment that variale so it loops over seceral ticks instead of all at once to see if my theory is correct.

more ▼

answered Sep 16 '18 at 08:48 PM

avatar image

mightyenigma
3.8k 18 20 20

avatar image B.B.Fresh Sep 18 '18 at 08:11 PM

Thank you for your answer. It does make some sense, I will try that.

avatar image B.B.Fresh Sep 22 '18 at 07:34 PM

It worked! Thank you very much. ( ͡° ͜ʖ ͡°)

avatar image mightyenigma Sep 24 '18 at 12:23 AM

I'm glad to hear it :) I wasnt sure but it seemed likely. please mark my answer as accepted and it will help others with this problem to find the solition faster

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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