Hi
So i’m trying to send the output render from Composure to my actor. I’ve got a class called PointerCompositingOutput which is a subclass of UCompositingElementOutput, where i can put my class as the output for Composure. It overrides the function responsible for handling the final render, and i’m setting the variable in my pawn object reference. I’m getting my reference to my actor in my scene through a TSoftObjectPtr.
In the BP of the pawn that PointerCompositingOutput sets, i did a GetMemorySize print result is 33177600. And printing IsValid, it returns false for a frame then returns true.
But when pressing play, i don’t see my image. In my widget im checking if it’s valid, if it’s not valid it uses an image from the content browser. The debug image works and does show up
Within my function, there are 2 if statements, it will either set the UTexture to the pawn or save it as an exr file. I can verify that the images it outputs is indeed the image i expected to see.
Within the if statement that sets the variable on my pawn, I’ve also bypassed my bool and have it set the variable every tick, but it doesn’t change the result.
cpp function override that handles composure UTexture
void UNcPointerCompositingOutput::RelayOutput_Implementation(UTexture* RenderResult, UComposurePostProcessingPassProxy* PostProcessProxy)
{
ComposureRender = RenderResult;
UWorld* World = GetWorld();
UTexture* OutputImage = RenderResult;
//Set variable of Pawn
if (TargetActor.IsValid() && IsValid(RenderResult) && !WriteExrFiles && !stopSetting)
{
TargetActor->setTextureVal(ComposureRender);
stopSetting = true;
UE_LOG(LogTemp, Display, TEXT("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!its been set!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"));
}
//save Texture as EXR. Code copied from CompositingElementsOutput.cpp
if (World && World->IsGameWorld() && WriteExrFiles) // Check if its in play mode or in editor mode
{
if (OutputImage && !OutputDirectiory.Path.IsEmpty() && !FilenameFormat.IsEmpty())
{
bool bShouldCapture = false;
if (FrameNumber == 0)
{
bShouldCapture = true;
}
else
{
SecondsSinceLastCapture += FApp::GetDeltaTime();
bShouldCapture = SecondsSinceLastCapture >= OutputFrameRate.AsInterval();
}
if (bShouldCapture)
{
FImageWriteOptions WriteOptions;
WriteOptions.Format = EDesiredImageFormat::EXR;
WriteOptions.bOverwriteFile = true;
WriteOptions.bAsync = true;
WriteOptions.CompressionQuality = (int32)Compression;
const FString FrameIdString = FString::Printf(TEXT("%04d"), FrameNumber);
FString Filename = FilenameFormat.Replace(TEXT("{frame}"), *FrameIdString);
UImageWriteBlueprintLibrary::ExportToDisk(OutputImage, OutputDirectiory.Path / Filename, WriteOptions);
++FrameNumber;
SecondsSinceLastCapture = 0.0;
}
}
else
{
InternalReset();
}
}
}
pawns setTextureVal function
void AVirtualProductionPawn::setTextureVal(UTexture* Tex)
{
ComposureOutputRenderUTexture = Tex;
}
I’m very lost on this as i’ve spent nearly 2 days trying to figure this out, it also seems to fail when i cast the UTexture to UTexture2D in my pawns BP. Is there some formatting the UTexture that i could be missing?
Ultimately i’m looking to make my UTexture into a TArray as outlined in this glorious post.