I’m following a custom .usf post process tutorial and looking for some help in working around the need to edit the engine.
The tutorial calls for an additional block of code in FDeferredShadingSceneRenderer::RenderFinish to call this function:
void RenderMyTest(FRHICommandList& RHICmdList)
{
//Get the collection of Global Shaders
auto ShaderMap = GetGlobalShaderMap(ERHIFeatureLevel::SM5);
//Get the actual shader instances off the ShaderMap
TShaderMapRef<FMyTestVS> MyVS(ShaderMap);
TShaderMapRef<FMyTestPS> MyPS(ShaderMap);
//Declare a pipeline state object that holds all the rendering state
FGraphicsPipelineStateInitializer PSOInitializer;
PSOInitializer.PrimitiveType = PT_TriangleStrip;
PSOInitializer.BoundShaderState.VertexDeclarationRHI = GetVertexDeclarationFVector4();
PSOInitializer.BoundShaderState.VertexShaderRHI = MyVS->GetVertexShader();
PSOInitializer.BoundShaderState.PixelShaderRHI = MyPS->GetPixelShader();
PSOInitializer.RasterizerState = TStaticRasterizerState<FM_Solid, CM_None>::GetRHI();
PSOInitializer.BlendState = TStaticBlendState<>::GetRHI();
PSOInitializer.DepthStencilState = TStaticDepthStencilState<false, CF_Always>::GetRHI();
SetGraphicsPipelineState(RHICmdList, PSOInitializer);
MyPS->SetColor(RHICmdList, FLinearColor::Blue);
//Setup the vertices
FVector4 Vertices[4];
Vertices[0].Set(-0.01f, 0.01f, 0, 1.0f);
Vertices[1].Set( 0.01f, 0.01f, 0, 1.0f);
Vertices[2].Set(-0.01f, -0.01f, 0, 1.0f);
Vertices[3].Set( 0.01f, -0.01f, 0, 1.0f);
//Draw the quad
DrawPrimitiveUP(RHICmdList, PT_TriangleStrip, 2, Vertices, sizeof(Vertices[0]));
}
I would prefer to use ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER macro or equivalent, it looks like that’s the right way to go about avoiding the engine edit. I’ve added a call within a tick in my GameMode and it looks like this:
void AMyGameModeBase::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
ENQUEUE_UNIQUE_RENDER_COMMAND_ONEPARAMETER(
FPixelShaderRunner,
ASunriseParallaxGameModeBase*, PixelShader, this,
{
check(IsInRenderingThread());
FRHICommandListImmediate& RHICmdList = GRHICommandList.GetImmediateCommandList();
RenderMyTest(RHICmdList);
}
);
}
The ‘RenderMyTest’ function is being called in this scenario but the post process isn’t being rendered.
Thanks!
Andrew