Is Material function call LocalPosition supported for HTML5 packaging?

LocalPosition in materials is a function that returns the local coordinates of the object’s surface being textured/rendered.
However when I try to package the project for HTML5, I get:

  • LogShaderCompilers:Warning: Failed to
    compile blabla.mat for platform
    GLSL_ES2_WEBGL, Default Material will
    be used in game.

I got a sense that LocalPosition might not be supported for HTML5, can someone confirm that if this is a true limitation of the WebGL platform or did I do something wrong during constructing the material blueprint?

Hey yunyuzai,

When developing for the HTML 5 platform, you will be following along the same restrictions and limitations as the ES2 Mobile platform.

With that in mind, I looked into the LocalPosition function and only saw some ‘Absolute World Position’ nodes and that was about it, so I can’t see why it wouldn’t compile properly.

Let me know if you have further questions.

Thanks,

Thanks for the reply Andrew.

Below, I have created a very simple material that renders the floor directly based on its local position in the mesh:

This is what shows up in the editor, everything looks fine.

During the HTML5 packaging, I get the following warning:
LogShaderCompilers:Warning: Failed to compile Material /Game/M_LocalPosition.M_LocalPosition for platform GLSL_ES2_WEBGL, Default Material will be used in game.

And indeed, the render of the floor in the web browser shows the default material:

Can you try the similar testing sequence and see if it produces the same result?
I am running Unreal Engine 4.10.4. I suspect there is some bug not parsing the LocalPosition function properly to webGL code during HTML5 packaging.

So I just ran the test you provided in a new blank 4.10.4 project with the Target Platform set to Mobile/Tablet. I did not get the same warning message, but I did get a message associated with the LocalPosition function which can be seen below.

It seems the packaging process automated a change for me by enabling the ‘UsedwithStaticLighting’ option. Be sure the project you are using is set to use the Mobile/Tablet for the Target Hardware.

One quick question, are you using a Mac, PC, or Linux?

Thank you,

Hi Andrew,

Thank you for looking into this problem.

Sorry I forgot to mention about the OS, I am running it on Mac OS X
I have changed the targeted hardware to mobile/tablet

Still getting the same error:

May I know which OS did you run your test on?

The original test was run on a PC, but I just tested the exact same process on the Mac and got the same results as I did on the PC.

What OS X version are you running, and is this a blueprint or a code project?

Thanks,

Im running OSX Yosemite 10.10.5

82155-snip20160314_14.png

It’s a blueprint project and the followings are the material details:

The followings are the GL info displayed during build:

Also that can you look at the entire HTML5 packaging log, not just the build log.

We tested it again and still did not receive the warning message. What I suggest is adding a Feature Level Switch node to the material to see if that resolves the issue. Unfortunately, if we cannot reproduce this on our end there is not much we can do in terms of entering a bug report.

Looking at your Log RHI you are using a much different GPU then we have in our macs here, so that could be part of the issue. We are using the Nvidia 750M which doesn’t support the DX12, but your AMD R9 M370X card does.

Let me know if you have further questions.

Thank you,

Hi Andrew,
I’ve repeated the above steps on another Windows Desktop with fairly different hardware structures. I was able to reproduce the same warning/error: MainFrameActions: Packaging (HTML5): UE4Editor-Cmd: [2016.03.22-01.34.12:615][ 0]LogInit:Display: LogShaderCompilers:Warning: Failed to compile Material /Game/LocalPositionM.LocalPositionM for platform GLSL_ES2_WEBGL, Default Material will be used in game.

83291-capture2.png

System running is Windows 8.1

Hey yunyunzai,

I was finally able to get the material warning to appear in the version you mentioned by using the Shipping configuration, which I am assuming you were using as well?

However, I tested this issue in the 4.11 preview 8 release and it did not appear in that version. Would you mind testing to confirm this is true on your end?

Thank you,

I tried the same settings in 4.11.0 Preview 8. Seems the problem is still there:

Are you running development or shipping build configuration?

Tried both development and shipping build, all have the same warning.

I have noticed something when testing this issue, as I was also able to get it to reproduce in 4.11. The issue only appears for me when there is starter content involved in the project. Otherwise, there is no error that appears in the Output Log when packaging.

Check to see if this error still occurs when you package without starter content, and if it doesn’t occur I will add that to the bug report.

Thanks,

The warning happens even without the starter content For me.

Tested on Windows 8.1 UE4.11.0 Preview 8

Hey yunyunzai,

I really appreciate your patience while testing this issue, as I know I asked you to test the same thing multiple times. I was unable to determine whether this was expected or not, so I went ahead and entered a bug report for the issue (UE-28770).

With that being said, once the developers and engineers determine if the issue is in fact a bug, they will begin getting a fix in place. When the fix has been implemented, either myself or another team member will return here with the update.

Let me know if you have further questions.

Regards,

While the original bug still exists, I think I figured out a way to bypass this issue after seeing the newest “How to use the Custom Material node and create Metaballs” Youtube video and learned about custom material nodes (I’m only 1 month into Unreal Engine 4)

Basically, I replaced the LocalPosition node with a custom material function node containing the code:
mul(float4(GetWorldPosition(Parameters), 1), Primitive.WorldToLocal).xyz;

And then the HTML5 packaging went smoothly without warnings:

And I am able to see the material shaded in the HTML5 canvas: