I’m trying to save the velocity map in GBufferVelocity by using SceneCaptureComponent2D, but as a new Unreal user, I’m not really sure how I should proceed:
- So the most natural way for me would be create a post processing material and use it as an blendable in SceneCaptureComponent2D
However, similar attempt failed using the Material Editor creating the post-processing material: (page 2 with the following HLSL code):
MaterialFloat2 UV = MaterialFloat2(ScreenAlignedPosition(Parameters.ScreenPosition).xy);
FScreenSpaceData ScreenSpaceData = GetScreenSpaceData(UV, false);
return ScreenSpaceData.GBuffer.Velocity.xy;
Basically he tried to read the ScreenSpaceData for UV, but he failed (neither did I suceed using the same workflow).
The question is, is there a node similar to Scene Depth node for the velocity?
- Since it is not working too well, writing a material shader and then including all the required header files.
I was wondering, what the best example for writing post processing materials by using C++ is?
- The other possible way that I thought of is to override the rendering code for SceneCaptureComponent2D.
Is there a way to add effects similar to a post processing pass instead of just a blendable?
Or what is the equivalent function in for
void FPostProcessing::Process(FRHICommandListImmediate& RHICmdList, const FViewInfo& View, TRefCountPtr<IPooledRenderTarget>& VelocityRT)
in SceneCaptureRendering.cpp?
- Or maybe I’m doing this totally wrong, and I should just some how save the ScreenSpaceData.GBuffer.Velocity.xy; using a shader in the rendering thread?
Any help would be appreciated, thanks!