[RELEASED] RealSunAR - Sun and shadows matching the real world on your AR project

Hi again, From my testing I dont think that is required but thank you for the fast response. In turn I would like to ask another question. I live in the UK and have been testing it but the shadows are slightly longer than i’d expect. Ive taken a look through the manual that comes with it and have fiddled with the variables within the inspector but cant seem to find the source. What would your initial thoughts on that be?

I also have another question(Sorry for the bombardment). With the app I am developing it can only be used in one location and must be calibrated by a stationary object in that location meaning they are always going to be in the same place looking the same way. In this instance I don’t require a compass. Can i detach the compass functionality and only use the already known bearing that i have once the scene is placed thus no longer requiring the access of the compass?

Thank you ever so much for your attention and time thus far, any assistance in these minor problems would be perfect :slight_smile:

Hi there Tom. There are so many reasons for slightly longer shadows. First of all the plane detection usually is a few cm above the actual ground, second of all compasses always drift a bit and third my algorithm is not astronomy grade or anything like that. It’s a very close approximation and does work fine, I tested it in London myself back when travel was allowed and it seemed realistic enough (didn’t measure the shadow of “The Shard” though!!!).

As for the 2nd question… a quick way to fix it is set the compass quality method to simple instead of superb and then go to those lines and change those to
line179-180: comment those out so that they don’t run at all

        //Input.compass.enabled = true;
        //Input.compensateSensors = true;

line 185 & 208: comment those out

//float nullVariable = Input.compass.trueHeading;

line 249

float myOffset = (compassReadout == compassQuality.Superb) ? CameraToCompassAverage(measuringCompass) : mainCamera.rotation.eulerAngles.y - Input.compass.trueHeading;`

Here all you have to do is remove the “Input.compass.trueHeading” and substitute it with a variable holding the heading your stationary phone is facing at.
line 317: same thing as 249
line 418 change it to :

if (gotGPSlock)

lines 526-532: comment those out so that they don’t run at all
Those should be fine. Let me know how it goes.

1 Like

Hello,

So I have gone away and attempted these changes. Once I had removed all of the compass related code you provided shadows would not appear. I am connected to the internet and have location services active, when I reverse the changes the shadows appear again so I have a feeling its going to take more tweaking. For context all I have within a plane tracking prefab is a stick standing vertically with a plane below it with the shadows shader attached.

Although I am submitting these problems I by no means have any problems with the asset it is a brilliant approximation and would be perfect in almost all projects except in the strange context I am using.

If you could look into inputting my own latitude and longitude and having a way of avoiding using compass to draw a basic approximated shadow. Thanks again for your help

I’m sorry about that. It seems I missed something as I was going through my code. However since I’m currently on vacation I will be able to respond about 10 days after today.

Could this be easily modified to work with xr pico4 seethrough? Also is urp supported? Thx

Hmmm @Harald_Heide I can’t think of a reason for it not to work with pico as long as pico gives compass readings (does it?). As for URP. email me at info@synthercat.com and I’ll send you a shader for that.

Have you tried using the RealSunAR Tester @Harald_Heide

@A_Savvidis i want to get real position of sun and real shadows of 3d objects placed on google map for my webgl app. these shadow will be later used to calculate its area and exclude its are from main drawing area on map.

Hi, May I know if this plugin work for unity 2021.3 LTS? I am targeting for mobile AR android/ios

I am sorry but you cannot use the current version of my plugin for that purpose as it uses the compass of the device for its calculation so it cannot actually be used for a 2d calculation.

Hello there Tengku! As I haven’t recently updated my plugin I cannot confirm it works on that version but I will do that soon, and I will let you know how it goes. I will also send you a new shader so that you can utilize it with the URP. I think I will have an answer by tomorrow.

Hi Antonis,

I bought your plugin a few month ago and it’s really cool and work very well on my AR scenes!
I am trying to use it with the google geospatial API though and am running into issues with it. I think that the sun initializes but I can’t see it on my objects that are anchored to the scene. I thought that the sun being too far from the objects was a problem so I anchored it at the same location but same problem here.
Have you tried it with Google geospatial API by any chance?

Thanks!

Chris

I finally found some time to work on updating RealSunAR. I have lots of ideas + some taken from here and email I received about my plugin such as forced location, forced time, Google geospatial API.

However I have an important question for all you!
Which versions should I support in the next update?
I am thinking 2021.3, 2022.3, and the new 6. Both standard renderer and URP for all. I will build an elaborate structure to test for all those. That alone though will take some effort.

Do you have active projects on other versions? Should I drop 2021? Do you agree with my list? Please take a moment and reply here.

Hi @A_Savvidis,

I switched to another plugin since I couldn’t get your one to work with the geospatial API but I’d be interested to switch if you update it :slight_smile:

Speaking for myself but I’m currently using Unity 2022.3 and I would eventually be interested to move up to 6 in the future.

Thanks!

Chris