Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spatial Mapping is crashing in HoloLens device #291

Closed
hariragavanInoryasoft opened this issue Oct 18, 2016 · 18 comments
Closed

Spatial Mapping is crashing in HoloLens device #291

hariragavanInoryasoft opened this issue Oct 18, 2016 · 18 comments

Comments

@hariragavanInoryasoft
Copy link

Usage of "Spatial Mapping" prefab under HoloToolkit/SpatialMapping/Prefabs/SpatialMapping.prefab is making the app crash in HoloLens device. Without the Spatial Mapping prefab app works fine.

@NeerajW
Copy link

NeerajW commented Oct 18, 2016

I just tried the SpatialProcessing.unity test scene under SpatialMapping\Tests folder and it worked for me.

Could you please share more details about your repro? Perhaps a stack that might help pinpoint the issue?

@darax
Copy link
Member

darax commented Oct 18, 2016

Did you enable the spatialperception capability?

@kaiomagalhaes
Copy link

I'm having issues with the current spatial mapping and processing. It seems to work fine in unity but once I deploy it to the emulator it doesn't work. I'm not being able to see the meshes or the planes.

Also the SpatialMapping tests are not working in the emulator.

And yeah, the spatial perception is enabled

@NeerajW did you test it in unity or in the emulator?

@hariragavanInoryasoft
Copy link
Author

@darax - I enabled Spatial Perception. I am not able to narrow down the problem. Sometimes its working sometimes its crashing and home screen comes.

@NeerajW - I will give it a try. As I said. Sometimes its working perfect sometimes its not. I would like to know how to optimize it to perfect level. Presently what I am doing to optimize is that, I increased Update Time (so that it doesn't take more performance) and I reduced the distance of how much it should spatial map. Is there any other ways to optimize ??

@darax
Copy link
Member

darax commented Oct 19, 2016

When it crashes, it should break into the debugger. You may need to change your debug settings to mixed (managed and native). Otherwise you might need to enable crash dumps from the App Crash Dumps tab in the developer portal webpage.

How you would optimally tune it depends on how you are using the surfaces. Many apps choose to scan surfaces during the initial part of the application and then turn scanning off when the user affirms that the scan looks good.

Another way to reduce the cost of spatial mapping is to not render the surfaces.

@kaiomagalhaes
Copy link

For me not even the spatial processing tests are working, so I don't believe it is something with processing cost.

@darax
Copy link
Member

darax commented Oct 19, 2016

@kaiomagalhaes I think you have a separate issue than the OP. I have a repro, and I think I know how to fix it, but the side effect wouldn't be a crash (as the OP), it would be that you simply didn't get surfaces.

@kaiomagalhaes
Copy link

kaiomagalhaes commented Oct 20, 2016

@darax you mean that I wouldn't be able to recognize the surfaces in the emulator/device? =/

@hariragavanInoryasoft
Copy link
Author

@darax - Thanks. That was very helpful. I was rendering the surface also (may be that's why its crashing). I enabled the app crash dump. I will give it a try and see. Thanks for the help.

@darax
Copy link
Member

darax commented Oct 20, 2016

@kaiomagalhaes on the device the test scene should work. On the emulator it probably depends on how fast your computer is. I'm not sure what the root cause is, but I've got a workaround that I'm testing.

@kaiomagalhaes
Copy link

Awesome @darax thanks! In my emulator it is supposed to work since it is working with the old version. I'm going to test it now and I let you know.

@darax
Copy link
Member

darax commented Oct 20, 2016

k, if it doesn't work, I think the fix is in SpatialMappingObserver.cpp, you can replace the StartObserving function with:

///

    /// Starts the Surface Observer.
    /// </summary>


    public void StartObserving()
    {
        if (ObserverState != ObserverStates.Running)
        {
            // on device, this isn't necessary, but sometimes in the emulator the observer 
            // won't realize that it hasn't already sent you the surfaces, and since the surfaces
            // don't really get updated in the emulator you'll end up getting no surfaces at all.
            if (surfaces.Count == 0)
            {
                if (observer != null)
                {
                    observer.Dispose();
                    observer = null;
                }
                observer = new SurfaceObserver();
            }

            ObserverState = ObserverStates.Running;

            // We want the first update immediately.
            updateTime = 0;
        }
    }

@kaiomagalhaes
Copy link

@darax tested in the emulator and it works fine!

@NeerajW NeerajW added the bug label Oct 24, 2016
@NeerajW
Copy link

NeerajW commented Oct 24, 2016

I believe a PR fixed this?

@darax
Copy link
Member

darax commented Oct 24, 2016

@hariragavanInoryasoft The PR I did was for kaiomagalhaes' issue, which is different. @hariragavanInoryasoft, if you are still having trouble, can you open another issue?

@hariragavanInoryasoft
Copy link
Author

@NeerajW and @darax . No. I will close this issue. Mine is fixed.

@hariragavanInoryasoft
Copy link
Author

hariragavanInoryasoft commented Oct 25, 2016

actually i don't think i can close this now.. can somebody commit a fix ? or i have to do it ?.

I don't know how to close it. i m checking it..

@NeerajW NeerajW closed this as completed Oct 25, 2016
jwittner pushed a commit to jwittner/MixedRealityToolkit-Unity that referenced this issue Nov 16, 2016
 - build fix - ShaderUtil is an editor-only class

Related work items: microsoft#291
@shukenmg
Copy link

I have this problem

an error of access violation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants