New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OcclusionMeshes problem:All the 3D models disappera beyond the depth limit (30 meterts) #979
Comments
Take a look at the AR Camera GameObject, a child of the ARSessionOrigin. (Or alternatively, Camera.main via scripting) The default Far Clipping Plane value on the Camera component is 20 meters, which you might want to increase. https://docs.unity3d.com/ScriptReference/Camera-farClipPlane.html |
Thankyou,but it's not work.Acturelly,I have already change this value to 200 before I post this problem.But the red balls still disappera at about 25-30 meters. So maybe it'a depth generate problem.If distance >25-30meters,it will give a value set it at 25-30.The max dpeht value. Sorry for my bad Enlgish. |
I can't not re open this. |
@andyb-unity @ankur-unity |
Could you please file a bug? If you haven't modified the sample then just include the project otherwise please try to reproduce it with the unchanged ARFoundation sample. https://unity3d.com/unity/qa/bug-reporting Some general comments. Depending on your provider (ARCore or ARKit) there are hard limitations to the maximum reportable depth. On ARCore specifically has a maximal span of 8-65 meters depending on which version of ARCore and your device's capabilities. On ARKit it's limited by the LiDAR sensor which Apple has not specified the maximum distance of. |
Hi Thank for reply. And"ARCore specifically has a maximal span of 8-65 meters" The problem is depth map. I think change the depthmap generate rule can fix this problem, |
There is no AR Foundation v4.3. If you're referring to v4.2.3 then yes, the maximum depth value is ~8 meters in that version. The range was increased in ARCore SDK 1.31 to allow depth values up to 65 meters. AR Foundation 5.0.0-pre.12 updated the ARCore SDK to v1.31 and provides the new 65 meters depth range.
The depth accuracy reduces significantly after ~20-25 meters which translate to 65-82 feet. See Google's ARCore documentation .
Can you provide a link to the video with timestamp where Google uses 65 feet instead of meters?
According to Google's documentation, the pixels beyond the supported range of 65 meters will have 0 value and not a default distance. See Google's ARCore documentation for
|
Hi ,Thanks for reply 1 Yes It's ARF 4.2.3 Can you try?Run the sample,depth ----Simple Occlusion,tap screen and shoot the red balls.See how far the redballs disappera.(the red ball's speed is one second one meter,just count the second,you can know the distance. ) Really thank you.Hope can help me to fix this problem. |
And there is another thing,Xiaomi mix2s doesn't support depth in the arcore device list. |
It seems to me that if the confidence is zero, then the shader should ignore that depth value. They are basically saying "we have no depth data for this pixel" so there should be no occlusion. |
Yes! no depth data for no occlusion. |
As a workaround you may be able to copy the shaders from the See https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.0/manual/index.html#ar-camera-background for some more info on custom background materials. |
It Works!!! |
@yuhacrows @DavidMohrhardt I am facing below posted issue: |
Yes,I will share some video this week. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@yuhacrows - do you have that video/workaround please? |
I managed to find the shader, but I do not know how to change it correctly to fulfill this point: modify the function Convert Distance To Depth to return 1.0 for values of 20 or above then make it a custom material for your scene while we look into this issue. could you please help me? |
@yuhacrows Can you please share your solution? I can't find the |
Okay, nevermind my comment above. I now found out how to do it. Just for everyone after me, here's how I did it.
It's under
so it looks like this: `
`
I couldn't attach the BackgroundShader.shader here :( Cheers! |
Yes,And I rember that problem has already fix one year ago.In AR FOUNDATION Update detail.
…________________________________
发件人: cheuaheichan ***@***.***>
发送时间: 2023年8月18日 10:39
收件人: Unity-Technologies/arfoundation-samples ***@***.***>
抄送: yuhacrows ***@***.***>; Mention ***@***.***>
主题: Re: [Unity-Technologies/arfoundation-samples] OcclusionMeshes problem:All the 3D models disappera beyond the depth limit (30 meterts) (Issue #979)
Okay, nevermind my comment above. I now found out how to do it. Just for everyone after me, here's how I did it.
1. Find the BackgroundShader.shader:
It's under Packages > Google ARCore XR Plugin > Assets > Shaders for Android and Packages > Apple ARKit XR Plugin > Assets > Shaders for iOS
1. Make a duplicate of this shader
2. Open the file in Visual Studios or similar
3. Go to the function float ConvertDistanceToDepth (float d), for me it was line 93
4. Add these two lines for code to apply the suggested fix
if (d > 20.0F) return 1.0f;
so it looks like this:
` float ConvertDistanceToDepth(float d)
{
if (d > 20.0F)
return 1.0f;
d = _UnityCameraForwardScale > 0.0 ? _UnityCameraForwardScale * d : d;
float zBufferParamsW = 1.0 / _ProjectionParams.y;
float zBufferParamsY = _ProjectionParams.z * zBufferParamsW;
float zBufferParamsX = 1.0 - zBufferParamsY;
float zBufferParamsZ = zBufferParamsX * _ProjectionParams.w;
// Clip any distances smaller than the near clip plane, and compute the depth value from the distance.
return (d < _ProjectionParams.y) ? 1.0f : ((1.0 / zBufferParamsZ) * ((1.0 / d) - zBufferParamsW));
}
`
1. In Unity create a new Material and choose Shader -> Unlit/ARCoreBackground
2. In AR Camera Background check "Use Costum Material" and attach the above newly created Material to Custom Material
3. Profit
I couldn't attach the BackgroundShader.shader here :(
Cheers!
―
Reply to this email directly, view it on GitHub<#979 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ACCQZKJWFQHYO6ACK6YI7MLXV5A5ZANCNFSM5W4OOHJA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Closing this since there is a working workaround as discussed above and the thread has been inactive for some time. Feel free to re-open if there are additional questions on this topic. |
Hi ARF
I use OcclusionMeshes sample.And touch screen to shoot red balls.All these red dots will disappera at about 20 meters.
If I follow these red balls.They will not disappera.(in ARF 4.2.3,red balls will disappera at 8 meters)
I want to show some 3D model out of 20 meters.Such like a long coin line for 50 meters.
I know that depth limite is 20 meters,but why disappera 3d model out of the depth range.
If phone recognition it's long distance depth out 20 meters,it should show the 3d model,not disappera it.
So how can I fix this?I want to show 3d model out 20 meters.
Sorry for my bad english.
Thank you
Yuha
The text was updated successfully, but these errors were encountered: