SceneCapture2D strange behavior with CaptureEveryFrame off

hi,

I have a SceneCapture2D set to capture my level’s landscape frop a top-down view, on which I use a postprocess blendable material to capture the WorldNormals.

everything is set up fine and it does what I want already, but my postprocess material is very complex (slow) so I want it to be semi-static: it should capture once when the game starts and keep it. for editor time I’d need it to be toggleable between real-time capturing and stopping the capture but also keeping the last capture.

now the problem. if I disable CaptureEveryFrame, it’s as if for one frame it captures the scene with my blendable postprocess material turned off. therefore I cannot keep the last capture that I made, I just get a regular FinalColor capture.

in short, if you disable the capturing you’d expect it to stay in exactly the last state it was, but it doesn’t.

is this a bug?

before someone suggests it, I really don’t want to use ‘Create Static Texture’ out of the rendertarget - I stil want the dynamic rendertarget because, like I said, I need it to be toggleable.

thanks,

Chosker

1 Like

I just found this and tried it: https://answers.unrealengine.com/questions/227853/screencapture2d-snapshot-with-post-processblendabl.html

so basically all I had to do was, in my level BP’s BeginPlay I take the SceneCapture2D’s component and SetCaptureEveryFrame to true, and then deactivate it.

with this I managed to get what I need except for one thing: in the editor I cannot get the capture to be kept with my blendable if I turn off CaptureEveryFrame

Hello Chosker,

I am glad you found someone with a similar solution. If you read BhaaL’s response he responds with a warning to not Set “Capture Every Frame” to false. Instead he only deactivates the Scene Capture.

What is occurring is the CaptureEveryFrame is overriding the previous capture. I believe you would need to create a place for this capture to be assigned to/saved. So, create an event on play that deactivates the screen capture along with saving the frame when it is deactivated. From there you would need to somehow assign the screen shot to the 2D capture.

If you get confused please post again and I will continue to assist you further.

hello , thanks for following up.

like I said I added enough stuff in my BeginPlay to account for all the gameplay cases: first I activate the SceneCapture2D, then I tell it to Capture Every Frame (so it doesn’t matter if it was set to true or false), and then I deactivate the SceneCapture2D.

in-game, everything works.

the problem is still at editor time. I’d still like to be able to turn on the capturing, let it capture, then turn if off and keep the capture. right now this is impossible.

is it possible to get this behavior?

From what I just said you should be able to create a place for the capture to persist when you deactivate the SceneCapture2D. As far as persisting after the Capture2D is then re enabled I don’t believe that is possible without writing your own code and editing the engine itself. This feature does not come standard.

sorry I don’t get it.

maybe you misunderstood. when I turn off the capturing and then back on, I don’t need to keep that old capture. as soon as the capturing is back on I’m good with the new data. I just need, at editor time, that when I turn it off it doesn’t get lost.

so I don’t need to create a place for it to persist. the very same rendertarget is fine.

and how do I even deactivate it in the editor? I see no button/property/flag to deactivate it in the editor (there’s AutoActivate which only affects the game, and then there’s CaptureEveryFrame which does deactivate it at editor time but produces the undesired result of losing the capture’s blendables)

Sorry, I thought I understood what you meant and after further clarification I believe I have a solution for you.

You are having a problem getting what you want in the Editor itself (not while you are playing the game). Any Post Process Blendable can be added to an active render thread. The problem with turning off the Capture Every Frame is that you are literally taking a single snapshot and the Post Process Blendable cannot be added. This is why you have to use the workaround mentioned in the other Answerhub question. With Capture Every Frame turned on, the editor now has an active rendering thread to add something to. The real issue is that Scene Capture’s will not always update on Event Begin Play one time, if the Capture Every Frame is turned off, so for what you want you should just turn on Capture Every Frame, get the location, FOV, etc that you want in the editor then turn it off. Then using the workaround from the other Answerhub, call an update event on Event Begin Play.

Currently this is a workaround and not an actual feature that comes standard with UE4. I can enter a feature request for you for implementation. I do not have a time table for when or if this will be an actual feature but I can enter it for consideration.

I think we’re still not on the same page.

you’re right, I’m still having a problem getting what I want in the Editor itself, and the game is fine.

The problem with turning off the
Capture Every Frame is that you are
literally taking a single snapshot and
the Post Process Blendable cannot be
added.

but why if I turn on CaptureEveryFrame it works, and then when I turn it off I still have a snapshot, but without the blendables?

