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"

Is it possible to have a particular material not use half floats on Mobile?

Hi,

We have a particular material that renders fine on PC but is really low res on Mobile. My understanding is that mobile uses half floats in the pixel shader. Is there anyway to turn this off for a particular material?

Is the use of half floats a hardware limitation or is it just a performance optimisation? If there's no current way to turn this off could you please point me in the right direction so I might be able to implement it myself?

Regards,

Ryan.

Product Version: UE 4.11
Tags:
more ▼

asked May 15 '16 at 11:56 PM in Rendering

avatar image

LuaChunk
95 8 10 33

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

1 answer: sort voted first

Hi Ryan,

Some older devices don't support full precision floats at all. For those that do, full floats are generally half the speed of half floats, but we realize there are cases where you want to eat the cost, and we have a feature request currently slated for 4.13 that will enable you to turn on full precision on a per material basis. The ticket for that is UEMOB-109.

In the interim, you could try use the "CustomUV" feature of the material system which lets you perform calculations in the vertex shader and send the results to the pixel shader, which does allow you to work around a lot of precision issues.

  • Jack

more ▼

answered May 16 '16 at 10:35 AM

avatar image

JackP_oldaccount
1.3k 37 11 48

avatar image LuaChunk May 16 '16 at 10:51 PM

Hi Jack,

I plan to only run this particular material on iOS devices that support Metal.

I've tried using custom UVs, but I need more floats than I can fit into 3 custom UV slots and my understanding is I can't have more than 3 custom UVs on Mobile. Also, some of the calculations I need to do are on values pulled from texture samples.

Would you be able to point me to the code that forces half floats. I might be able to hack something in while I wait for 4.13.

Cheers,

Ryan.

avatar image JackP_oldaccount May 17 '16 at 02:07 AM

There's a define in the shader code (Engine/Shaders/*usf files) FORCE_FLOATS. You could modify Common.usf and so it's set to 1 rather than 0 when it's not defined:

 #ifndef FORCE_FLOATS
 #define FORCE_FLOATS 1
 #endif

There's no way to do that on a per-material basis yet. The best way to do that would be to add code to FHLSLMaterialTranslator::GetMaterialEnvironment to set the define based on an FMaterial property, which would map to a UMaterial checkbox. The ShouldGenerateSphericalParticleNormals() virtual function is an example of how to get to a UMaterial checkbox from the FMaterial.

avatar image LuaChunk May 27 '16 at 12:58 AM

Thanks Jack! That all worked.

I'm having one other issue with a material / render target on mobile. I created a new question for it here. If you could take a quick look that would be great!

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
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