Hi, I have created Some AR app using Vuforia Marker SDK. I was tried to create a shadow but It's Not worked well. My problem Was : When I zoom in the camera that time shadow will appear I tried AR camera zoom out my camera Shadow disappear. Unity version: 2017.3.0 P2 Vuforia Version: 7.1.30 Help me to Solve this problem. I have attached my Quality settings below Thanks & Regards Sweetan.M
You need to increase the Shadow Distance on the Quality settings depending on how far the marker will be placed. Vuforia take control of your camera based on the marker position. The camera might be very far from the marker and your graphic, this means the unit is not anymore 1unit=1meter. This will reflect on the shadow not being visible. I also suggest you to check how far the camera is from you marker using something like that. Code not tested Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; public class TestDistance : MonoBehaviour { [SerializeField] [Tooltip("Drag your Vuforia marker here, inside the inspector")] private Transform marker; [SerializeField] [Tooltip("Drag your camera here, inside the inspector")] private Transform camera; [SerializeField] [Tooltip("If TRUE, it automatically sets the Shadow Distance on the QualitySettings. Although it's not recomended")] private bool setShadowDistanceAutomatically; void Update (){ var distanceBetweenMarkerAndCamera = Vector3.Distance(marker.position , camera.position); var currentShadowQuality = QualitySettings.shadowDistance; var isShadowDistanceSmaller = (currentShadowQuality < distanceBetweenMarkerAndCamera); Debug.Log("The Distance Between Marker and Camera is: " + distanceBetweenMarkerAndCamera.ToString("F0")); if (isShadowDistanceSmaller) { Debug.Log("The Shadow Distance is smaller than the distance between the camera and marker."); if (setShadowDistanceAutomatically){ int newShadowDistance = (int)distanceBetweenMarkerAndCamera + 10; Debug.Log("Automatically set the shadow distance to " + newShadowDistance); QualitySettings.shadowDistance = newShadowDistance; } } } }
Hi weliketoparty Thanks for your replay ... Your script was worked very well...Thank you so much..... Finally, I got the shadow on my AR app
It's worked thank you so much. And I have another problem too How to smooth a shadow (Now it's pixelated)