google-ar / sceneform-android-sdk

Sceneform SDK for Android
https://developers.google.com/sceneform/develop/
Apache License 2.0
1.23k stars 604 forks source link

Shadow resolution #80

Closed StevenOttoG closed 5 years ago

StevenOttoG commented 6 years ago

As you can see on the attached screenshot the end of the chair leg does not match the shadow. The chair's shadow is also not complete. It ends where the detected plane ends.

Excepted:

screenshot_20180606-133707

malik-at-work commented 6 years ago

The team will discuss the best way to solve this.

romainguy commented 6 years ago

I am not able to reproduce the "peter-panning" issue in our test apps. Can you confirm the chair and plane do touch? It could be an issue with the bounding box of the chair.

StevenOttoG commented 6 years ago

I dropped our SFB in the hellosceneform example and got this result: screenshot 13 06 2018 08 33 56 It touches the plane but it also has the peter-panning. The suggested_collision section of the SFA file is like this:

"suggested_collision": {
      "type": "Box", 
      "center": {
        "y": 0.302197, 
        "x": 0.005333000000000032, 
        "z": 0.0
      }, 
      "size": {
        "y": 0.604394, 
        "x": 0.5046660000000001, 
        "z": 0.494
      }
    }

I calculate it by iterating through the OBJ file and calculating the min and max value for each component. Is there a way to visualize the bounding box in Sceneform to see whether the model and its bbox match?

romainguy commented 6 years ago

Thanks Steven. Would you mind attaching the .obj so I can try to reproduce the error?

romainguy commented 6 years ago

The issue is definitely on our side, inside the renderer. The scale&bias we use to avoid shadow acne is too aggressive for this setup and creates peter panning. It's mostly hidden by "regular" objects with large bases but shows up with thin geometry in contact with the ground.

romainguy commented 6 years ago

We have a fix internally which will be part of a future release.