Textures not displaying properly in WebGL build

Hello, we are currently working on adding web support to our application and are struggling with an issue where the textures and lighting of a 3D model are not displaying properly in a WebGL build. The top image is what we see in the editor, the bottom is what we see in the build.

Some additional info:

  • All models are loaded from an asset bundle

  • All textures do not have any import settings overwritten for WebGL and are set to the default “Low Quality” compression level.

  • Mip maps are enabled

  • The Standard Specular shader is used

  • All models have a main texture and a normal map

  • The transparent skin is not a transparent texture but instead faded down using the alpha value of the albedo color

  • We are using Unity 2017.1.0p3

If y’all have any idea what might be causing this I would appreciate any help you can give.

Which browser? If it’s Chrome/Firefox, maybe try Edge/Safari.
Any shader error in the browser log?
You could also try to have a look at in in Spector.js

We have the same issue in all browsers that we’ve tested (Chrome, Firefox, Safari). No shader errors in the log, but ill look into using Spector.js

I looked at the Spector.js snapshot, but am not familiar with OpenGL enough to be able to get any usable information from it. Nothing jumps out as being a cause of the issue, just that everything is still rendering incorrectly in the capture buffers.
The link to the capture output is capture 12_02_17.json - Google Drive if anyone is interested.

So I believe I might have found the solution (or at least a workaround). The issue was with the normal maps, and switching the Texture Type on the import settings from ‘Normal Map’ to ‘Default’ fixed the issue. My hunch is that under the Default type RGB compression is used while under Normal Map on RGBA compression options were available which is something we don’t need.

This fix does however make me nervous as I would assume that the Normal Map setting would be correct and Im afraid that we will be missing out on something by using the Default texture type. Additionally all of our materials would have a message on them saying “This texture is not marked as a normal map Fix Now” even though clicking that button would actually break our web builds.

Does anyone have any input on this? This seems like a workaround and I’d like to have a proper fix in place for this issue. Some additional info on the normal maps themselves they are exported from 3DCoat into photoshop which then exports them as jpgs.

1 Like

I have to necro this thread, as I seem to have the exact same problem, but only when I’m doing a WebGL build that loads the assets via the addressables system.

Putting all normal maps into “default import” mode seems to kind of work (with small artifacts here and there) but this surely can’t be the solution, right?!

3 Likes

I have the same problem. Is there a solution better than found?

2 Likes

Only sensible solution for me was exchanging the standard shader on everything that has normal maps with Legacy Shaders.

@Marco-Trivellato
Any other ideas how to get Standard Shader/Uber running again from bundles?

There is a known issue that exporting to WebGL may incorrectly compile shaders in relation to using compressed texture formats if the shaders are present in the “Always Included Shaders” list in Project Graphics settings. Not sure if that is the bug here, though you can try checking if the badly rendering shaders in question are in the “Always Included Shaders” list, and if so, try removing them from there.

I am also posting and following the thread you mean, but this also happens for us if the shaders are used on objects in asset bundles. So this is kind of the same problem, but has nothing to do with the always include list as far as I can tell.

@jukka_j
Edit: I just sent you the link to the open issue where I submitted a mini project with said problem.

There is an official issue in the tracker now: Unity Issue Tracker - [WebGL] Normal maps are inverted when loading a scene asynchronously using Addressables

Whoever finds this thread, please upvote the issue so it gets fixed. :confused:

@jukka_j Is there maybe a potential fix estimation on the horizon? Or any other news? :slight_smile: Thanks!

@jukka_j @unity_bill @Marco-Trivellato Any news on this front? Any other workaround? :confused:

@jukka_j @unity_bill @Marco-Trivellato ???

1 Like

@jukka_j @unity_bill @Marco-Trivellato Sorry if this is annoying, but I wanted to check if there’s any new information on this? This is a very important issue for my company.

@jukka_j @unity_bill @Marco-Trivellato what is going on? why you all left webgl section?

1 Like

Hate to keep “necro”-ing this thread…but I am running into the same problem. I made the simplest project ever, just a 2D Map that I can scroll around on. The Normal map is working but there’s no albedo texture.

I solved normal mapping issue by my own shader.

you came here to brag about it, or…?

1 Like

Sorry, but I don’t think my shader could help - It’s quite specific. I’m just saying that it is possible to recreate something like a default UnityShader with proper normal map behaviour.

I wrote that shader for this project:

5946227--636683--Shader.jpg 5946227--636686--default shader .png 5946227--636698--demo.jpg

5946227–636680–default.zip (5.19 KB)

2 Likes

Hey, I just switched over to the 2020.1 Beta and it seems to be finally working in this version. :slight_smile: