Giter Club home page Giter Club logo

Comments (23)

marwie avatar marwie commented on July 23, 2024

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.

marwie avatar marwie commented on July 23, 2024

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.

marwie avatar marwie commented on July 23, 2024

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.

Scrantch avatar Scrantch commented on July 23, 2024

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

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.

marwie avatar marwie commented on July 23, 2024

Hello @Scrantch did you try the new version?

from ar-simulation.

Scrantch avatar Scrantch commented on July 23, 2024

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?
Screen Shot 2021-02-17 at 9 59 26 AM

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

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.

image

I have changed the code in SimulatedAREnvironmentManager to this, could you try if that does fix it for you?

image

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

Can you try 1.0.2-preview.2 ?

from ar-simulation.

Scrantch avatar Scrantch commented on July 23, 2024

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.

Scrantch avatar Scrantch commented on July 23, 2024

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.

Scrantch avatar Scrantch commented on July 23, 2024

Here's a shot where you can actually see through the AR camera in the Scene view inset but totally pink in Game View:

Screen Shot 2021-02-25 at 4 14 40 PM

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

@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.

Scrantch avatar Scrantch commented on July 23, 2024

Unfortunately I cannot for security reasons. Forbidden. :(

from ar-simulation.

Scrantch avatar Scrantch commented on July 23, 2024

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.

marwie avatar marwie commented on July 23, 2024

I see. Do you think you could reproduce it in an isolated project? I'll try as well.

Some more questions:

  1. Are you using URP?
  2. Is the SimulatedAREnvironmentManager active in the scene?
  3. Could you send me the code for TogglePlaneDetection as well? Does it just toggle the plane manager?
  4. When switching are you just enabling/disabling the camera component or the whole gameobject or even Session/SessionOrigin?

from ar-simulation.

Scrantch avatar Scrantch commented on July 23, 2024

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?

Screen Shot 2021-02-25 at 4 46 55 PM

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

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?

Screen Shot 2021-02-25 at 4 46 55 PM

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.

Scrantch avatar Scrantch commented on July 23, 2024

I see. Do you think you could reproduce it in an isolated project? I'll try as well.

Some more questions:

  1. Are you using URP?
  2. Is the SimulatedAREnvironmentManager active in the scene?
  3. Could you send me the code for TogglePlaneDetection as well? Does it just toggle the plane manager?
  4. When switching are you just enabling/disabling the camera component or the whole gameobject or even Session/SessionOrigin?
  1. Not using URP (though we will be soon). Using builtin for the moment.
  2. 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.
  3. See below for TogglePlane code
  4. 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.

Scrantch avatar Scrantch commented on July 23, 2024

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?
Screen Shot 2021-02-25 at 4 46 55 PM

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.

hybridherbst avatar hybridherbst commented on July 23, 2024

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.

Scrantch avatar Scrantch commented on July 23, 2024

OK was able to make a sandbox project. Just emailed you guys so let me know where to put it. Thanks!

from ar-simulation.

marwie avatar marwie commented on July 23, 2024

Resolved in 1.2.0-preview.4

from ar-simulation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.