3

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.

A. Claesson
  • 529
  • 4
  • 16

1 Answers1

2

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)
Simon Marquis
  • 7,248
  • 1
  • 28
  • 43
  • That is a good idea! I ended up using a custom .mat file and a placeholder renderable instead but this seems much easier to do – A. Claesson May 08 '20 at 13:44