Skip to content

How to use a transparent glass object? #350

@knightcube

Description

@knightcube

Environment

Please provide the following information about your environment:

  1. OS: Windows
  2. Version: ViroCore version : v1.17.0
  3. Device(s): What device(s) are you are seeing the issue on (i.e. Samsung Note 8, Pixel 2 XL, etc) - Nokia 6.2

Description

I am having trouble making a 3D model of a glass transparent. The obj is getting placed but it's not transparent. How do I do that?

WhatsApp Image 2021-03-21 at 17 50 54

Here is the code that I am using to add the materials to the object👇 Am I missing something?

object3D.loadModel(mViroView.getViroContext(), Uri.parse("file:///android_asset/wine-glass.obj"), Object3D.Type.OBJ, new AsyncObject3DListener() {
            @Override
            public void onObject3DLoaded(final Object3D object, final Object3D.Type type) {
                final List<Material> materials = object3D.getMaterials();
                for (Material material : materials) {

                    material.setShadowMode(Material.ShadowMode.TRANSPARENT);
                    material.setLightingModel(Material.LightingModel.PHYSICALLY_BASED);
                    material.setTransparencyMode(Material.TransparencyMode.A_ONE);
                }
                object3D.getGeometry().setMaterials(materials);
            }

            @Override
            public void onObject3DFailed(String s) {
                Toast.makeText(ViroActivityHelloAR2.this, "Error Loading Object", Toast.LENGTH_SHORT).show();
            }
        });

Reproducible Demo

Let us know how to reproduce the issue. Include a code sample, screen capture, video recording. The more information you provide, the better we can support you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions