I’m attempting to pass the output of one material into another but am struggling to find the right combination of code to accomplish this. Perhaps I’ve got the wrong impression about Render Targets.
My thoughts, however wrong they might be, have been to do the following:
- Generate UTextureRenderTarget2D owned by the UObject that’s running this code
- Draw the “input material” to it. This material plugs to the EmissiveColor.
- Later, I create an instance of the “output material”, passing the render target I created in steps 1 & 2 as a parameter
- Draw the output material to another target
// A UTextureRenderTarget2D* UPROPERTY() on the class
RenderTarget = UKismetRenderingLibrary::CreateRenderTarget2D(this, 512, 512);
UKismetRenderingLibrary::DrawMaterialToRenderTarget(this, RenderTarget, InputMaterial);
// ...
// Later on
UMaterialInstanceDynamic* OutputMatInstance = UMaterialInstanceDynamic::Create(BaseOutputMaterial, this);
OutputMatInstance->SetTextureParameterValue("NamedTextureParameter", RenderTarget);
ProceduralMesh->SetMaterial(0, OutputMatInstance);
However the results are not what I expect and quite poor. It’s hard to tell what it should be.
Expected:
As it looks from the “Input Material”
Current Result:
Plugged into the Base Color and rendered in Unlit
Questions:
- Does the
DrawMaterialToRenderTargetuse the Base Color or Emissive channel? Both? Hard to tell. Perhaps it’s all based on the lighting model but I’ve tried changing it to Unlit on the input material to no avail. - Is there a more standard approach for this sort of thing? The idea is the entire flow is contained within code to make it portable and not require any manual editor hookups.

