Download

RHI help needed

Hello everyone. Total noob here. Here’s my problem :

I need to create a 2d editor.
It won’t follow a Slate-like convention, it’ll be more gamey (so no tabs).
It needs to be fast on the lowliest mobile device.
I need to be able to construct layers of arbitrary 2d geometry (this is what is being edited).
I don’t need much in the way of fancy materials. Some simple blending and masking.
I’d like my sprites to be able to attach to each other and inherit their parent’s matrix.
It needs to use UE4 :slight_smile:

Slate didn’t seem to be flexible enough (i could be wrong on this).
UMG doesn’t seem to be ready.
Paper2D doesn’t seem to have arbitrary geometry.
Canvas is far too slow.

So I’m looking at talking directly to RHI. I know. Right now I’m stuck trying to set the shader. I’m doing something like this (taken from from the Unreal source file BatchedElements.cpp)

TShaderMapRef<FSimpleElementVS> VertexShader(GetGlobalShaderMap(FeatureLevel));
TShaderMapRef<FSimpleElementPS> PixelShader(GetGlobalShaderMap(FeatureLevel));
SetGlobalBoundShaderState(RHICmdList, FeatureLevel, MaskedBoundShaderState, GSimpleElementVertexDeclaration.VertexDeclarationRHI,
	*VertexShader, *PixelShader);

The problem is at the link stage. It comes up saying

    error LNK2001: unresolved external symbol "public: static class FGlobalShaderType FSimpleElementPS::StaticType"

Am I wrong to use RHI at all? There doesn’t seem to be ANY examples of how to use it.
Sorry if this stuff has been addressed elsewhere.

If you have to ask the question, then yes.

The RHI is nearly the lowest abstraction level between the engine and rendering hardware. It is meant to hide away platform-specific rendering details but doesn’t provide any help beyond that. The reason your code is not linking is that FSimpleElementPS is not exported for external use (though FSimpleElementVS is, for some reason). You could use it if you insist, but you will have to reinvent the wheel, work against the engine rather than with it, and basically no one will be able to support you.