Topic has a solution and is locked
Topic locked

LOD bias and Shadow Distance wrong on Vuforia Build

November 9, 2021 - 5:58am #1
Topic solved

When building to Android the LOD bias and shadow distance are wrong.



My test setup is one build using the same URP pipeline settings asset, and two different scenes;

1) One scene works perfectly using AR Foundation and ground placement; the shadows and LOD's are behaving identical to the editor. 

2) In the other scene I'm using Vuforia with an image target and the shadows are rendered as if the user is very far away, while every LOD controller is culling the objects as if the camera is so far away that the object should be less than a few pixels on screen. 



I've made sure the scaling of the image target is correct in world scale, e.g. my standard playing card that is 5.5 cm wide is 0.055 units(meters) wide in unity.

I also made sure I am not use the virtual scene scale factor. This is always 1.

 

I tried debug logging this info in update on the Android build;

 

	        Debug.Log("Distance to camera: " + Vector3.Distance(transform.position, imageTargetTransform.position) + " meters");

	        Debug.Log("LOD bias: " + QualitySettings.lodBias + " max LOD allowed: " + QualitySettings.maximumLODLevel);

	        Debug.Log("Shadow Distance: " + QualitySettings.shadowDistance + " in asset: " + universalRenderPipelineAsset.shadowDistance);

	

But the distance to the image target is correctly percieved, the LOD bias remains at default 1, and the shadow distance is also correct.  

 

LOD bias and Shadow Distance wrong on Vuforia Build

January 27, 2022 - 3:38pm #10

Hi everyone,

 

Sorry that it took a short while, but thanks to your feedback over the past months we've been able to solve the problem with our latest release of Vuforia Engine (v10.4.4).

 

Kind regards,

Patrick Scheper

Technical Community Manager

LOD bias and Shadow Distance wrong on Vuforia Build

November 19, 2021 - 3:42am #9

No worries! Will report back as soon as possible.

Have a good weekend!

 

Kind regards,

Patrick Scheper

Technical Community Manager

LOD bias and Shadow Distance wrong on Vuforia Build

November 19, 2021 - 2:08am #8

pscheper wrote:

Hey both,

 

First of all, I'm sorry for the delay in response. 

TheMunk, thanks for providing reproducible steps. I'll validate the issue later today and come back to you as soon as possible.

Can you verify if the issue persisted in the new release v10.3.2? 

 

Kind regards,

Patrick Scheper

Technical Community Manager





Unfortunetly have an upcoming deadline so won't risk upgrading vuforia just yet.

Will try in a future iteration and let you know.




Sorry, too fast to answer, didn't see your other response that you already tested it on 10.3.2. :) 

LOD bias and Shadow Distance wrong on Vuforia Build

November 18, 2021 - 9:54am #7

I validated the issue and also on my Google Pixel 3 XL the FOV is set to 179. The issue persisted in v10.3.2. I've raised the issue to our R&D and report back as soon as possible.

 

Kind regards,

Patrick Scheper

Technical Community Manager

LOD bias and Shadow Distance wrong on Vuforia Build

November 18, 2021 - 6:13am #6

Same issue here with 2021.2.1. Will try TheMunk's fix. Been on this for a long time. Please let us know if 10.3.2 fixes it.

LOD bias and Shadow Distance wrong on Vuforia Build

November 17, 2021 - 8:55am #5

Hey both,

 

First of all, I'm sorry for the delay in response. 

TheMunk, thanks for providing reproducible steps. I'll validate the issue later today and come back to you as soon as possible.

Can you verify if the issue persisted in the new release v10.3.2? 

 

Kind regards,

Patrick Scheper

Technical Community Manager

LOD bias and Shadow Distance wrong on Vuforia Build

November 13, 2021 - 7:25pm #4

Experiencing something similar with Vuforia 10.2.5 setting the AR camera FoV to 179 when using a Pixel 6, which has to be wrong. Can we get some information on why this is happening?

LOD bias and Shadow Distance wrong on Vuforia Build

November 10, 2021 - 5:09am #3

More info and steps to reproduce;



1) Create a new scene with nothing but a camera and a directional light, then add whatever content with LOD in view of the camera.

 - Build and observe the LOD Group rendering the correct LOD.

2) Add Vuforia Behavior to the Camera, and child the content to the camera (so when extended tracking is working we don't have to find it somewhere randomly in our space).

 - Build and observe the LOD group not working correctly - if a culling LOD level is enabled, it wil almost certainly mean the object will be culled.



The same can be said for shadow distances and cascades not being correctly adjusted for.





The Vuforia Engine is definetly changing something in how unity percieve the distances and/or sizes on screen of objects.



Please get back to me ASAP, as this is basically blocking all of our current pipelined work when integrating Vuforia.



 

EDIT SOLVED:

Looks like the Vuforia forces a FOV to match the camera (I already knew this) but on my Samsung S10e it sets the FOV of the AR Camera to 179 ?!?!?! 



If I force it to revert to something default like 60 (in Update) I get normal LOD and shadows behavior again. 



From my (limited) testing it doesn't seem to mess with the device pose, image or model target tracking.





 

LOD bias and Shadow Distance wrong on Vuforia Build

November 10, 2021 - 3:08am #2

Added screenshots to showcase the issue. The red cube has LOD group, while the green has non. 

And as you can see the shadows are also completely trash.



I tried increaing the LOD bias on the build and found that a bias of ~250 was needed to get similar LOD behavior, but this hack is not a valid solution, and doesn't fix the shadows.



EDIT;

I also tried with a clean Vuforia Core Samples Project where I just changed the content of one of the image targets to use LOD's and have shadows which gives the same error on builds.



EDIT 2:

I tried again with completely clean builds using Vuforia Core Samples and just adding an LOD group to the astronaut and still the issue persist.

I did this on these Unity Versions to make sure it wasn't a unity version bug;

2021.2.1f1

2021.1.22f1

2020.3.22f1 (LTS)



Can you please confirm oyu can replicate this issue?

AttachmentSize
Image icon build.jpg416.9 KB
Image icon editor.png300.24 KB
Image icon playmode editor.png362.78 KB
Topic locked