(39) 's Extra Blueprint Nodes for You as a Plugin, No C++ Required!

Hello ,

I’m trying to save a texture from a RenderTarget to a file. Used the C++ function to create a T2D from a RT and then used your VictoryGetPixelsArrayFromT2D and VictorySavePixels, but the file looks really weird and I guess it has to do with the compression you mentioned. However I can’t deactivate it, only choose between different settings like VectorDisplacementMap, Default DXT1 etc.). Where did you find the “Turn off compression” option?
When I use the engine function CaptureComponent2DSaveImage it works as it should except I get a HDR file I can’t work with, because I haven’t found a way to import it.

Edit:
Okay i got it finally working…
Instead of using a RenderTarget from the engine which always uses compression, I just generated it with C++ with the correct PixelFormat:



UTextureRenderTarget2D* blah::CreateRenderTargetBGRA8(UObject* outer, int32 TexWidth, int32 TexHeight)
{
	UTextureRenderTarget2D* newRT = NewObject<UTextureRenderTarget2D>(outer);
	newRT->InitCustomFormat(TexWidth, TexHeight, EPixelFormat::PF_B8G8R8A8, 0);
	return newRT;
}


and used to create a T2D from a RT2D


UTexture2D* bla::RenderTargetToTexture2D(UObject *outer, UTextureRenderTarget2D* target)
{
	target->CompressionSettings = TextureCompressionSettings::TC_MAX;
	target->CompressionNone = 1;

	UTexture2D* CreatedTexture = target->ConstructTexture2D(outer, "", EObjectFlags::RF_NoFlags, 0, 0);

	CreatedTexture->CompressionSettings = TextureCompressionSettings::TC_MAX;
	CreatedTexture->MipGenSettings = TextureMipGenSettings::TMGS_NoMipmaps;
	CreatedTexture->LODGroup = TextureGroup::TEXTUREGROUP_UI;
	CreatedTexture->Filter = TextureFilter::TF_Nearest;
	CreatedTexture->CompressionNone = 1;
	return CreatedTexture;
}