Search Unity

Loaded asset not applying normals

Discussion in 'Addressables' started by danilonishimura, Aug 1, 2019.

  1. danilonishimura

    danilonishimura

    Joined:
    Jul 13, 2010
    Posts:
    70
    Hi there,

    I have two projects, one for asset export, other for asset import.
    In the export project, I'm exporting a Unity plane object with a Material applied to it. The material uses the Standard Shader, and has two textures: the albedo map and a copy of the texture, imported as normal with generate normals on. All addressable Settings (groups) are set to build remote and load remote, so nothing is stored in the library.



    In the import project, I'm loading this asset from that address and instantiating, however, it seems like the Standard Material isn't applying the texture normals at all. Compare it to the



    If I select the material, and """change""" the shader from Standard to Standard again, it loads the normal map.



    I'm not sure this is caused by the way the bundle works, or if it's something else.

    Unity 2019.3.0a8
    Addressables 1.1.5


    Thanks in advance!
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Just to make sure I understand what I'm seeing in the gif...
    - you build addressables in projectA
    - in projectB you go into packed play mode
    - projectB loads the catalog from projectA
    - you load this floor via addressables, which instantiates the prefab into your scene
    - then you select this instantiated prefab, and change it's shader from "standard" to "standard".
    - after the non-changing-change, things render correctly.

    Is that right?

    If so, I think it has something to do with the way shader bundles would be built for each project. Clarify the steps, and I'll ponder how to handle this.
     
  3. danilonishimura

    danilonishimura

    Joined:
    Jul 13, 2010
    Posts:
    70
    Yes it is.

    It's exactly as you said. Build addressable in projectA, load it in projectB with packed play mode, instantiate the prefab using its name, notice the lack of normal mapping, select the same shader, notice the normal working as intended.

    Just tested, still happens, both projects using the same Addressables version (1.1.7) and both on Unity 2019.3.0a11
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    ok. I have some theories. I think it has to do with both projects creating a built in shader bundle, and it not being possible to load two same-named bundles with different contents.

    I'm guessing your projectB has something addressable, but nothing with a normal map. So you end up having the projectA asset use projectB shaders.
     
  5. danilonishimura

    danilonishimura

    Joined:
    Jul 13, 2010
    Posts:
    70
    The projectB has a scene and a script for loading the addressables. The Addressables package is imported, but it's not initialized.

    upload_2019-8-7_17-40-40.png

    That's what it has today. I had a bunch of UI stuff in it, but removed to check if they had anything to do with the issue. It doesn't seem to be the case.
     
    Last edited: Aug 7, 2019
    Twyker_gp likes this.