Skip to content

Create materials with require results in getAssetByID error #1

Description

@SomnathChW

Having trouble loading textures/materials using ViroMaterials.createMaterials like in the old examples:

ViroMaterials.createMaterials({
  white: {
    lightingModel: "PBR",
    diffuseTexture: require(.......),
    metalnessTexture: require(......),
    roughnessTexture: require(......),
  }
});

On Android, this gives a getAssetByID error. (I haven’t checked iOS.)

I tried working around it with expo-asset, but then the materials sometimes don’t load properly — some textures just don’t show up. Even if I use require directly in Viro3DObject, I still see assets not loading every now and then.

It’s really noticeable in the Car Driving demo (wheels don’t load sometimes) and in the Car Marker demo (materials are white on first load sometimes).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions