Best path forward to get displacement mapping working on iOS?

Hello all,

Fairly new to the unreal world. I’ve done my homework and see that displacement mapping is officially not supported (yet) on iOS. I understand this is because of the render path within the engine uses DirectX Tessellation which causes support issues on the backend after the HLSL is converted to GLSL via the crosscompiler. I would like/need displacement to work on iOS, the question is which of the follow do the masses think is the best route?

  1. Extend the cross compiler to support a “custom” shader path to the primitive GLSL that is available in iOS7, ie: make the crosscompiler able to generate code that mimics Listing 10-10 here:

https://developer.apple.com/library/ios/documentation/3ddrawing/conceptual/opengles_programmingguide/BestPracticesforShaders/BestPracticesforShaders.html

  1. Implement a plugin that a BP can tie into on iOS to achieve a displacement (not sure how this plays with the material system).

  2. Wait for it to get fixed and supported by UE4

  3. Other?

Thanks in advance! My main goal since I am new to this, is mainly see if I am on the right track, or someone can tell me #4 and point me to the thing I have missed.

Displacement mapping is a Shader Model 5 feature and iOS devices are still on OpenGL ES2 which corresponds to less than Shader Model 3, so the hardware support isn’t there. Or is there some extension I don’t know about? I don’t believe tessellation is supported even in OpenGL ES3, which is what the newer iOS devices support.

Maybe? This may be a lack of knowledge on my part, I totally agree that tesselation is not supported but I think vertex lookups are as of ios 7:

Textures can be accessed in vertex shaders in both OpenGL ES 2.0 and 3.0. Query the value of the MAX_VERTEX_TEXTURE_IMAGE_UNITS attribute to determine the exact number of textures you can access. In earlier versions of iOS, this attribute always had a value of 0.

Since I imagine the ue render path is rooted in needing tesselation, I assumed this was the issue. Also trying to learn more about HLSL (I’ve always tinkered with glsl in iOS, never had a call to use hlsl on a desktop) All this leads me back to my original question, if vertex fetch is available what’s the best route to use it?

Tessellation is not really an important feature in UE4, in fact the performance of it is pretty terrible on high end GPU’s.

Vertex texture fetch is a completely different feature, that can be useful for artists to use in World Position Offset inputs. Right now the engine assumes no IOS support, you can remove the error here

FHLSLMaterialTranslator::TextureSample

if (ShaderFrequency != SF_Pixel
&& ErrorUnlessFeatureLevelSupported(ERHIFeatureLevel::SM4) == INDEX_NONE)
{
return INDEX_NONE;
}

Sorry for the slow reply. My time to poke at UE is an evening hobby. Since your last reply pointing me to that if statement above, I have learned much about the inner workings of the engine. I was able to fix the incorrect error flag, and actually get world displacement to work within the Mobile Preview within the engine! Progress!

Sadly though I found my success short lived. Since the mobile preview actually is using just a subset of the desktop OpenGL pipeline (which makes since). When I try to target and run on an actual iOS device, I get a compile error out of the common.usf shader.

It almost looks like the hlslcc currently doesn’t support it either.

So my question is: Is World Position offset a feature for iOS that is going to be supported eventually? If so is it in the pipeline for soon? If it’s not, I have a new code base to go absorb and see how hlslcc works.

Bump: Will world position offset be a supported feature for iOS any time soon?