Vertex texture sampling?

We have a problem that we can’t seem to figure out (and are having trouble working around due to lacking or simply no documentation on the subject when it comes to the build in custom node (HLSL) or creating custom C++/USF shaders/materials)

We are trying to sample colors from a texture on only the uv position of the vertex (ala tex2Dlod inside a vertex shader), so rather than the texture sampler sample along the surface of the polygon we want it to use the sampled colors at the vertex position to fill the surface color of the polygon.

So if the vertices on example image 1 where to be sampled, rather than have the usual pixel shader texture sampling return a polygon as example image 2, we want it to return a result like example image 3.

Can anyone steer us in the right direction.

I tried doing this using the following function in a custom node:

return Texture.SampleLevel(TextureSampler, UV, 1);

It works, but not on ES2. It says:

“Sampling from vertex textures requires
an absolute mip level on feature level

But I do give it an absolute value…

If anyone has a solution for this, please let me know! I did get this to work on mobile in GLSL on a Galaxy S4, so there should be a way to do this on mobile.

As far as I know, vertex texture fetches are unavailable on mobile

That’s not what they are saying in the Apple release notes for iOS 7:

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

Here are the actual release notes:

and since iOS 7 in really old, I can’t see why it still is not working / what I might be doing wrong.

If there is an issue with compatibility in Android just make sure the MAX_VERTEX_TEXTURE_IMAGE_UNITS is an easy accessible in both C++ and Blueprints or maybe even a switch node in the material editor.

Yep, iOS 7 and above supports vertex texture reads. In my previous comment I sort of relayed a quote from here and meant that UE4 does not support that, at least via material editor. Not sure if it is a bug in cross compiler or intended. Might be the latter option, because VTF is optional in ES 2.0 specifications so its support varies between devices and manufacturers greatly. Not sure about ES 3.0.

I can see why it is not supported on certain mobiles, it would just be great if there was a switch for it in the material editor instead of just ES2 and ES3. There are probably ways for the engine to figure out if it is supported with disqualifying all ES2 devices.

I agree();