Hello,
I have a problem, I would like to configure an UPostProcessComponent in C++.
How can I add an default material to “Post Process Materials”?
And I also would like to render a particles system on the surface of a mesh using UPostProcessComponent.
How can I do that?
The code I have for now for constructing the actor:
// Make components.
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
PostProcessComponent = CreateDefaultSubobject<UPostProcessComponent>(TEXT("PostProcessComponent"));
PostProcessComponent->SetupAttachment(RootComponent);
// TODO: How to set material?
PostProcessComponent->bUnbound = 1;
Thank you very much for your help.
Hello again,
I managed to have a code for the UPostProcessComponent in C++:
// Make components.
RootComponent = CreateDefaultSubobject(TEXT(“RootComponent”));
PostProcessComponent = CreateDefaultSubobject(TEXT(“PostProcessComponent”));
PostProcessComponent->SetupAttachment(RootComponent);
// Settings.
PostProcessComponent->bUnbound = 1;
static ConstructorHelpers::FObjectFinder<UObject> DefaultMaterial(TEXT("/Game/PostProcess_02.PostProcess_02"));
if (DefaultMaterial.Succeeded()) {
PostProcessComponent->Settings.AddBlendable(DefaultMaterial.Object, 1.); // 1. ?
//PostProcessComponent->Settings.Blendables_DEPRECATED.Add(DefaultMaterial.Object); // Doesn't work, why?
}
And to render a particle system on the surface of a mesh, I’m using a RenderTarget and USceneCaptureComponent2D but the issue is the color isn’t the same as with the player camera, the lighting is different, some parameters to tweak.
How can I configure the RenderTarget and USceneCaptureComponent2D to have the same image as the one produced by the player camera?
Sincerely.