Sceneform Transparent Material

Viewed 322

Goal

Transparent material for a cube renderable created with ShapeFactory.

Tried

MaterialFactory.makeTransparentWithColor(context, Color(0f, 0f, 0f, 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
}

So for Color(0f, 0f, 0f, 0f), the cube does not become invisible, even though it is a little bit transparent.

I have also tried the following with the same result.

context.getColor(R.color.transparent) 

where

<color name="transparent">#00000000</color>
1 Answers

It's not fully transparent simply because of lighting.

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