sceneform-android-sdk icon indicating copy to clipboard operation
sceneform-android-sdk copied to clipboard

Transparent material issue

Open dyavil opened this issue 8 years ago • 12 comments

Hi,

Is there a way to make a completely transparent material ? Setting alpha to 0 is not doing it. Even with reflectance and roughness to 0. Whatever I try the object is still slightly visible. My goal is to use a transparent object for HitTest only.

Since detected plane can be fully transparent, is this issue due to sceneform or am I doing something wrong ?

dyavil avatar Jun 21 '18 07:06 dyavil

Setting reflectance to 0 doesn't eliminate specular reflections entirely..Transparent objects still have some specular reflection.

If the object is unlit this should be doable.

malik-at-work avatar Jun 21 '18 20:06 malik-at-work

Is there a way to unlit just some objects ?

dyavil avatar Jun 22 '18 08:06 dyavil

You would want an unlit material, but thinking more on your use case let's not do that.

There is a simpler way to do this because you don't need to attach a Renderable at all to do HitTest.

You can set the collision shape on the node to
a Sphere or Box .

So it would look something like

Node node = new Node();
node.setParent(arFragment.getArSceneView().getScene());
node.setCollisionShape(new collision.Box(1, 1, 1)); /* or whatever size you want */

malik-at-work avatar Jun 22 '18 17:06 malik-at-work

Thanks a lot ! While I am at it, if we can't have a fully transparent material, won't it be impossible to have a transparent plane made only for receiving shadows ?

dyavil avatar Jun 25 '18 07:06 dyavil

One option is to make a node using a material with a transparent .png texture.

malulleybovo avatar Jun 25 '18 17:06 malulleybovo

Custom materials are in an upcoming release. There are a lot of options for doing this:

  • For changing the texture on the plane renderer you can checkout https://github.com/google-ar/sceneform-android-sdk/issues/48
  • Custom materials will be in an upcoming release as well so you will be able to create more materials like this.

malik-at-work avatar Jun 25 '18 17:06 malik-at-work

Custom materials are allowed with V1.3 The docs are up at https://developers.google.com/ar/develop/java/sceneform/custom-material

malik-at-work avatar Jun 26 '18 16:06 malik-at-work

Hi,

@malik-at-work as you said:

Transparent objects still have some specular reflection.

Is this the reason why we have shadow - base .png with alpha (part of model), where transparent alpha is being visible/reflected? This is the result: screenshot_20181016-152622

If so, does it mean that we can not use such shadows to avoid that reflection and rather let them be casted by renderer? Thank you for your reply.

terezo avatar Oct 18 '18 06:10 terezo

I'm trying to interpret this. If I interpret this correctly you've baked self shadowing into a texture on the object? That is certainly doable, but I don't think it works if you want the shadow to appear on other objects.

malik-at-work avatar Oct 18 '18 16:10 malik-at-work

Yes, we did baked shadow into model. And I know it won't appear on other objects. It is not a big deal for us.

screenshot from 2018-10-18 18-24-05

I have to make it clear, the screenshot from previous post is not the best version. It does not actually have any shadow. Imagine that this texture supposed to be an shadow of object from previous post. Point is that even alpha on that texture is being reflected, which is not acceptable. Any ideas how to avoid this behavior?

Bonus question - when using renderer shadow casting I found an weird behavior: screenshot_20181018-183821

The shadow is being casted on both vertical and horizontal planes which is one of the reasons why we decided to stick with baked shadows. Second one is cutting off an shadow in the border of horizontal planes (mentioned in this issue #80). Is there an option to handle those issues? I would not expect casting and shadows thru vertical planes. We have to decide whether to bake or not the shadows into models before we start modeling other models.

terezo avatar Oct 18 '18 16:10 terezo

To avoid specular reflections your shadow material should be set to unlit.

romainguy avatar Oct 18 '18 16:10 romainguy

@malik-at-work @romainguy Can u help me with this issue.

https://github.com/google-ar/sceneform-android-sdk/issues/450

roshanpatel6040 avatar Dec 05 '18 04:12 roshanpatel6040