Download

Render a camera view to a texture?

I kknow this was possible in udk, but can you also do it UE4? If so, how? It is a stationary camera (no rotation), that I want to just update periodically. Kind of like taking a snapshot of an rea of my screen in game. Is this possible?

Look into SceneCaptureComponent2D

Just a tip: If you want to spawn at runtime a TextureRenderTarget2D, you should look at Rama’s Victory plugin. There’s a node that does it for you, otherwise you will not be able to spawn it correctly with the common method inside the editor.

336467ea2a30b7ee5c2239cd2d123dfc86a1891a.jpeg

You should take a look at the Blueprints project from Epic and see how they do it with the Security Cameras.

If you create a TextureRenderTarget2D inside the level, you will not have the problem I mentioned above.

This same technique can be used for creating minimaps, as well as background images for UMG - I followed this (https://wiki.unrealengine.com/UMG_Mini-Map) information to create an animated background for menus.

Thanks for the tips. I will look into all of these.

What I am wanting to do is this:

I have created a mastermind style code breaker game. I want to have a “snapshot” taken of the player’s guess that would appear in small window in the corner of their screen that they could reference for their next guess. I figured the screen capture would be a good way to make this work.

I followed this tutorial, and it worked perfectly to get the camera to display to my umg. Only problem is, it updates in real time. Is there a way to make it update only when I tell it too? (i.e. player makes a guess, and hits “retry.” Can I then update the material to show the previous guess instead of running in real time?)

Yes… ish. I think. I’m green enough to know I don’t know the solution, but opposite of green to think I know where you’ll make your edits. I think it would be made in the camera object in your R2tex blueprint, though I coudln’t way where. Unless you had custom event controllers in the event graph powering when the camera is on, or in a hold state or some sort. Or, variables that check for whether certain decision have been met, and if those variables are true then to refresh camera.

Throwing ideas out, this is above my current weight class, but it’s a start!

I tried the boolean idea already. Problem is, once it is set to render the target2D, it won’t shut off without disappearing completely, which defeats the purpose. lol

Doesn’t it stop ‘capturing’ if you toggle visibility off? I think it does and holds the last frame.

It does stop capturing with the toggle visibility node, but I’m not quite sure how to set that up properly. I did a quick test on an event tick at the start of the test play, but I’m not sure how to set up to toggle it only at a certain time. Any advice?

Did you try set the SceneCapture2D Target to Null instead of toggling visibility?

I got the toggle working through a couple boolean variables connecting the on and off toggle.