Comments (23)
Hello @Scrantch
Thanks for reporting this issue.
It is odd that ARSimulation does fiddle with your other camera. Can you send us a small repro of this issue?
ARS should only ever use the position of the camera assigned to the SessionOrigin.
Do you use Device Simulator and does it happen only with DS or also normal Game Mode?
ARS should respect subsystems being turned off, that's right.
from ar-simulation.
Hey @Scrantch I just looked at the code. I think you've found a bug, because currently the ARS loader can't be stopped. I'm working on a fix.
from ar-simulation.
Hello @Scrantch
We've just released version 1.2.0-preview.1
. Please try if the fix helps with your project and let me know how it goes!
from ar-simulation.
from ar-simulation.
The method you've been using should work in Editor or disabling all the ARFoundation components when you switch to your other app mode (internally they stop the corresponding subsystem on OnDisable)
from ar-simulation.
Hello @Scrantch did you try the new version?
from ar-simulation.
Hi sorry for the delay. Got sidetracked. So, no, this is still not working. Are you guys changing the camera Culling Mask for any reason? Like for the Simulated Environment? Something is still grabbing my regular camera (when the AR camera is off) and messing with those settings so my content doesn't show up. Again, I make a call XRGeneralSettings.Instance.Manager.StopSubsystems() and I have also just disabled ARS in XR Management Project Settings as well as deactivated Simulation AR Environment Manager in the scene. But yet, I still warning messages from ARS that no ARSession found and "using main camera." Why would that still be happening if everything is off?
from ar-simulation.
Thanks for getting back.
The warning will be logged the first time anyone tries to find the ARCamera (in this case the EnvironmentManager inspector). You're right, it shouldnt be printed if ARS wasnt enabled. I will fix that.
We're changing the culling mask for environment simulation, yes. I found one spot were setting the culling mask was wrong and it might be the reason for your issue (it is also the only spot the culling mask is changed on the ARCamera). See below ARCamera.cullingMask
.
I have changed the code in SimulatedAREnvironmentManager
to this, could you try if that does fix it for you?
from ar-simulation.
Can you try 1.0.2-preview.2
?
from ar-simulation.
That did it! Still get the warning message but now it's not highjacking the camera anymore. Still need to test when the code will switch back and forth between AR and regular 3D mode so will let you know how that goes in the next couple days. Still not quite there yet. Thank you!
from ar-simulation.
OK, finally got the back and forth between regular 3D and AR integrated. However, it doesn't appear to be working with ARS. The game starts in regular 3D mode. When I flip the switch it enters AR mode by using the following StartXR code:
public IEnumerator StartXR()
{
Debug.Log("Initializing XR...");
yield return XRGeneralSettings.Instance.Manager.InitializeLoader();
if (XRGeneralSettings.Instance.Manager.activeLoader == null)
{
Debug.LogError("Initializing XR Failed. Check Editor or Player log for details.");
}
else
{
Debug.Log("Starting XR...");
ARCamera.gameObject.SetActive(true);
XRGeneralSettings.Instance.Manager.StartSubsystems();
TogglePlaneDetection(true);
}
}
void StopXR()
{
Debug.Log("Stopping XR...");
XRGeneralSettings.Instance.Manager.StopSubsystems();
XRGeneralSettings.Instance.Manager.DeinitializeLoader();
Debug.Log("XR stopped completely.");
ARCamera.gameObject.SetActive(false);
}
It also disables the regular 3D camera. When we flip back it does the opposite and enables the regular 3D camera and calls the StopXR code above. When I do this in editor and flip to AR mode I get a completely pink Game View screen (except for UI) but I can move the AR camera around with the ARS keyboard controls.
When I flip back to regular 3D the Game View resumes and I can see through the regular camera. If I flip back to AR again, we get the pink screen and also this time the keyboard controls to move the camera don't work. How can I get ARS to play nicely? Is there some init or reset routines I'm missing? Please advise.
Thanks,
Grant
from ar-simulation.
Here's a shot where you can actually see through the AR camera in the Scene view inset but totally pink in Game View:
from ar-simulation.
@Scrantch could you upload and send me the project to look into? It would help a lot with understanding and finding the issue :)
from ar-simulation.
Unfortunately I cannot for security reasons. Forbidden. :(
from ar-simulation.
Any logs anywhere or anything like that I can send you? Didn't get any errors or out of bounds warnings in the console.
from ar-simulation.
I see. Do you think you could reproduce it in an isolated project? I'll try as well.
Some more questions:
- Are you using URP?
- Is the SimulatedAREnvironmentManager active in the scene?
- Could you send me the code for
TogglePlaneDetection
as well? Does it just toggle the plane manager? - When switching are you just enabling/disabling the camera component or the whole gameobject or even Session/SessionOrigin?
from ar-simulation.
When I flip to AR mode I can, for an instant, see through the AR camera in Game View before it throughs up the pink screen. Also, I notice one of the components you put on the camera has a pink main light color. My lights were never pink. Could this be related? Blasting everything out?
from ar-simulation.
When I flip to AR mode I can, for an instant, see through the AR camera in Game View before it throughs up the pink screen. Also, I notice one of the components you put on the camera has a pink main light color. My lights were never pink. Could this be related? Blasting everything out?
interesting. Which light is used as "Input Light" here?
Your scene does look very bright as well. Maybe that's the reason for that?
Are you using Light Estimation as well?
from ar-simulation.
I see. Do you think you could reproduce it in an isolated project? I'll try as well.
Some more questions:
- Are you using URP?
- Is the SimulatedAREnvironmentManager active in the scene?
- Could you send me the code for
TogglePlaneDetection
as well? Does it just toggle the plane manager?- When switching are you just enabling/disabling the camera component or the whole gameobject or even Session/SessionOrigin?
- Not using URP (though we will be soon). Using builtin for the moment.
- Yes SimAREnvManager is active (this is never turned off when switching, should it?). Also Sim AR Env Instance and Sim AR Env Camera are in the scene but greyed out.
- See below for TogglePlane code
- When switching, I'm turning off the whole camera game object with SetActive. Vice versa for both AR and regular 3D cameras. Not disabling Session/Origin because I assume the start/stop code is doing all of that.
public void TogglePlaneDetection(bool on)
{
// arPlaneManager.enabled = on;
if (on)
arPlaneManager.planePrefab = arPlaneManagerPrefab;
else
arPlaneManager.planePrefab = null;
arPlaneManager.SetTrackablesActive(on);
}
from ar-simulation.
When I flip to AR mode I can, for an instant, see through the AR camera in Game View before it throughs up the pink screen. Also, I notice one of the components you put on the camera has a pink main light color. My lights were never pink. Could this be related? Blasting everything out?
interesting. Which light is used as "Input Light" here?
Your scene does look very bright as well. Maybe that's the reason for that?
Are you using Light Estimation as well?
The Input Light is something you guys create, no? It links to one of your nodes in the scene. Yes, using light estimation. Fooling around with all any of the lights or parameters or values in all of these doesn't change it a bit though. Still totally pink in Game View. Isn't this Unity's way of complaining about the camera or shaders or something? I feel like it's something you guys are doing with the camera. Related to the start of this thread perhaps?
from ar-simulation.
We really want to help and get this fixed - but it's hard to see from the screenshots and description what's going on here.
Please try to reproduce in a separate project and send us that project - that'll certainly be the fastest way to get this fixed.
Additionally, we're happy to sign an NDA in case that allows you to send over the original project. You can reach out via [email protected] or send a DM in our support discord so it stays private.
Thank you!
from ar-simulation.
OK was able to make a sandbox project. Just emailed you guys so let me know where to put it. Thanks!
from ar-simulation.
Resolved in 1.2.0-preview.4
from ar-simulation.
Related Issues (20)
- Where is ARmeshmanager example scene HOT 6
- Camera movement and AR object interaction not working on Linux HOT 2
- Support Meshing on Linux
- [Package Manager] Failed getting latest version for AR Simulation HOT 9
- Unable to navigate using right mouse + keyboard combination HOT 16
- [Bug] InvalidOperationException when disabling ARPlaneManager HOT 1
- Issue with scene setup / plane detection HOT 9
- Planes are not detected again when disabling and enabling ARPlaneManager. HOT 9
- Point clouds are saved in scene file HOT 2
- Add support for ``Horizontal`` or ``Vertical`` plane detection only HOT 1
- Installation error with Unity 2020.3.1f1 on macOS Big Sur 11.1 HOT 5
- Simulated environment textures get included in builds for IOS/Android HOT 1
- Async Image Conversion with Callback leaks memory HOT 5
- TargetParameterCountException HOT 1
- Rotation of ARPlanes is not considered in hitPose HOT 5
- Incorrect XRReferenceImage when using SimulatedARTrackedImage with a runtime image library
- Is there a way to add perturbation for simulated tracking?
- AR Foundation 5: Subsystem Warning HOT 4
- can we get a simulated XRCpuImage/XRCameraImage?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ar-simulation.