The real issue is that Scene Capture’s
will not always update on Event Begin
Play one time, if the Capture Every
Frame is turned off,

what Event Begin Play? this is only Editor behavior.

so for what you want you should just
turn on Capture Every Frame, get the
location, FOV, etc that you want in
the editor then turn it off.

that’s exactly what I did since the beginning. I put my SceneCapture2Dactor manually with the right location and FOV, turn on CaptureEveryFrame and see how it captures it correctly, and the I turn off CaptureEveryFrame and the ‘frozen’ capture comes without the blendables.

I hope it’s more clear now. based on your response it seems the behavior is indeed a bug.

cheers

Ok,

" I put my SceneCapture2Dactor manually with the right location and FOV, turn on CaptureEveryFrame and see how it captures it correctly, and the I turn off CaptureEveryFrame and the ‘frozen’ capture comes without the blendables."

When you are capturing in real time, your captures are constantly updating. Think of it as a movie reel. All your frames are constantly updating creating one long seamless render that is then displayed in your editor. Your calculations for rendering are as follows: Base Pass > Scene Capture > Post Process (Since this is a separate pass and is calculated last, this allows for AA and other such features in PP to be calculated on another pass separate from your base and after all other calculations) > Display back to you. When you take that Scene Capture it takes a caption of that one frame before the Post Processing. This is why high resolution screenshots look so mucky when using AA. That screenshot is calculated on another pass before the post processing takes affect.

Now, the fact that this is working in Play but not with Slate is a little puzzling. If you are willing to share a test project where this is still occurring then I can take a better look at what is actually going on and determine whether this is a bug with UE4.

Thanks,

I see.

maybe the reason it works in game and not in editor is the difference in the procedure:

  • Game: Enable the SceneCapture2D component → enable CaptureEveryFrame → call UpdateContents → Disable the SceneCapture2DComponent

  • Editor: enable CaptureEveryFrame → disable CaptureEveryFrame

sadly in the editor there’s no option to disable the capturecomponent (as there is ingame)

in any case I’ll make a test project to you can check it out yourself

thanks

I made a test project: Page not found | Elium – Prison Escape

open SceneCaptureTestMap, select the SceneCapture2D actor, turn off CaptureEveryFrame, see how the capture gets frozen without the blendables.

I didn’t make the ingame part but if you want to test ingame (and see that the ‘frozen’ capture still includes blendables), just add to the level blueprint: event BeginPlay → get the scenecapture component from the scenecapture actor → enable CaptureEveryFrame → call UpdateContents → disable the scenecapturecomponent

this is in 4.10 btw

thanks

If you would provide a screenshot of exactly how you have your blueprint setup to disable the scenecapturecomponent. That way I can reproduce the PIE part without any discrepancies between our projects.

I am able to see the scene capture freeze without the blendables when disabling CaptureEveryFrame in the Editor.

sure here it goes. this is my level blueprint

but I don’t see why you need this, as the problem isn’t in-game :slight_smile:

since you’re able to see the scene capture freeze without the blendables now, can this be filed as a bug?

1 Like

This could be a bug I just want to make sure I have any and all information so that when/if this issue is reported it can be handled quickly and thoroughly.

hello,

any news on this?

I tried to apply the workaround at editor time but it doesn’t work. In-game it needs a timer (to wait one frame) and in the editor the BP ConstructionScript cannot use a Delay and a Timer just doesnt work.

this feature is an integral part of my workflow for procedular stuff. was the feature request added?

Hi Chosker -

For reference, this issue has been reported as UE-28468 and currently is still being triaged and investigated by our engineers. As soon as we have any additional information, we will report back here.

Thank You

Eric Ketchum

hello,

as of 4.13 there’s been a regression that makes this problem worse. my previous workaround was to disable the SceneCapture2D component from BP after the capture was done, but this no longer works at editor time.

all workarounds I’ve tried (as suggested by Daniel Wright) prove ineffective.

as I’ve shown in this thread, the code that handles PostProcess Blendables seems to have been designed to never work unless bCaptureEveryFrame is enabled.


like I mention there, I also tried to modify the code to keep the ViewState alive in cases where a single frame is needed and destroy the ViewState after the capture, and this was effectively fixing the issue.

I can provide this code but I can’t really use it for myself - I only tried it at work, but I’d still need a proper solution out of the box as I strictly stick to precompiled engine releases for my projects at home.

Bump!

Is there any update on that?