x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

http://i.imgur.com/4D77A3i.png

Product Version: UE 4.9
Tags:
more ▼

asked Nov 10 '15 at 04:29 PM in Rendering

avatar image

arjanM
16 3 6 7

avatar image Roel Sep 13 '16 at 03:34 PM

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 ES2"

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.

alt text

untitled-1.jpg (831.6 kB)
avatar image Deathrey Sep 13 '16 at 05:43 PM

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

avatar image Roel Sep 19 '16 at 05:10 PM

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 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.

Here are the actual release notes: https://developer.apple.com/library/content/releasenotes/General/WhatsNewIniOS/Articles/iOS7.html#//apple_ref/doc/uid/TP40013162-SW1

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.

avatar image Deathrey Sep 23 '16 at 09:01 PM

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.

avatar image Roel Oct 24 '16 at 11:16 AM

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.

avatar image Deathrey Oct 24 '16 at 11:40 AM

I agree();

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question