Invisible/transparent material for ShapeFactory renderable in Sceneform and ARCore

Viewed 657

I'm trying to create a completely transparent material for a cube renderable created with ShapeFactory. I use this cube renderable as a large rectangular surface to make an infinite floor, and need it to be completely transparent.

I tried using MaterialFactory's makeTransparentWithColor() with an alpha of 0.0 in order to achieve that. However, the cube does not become invisible, even though it is a little bit transparent. Below is the code I use:

    MaterialFactory.makeTransparentWithColor(context, Color(0f, 0f, 255f, 0f)).thenAccept { material ->

        val size = Vector3(100f,0.001f,100f)
        val center = Vector3(0f,0f,0f)
        val floorRenderable = ShapeFactory.makeCube(size,center,material)
        floorRenderable.isShadowCaster = false
        floorRenderable.isShadowReceiver = false

        floorAnchorNode.renderable = floorRenderable
    }

Any idea how to make an invisible material for the ShapeFactory cube? I saw this Github issue which might indicate I could somehow create a dummy-renderable containing a custom material with an unlit shading model, and then get that renderables material to apply in the makeCube()? Surely there must be a better way, similar to ARKit/SceneKit's SCNNode opacity. Please, if you know anything about this I appreciate any help I can get.

1 Answers

It can't be fully transparent simply because of lighting and material used here.

If you need to make something invisible, don't set any renderable. And if you simply want to intercept touch, use collision instead :

floorAnchorNode.collisionShape = Box(size, center)
Related