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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to render a scene capture from a commandlet


I've been trying to use the SceneCaptureComponent2D to generate a thumbnail (saving to png) from a static mesh given as input in a commandlet and so far cannot figure out how to get it to work.(I can get it to work fine in the editor or PIE).

What I've tried:

  • set up a blueprint which has the capture component, a background and references a static mesh directly.

  • put it in a small level

  • made the scene capture occur on construction

  • created a blutility to spawn from the commandlet (I couldn't do this with an actor directly as CallFunctionByNameWithArguments fails for them in a commandlet, hence the extra step)

  • using the blutility functions load the level (which does scene capture on start - or begin play, tried both)

  • spawning the actor and trigger the scene capture instead of the above step produces the same result

The result: I get a png image, but it's all black. When I run this in editor it works and I get a thumbnail I expected.

I start the commandlet with AllowCommandletRendering, there's no errors or warnings and I didn't spot any suspicious early exits in USceneCaptureComponent2D::CaptureScene while debugging.

Tried adding lights to the scene and blueprint, setting GI on scene capture component - case it was just complete darkness, but no change. Object positioning part most likely works fine as same input will work outside of the commandlet.

Attached some screengrabs (in 3rd screenshot there's 2 different ways to start the thumbnail generation depending on where the exec pin goes) and the packed plugin to better illustrate setup.

alt text alt text alt text

Product Version: UE 4.20
constrscript.png (110.0 kB)
createthumb.png (136.2 kB)
blutility.png (151.3 kB)
more ▼

asked Oct 05 '18 at 08:55 AM in C++ Programming

avatar image

1 1 1

avatar image rwpiotr Oct 09 '18 at 04:48 AM

I've been told trying to render on construction is unlikely to succeed as the world isn't initialized yet (and this behaves differently in editor which lead me to believe it could work) so this could be the issue in this approach. It doesn't appear that Begin Play happens in a commandlet though - finding a way to force finish load/initialize on-demand might solve it (but I'm neither certain on that nor know how to do it). The 'create object directly without the level' approach still fails. Interestingly creating an object directly after loading a level crashes.

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

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