I’m trying to create a custom FMaterialShader so I can access material values in a custom full screen shader outside of the post-process steps.
I’ve got it working for the most part however I’m not getting correct/any values when I go to access the material properties.
This is what I have for the pixel shader, including bits that are used for testing. Right now I’m just trying to get the correct BaseColor result but that’ is wrong no matter what channels I use for it
void OutlinePS(
in float4 SvPosition : SV_POSITION,
out float4 OutColor : SV_Target0)
{
ResolvedView = ResolveView();
const float2 UVPos = SvPositionToViewportUV(SvPosition);
FMaterialPixelParameters MaterialParameters = MakeInitializedMaterialPixelParameters();
FPixelMaterialInputs PixelMaterialInputs;
// This is the call to the material graph
CalcMaterialParameters(MaterialParameters, PixelMaterialInputs, SvPosition, true);
float3 Colour = GetMaterialBaseColor(PixelMaterialInputs);
float Alpha = GetMaterialOpacity(PixelMaterialInputs);
float3 Emissive = GetMaterialEmissive(PixelMaterialInputs);
Colour = PixelMaterialInputs.BaseColor;
float4 ScreenPosition = SvPositionToResolvedScreenPosition(SvPosition);
float3 TranslatedWorldPosition = SvPositionToResolvedTranslatedWorld(SvPosition);
OutColor = float4(UVPos.xy, Colour.xy);
// OutColor = ScreenPosition;
// OutColor = float4(TranslatedWorldPosition, 1);
}
When I open it up in RenderDoc, I can see the input as I would expect, so it looks like it’s definitely sampling it but the result is the issue. I don’t know if it matters but RenderDoc is picking up the input texture as B8G8R8A8_TYPLESS
This is the input material that I’m using for testing
The texture is just a UV image on the R and G channels.
Anyone have any ideas?