I looked everywhere but found no answer. The idea is to create a node with a transparent panel that receives only shadows. I tried with
MaterialFactory.makeTransparentWithColor(context, new Color(255,255,255,0.2f))
.thenAccept(material -> {
Vector3 size = new Vector3(5f,0.0001f,5f);
Vector3 center = new Vector3(0f,-0.5f,0f);
ModelRenderable floorRenderable = ShapeFactory.makeCube(size,center,material);
floorNode.setRenderable(floorRenderable);
})
and
MaterialFactory.makeTransparentWithTexture(context, texture)
.thenAccept(material -> {
Vector3 size = new Vector3(5f,0.0001f,5f);
Vector3 center = new Vector3(0f,-0.5f,0f);
ModelRenderable floorRenderable = ShapeFactory.makeCube(size,center,material);
floorNode.setRenderable(floorRenderable);
})
but I got a not completely transparent object.
thanks
I was able to get this to work with @RomainGuy's help.
First, create the `.mat file
Adjust
vec4
's fourth parameter to change the strength of the shadow.Compile the
.mat
file with a version of Filament'smatc
that Sceneform uses (in my case, it was Filament 1.45). I wasn't sure how to find out so I just experimented with various version of Filament here: https://github.com/google/filament/releases/.I ended up needing this file: https://github.com/google/filament/releases/download/v1.4.5/filament-20200127-mac.tgz.
Place the resulting matc file in your
res/raw
package, and use it like so. If thematc
file is incompatible, your app will crash. That's how I found out whichmatc
was the correct one, through trial and error: