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

NullReferenceException Error #153

Closed
qiangjiadong opened this issue Jan 4, 2025 · 14 comments
Closed

NullReferenceException Error #153

qiangjiadong opened this issue Jan 4, 2025 · 14 comments

Comments

@qiangjiadong
Copy link

Hi, I use Unity 6 with the Universal Render Pipeline (URP). I want to import the GSfile into my VR project. I unzipped the UnityGaussianSplatting-main folder and only copied the entire PACKAGE folder into my project path under ASSETS/GAUSSIANSPLAT.

The creation of the GaussianSplatAsset works, but when I try to add the Data Asset, I encounter the following errors:

NullReferenceException: Object reference not set to an instance of an object
GaussianSplatting.Runtime.GaussianSplatRenderer.InitSortBuffers (System.Int32 count) (at Assets/UnityGaussianSplatting/Runtime/GaussianSplatRenderer.cs:428)
GaussianSplatting.Runtime.GaussianSplatRenderer.CreateResourcesForAsset () (at Assets/UnityGaussianSplatting/Runtime/GaussianSplatRenderer.cs:407)
GaussianSplatting.Runtime.GaussianSplatRenderer.Update () (at Assets/UnityGaussianSplatting/Runtime/GaussianSplatRenderer.cs:612)

I apologize for my questions, but I would be really appreciate if you can help me:

  1. Is there a way to import UnityGaussianSplatting as a Unity Package to use in my own project?
  2. Based on the error above, could it be due to missing files that I didn’t copy into the correct path?
  3. I haven’t tried single or multi-pass rendering yet; is single-pass supported?

Thank you!

@qiangjiadong
Copy link
Author

Dear @aras-p ,

I hope this message finds you well. I’m reaching out for assistance regarding an issue I’ve encountered with Gaussian Splatting, as I am eager to integrate it into my VR experiences.

I attempted to import your Unity package directly via OpenUPM (link), but I continue to experience the same error I encountered earlier:

NullReferenceException: Object reference not set to an instance of an object. (same as las week)

Would you be able to provide any guidance on how to debug this issue effectively? Here are some steps I’ve already tried or considered based on my observations:

Render Pipeline Alignment:
I noticed discrepancies in the Universal Render Pipeline (URP) versions between my projects. Could specific URP versions (17.x) impact Gaussian Splatting compatibility?

Shader Compatibility:
I suspect shader compatibility with newer URP versions might be causing issues. Is there a way to validate or adjust shaders for a specific pipeline?

Thank you so much for your incredible work on Gaussian Splatting, and I would be deeply grateful for any insights or suggestions to help resolve this issue.

Looking forward to your advice!

@aras-p
Copy link
Owner

aras-p commented Jan 13, 2025

Don't quite know how that would happen. If everything is correct, the GaussianSplatRenderer component should have automatically set up all the needed references, under Resources section in the inspector. It should look like the bottom part of this image:

image

How does it look for you @qiangjiadong ?

@qiangjiadong
Copy link
Author

Thanks @aras-p ! I really appreciate,
image
Please see my screenshot. Let me know if anything is wrong or if you need more information. Thank you so much.

@aras-p
Copy link
Owner

aras-p commented Jan 13, 2025

I'm at loss in how the error could happen for your case :(

@qiangjiadong
Copy link
Author

Because I already have my own Unity project, instead of using your github download with test scenes, I imported your Unity package directly via OpenUPM (link), I’m using URP, I got multi-pass and DX12 all set, I will try later to check what are the differences between ur test scenes and my own scenes, will be interesting to hear what potential part I could look into :)))

@aras-p
Copy link
Owner

aras-p commented Jan 13, 2025

@qiangjiadong I guess one way would be to try to debug, i.e. attach a C#/Unity debugger, with breakpoints inside GaussianSplatRenderer OnEnable and Update methods, and step through to see what is happening. First OnEnable should be called (when adding the component or opening the scene), and then Update should get called when you assign the new asset.

@JOHNW02
Copy link

JOHNW02 commented Jan 18, 2025

I encountered the same issue. It happened in the Gaussian Example Demo from the repo. The original GaussianSplats object works and renders properly. But when I create an empty object and add Gaussian Splat Renderer component, it does not render the Gaussian splat. Commenting out line 428 seems to work.

@qiangjiadong
Copy link
Author

Thank you, @JOHNW02 and @aras-p. This week, I re-downloaded the file and opened Aras' URP scene using the original version 2022.3.47f1. I was surprised to encounter the same errors as before in my Unity 6 file. I would really appreciate it if this could be addressed and potentially fixed.

Image

NullReferenceException: Object reference not set to an instance of an object
GaussianSplatting.Runtime.GaussianSplatRenderer.InitSortBuffers (System.Int32 count) (at C:/Unity Projects/UnityGaussianSplatting-main/package/Runtime/GaussianSplatRenderer.cs:428)
GaussianSplatting.Runtime.GaussianSplatRenderer.CreateResourcesForAsset () (at C:/Unity Projects/UnityGaussianSplatting-main/package/Runtime/GaussianSplatRenderer.cs:407)
GaussianSplatting.Runtime.GaussianSplatRenderer.Update () (at C:/Unity Projects/UnityGaussianSplatting-main/package/Runtime/GaussianSplatRenderer.cs:615)

@JOHNW02
Copy link

JOHNW02 commented Jan 18, 2025

I commented out line 428(the if statement) in /package/Runtime/GaussianSplatRenderer.cs. It works for me. Also, to import the package into a URP project, you need to add the URP faetures to your renderer. Check this page: https://github.com/aras-p/UnityGaussianSplatting/blob/main/docs/render-pipeline-integration.md and tutorial: https://docs.unity3d.com/Packages/[email protected]/manual/urp-renderer-feature-how-to-add.html

@qiangjiadong
Copy link
Author

qiangjiadong commented Jan 18, 2025

@JOHNW02 do you men comment out as screenshot?

Image I got this further error, i think I already added URP features to the render, pls see this:

Image

@qiangjiadong
Copy link
Author

I apologise for bothering you, but I ran another test. The original version, 2022.3.47f1, is working again with the URP scene. However, when I reopened the default URP scene in Unity 6, I encountered similar errors as before. Please see the screenshot for reference. I suspect this may be an issue with Unity 6. I would greatly appreciate any assistance in resolving this. Thank you!

Execute is not implemented, the pass GaussianSplatting.Runtime.GaussianSplatURPFeature+GSRenderPass won't be executed in the current render loop.
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

Image

@aras-p aras-p closed this as completed in 9b809e7 Jan 19, 2025
@aras-p
Copy link
Owner

aras-p commented Jan 19, 2025

Should be fixed in latest code in the repository. If any of you still see it, let me know

@qiangjiadong
Copy link
Author

@aras-p I am thrilled to inform you that my GS file under your UnityGaussianSplatting works perfectly in VR mode with Unity 6! You have been a lifesaver for me, and I truly appreciate your contributions to the community. Thank you so much!

I would like to address one issue and hear your thoughts on it: I need to ENABLE Compatibility Mode (Render Graph Disabled) from the Project Settings. You can find this under Graphics > Pipeline Specific Settings > URP > Render Graph.

If I don't do this, I encounter the following error:

Execute is not implemented; the pass GaussianSplatting.Runtime.GaussianSplatURPFeature+GSRenderPass won't be executed in the current render loop.
UnityEngine.GUIUtility:ProcessEvent (int, intptr, bool&)

I hope this configuration will be suitable for VR developers. What are your thoughts?

@aras-p
Copy link
Owner

aras-p commented Jan 19, 2025

@aras-p I am thrilled to inform you that my GS file under your UnityGaussianSplatting works perfectly in VR mode with Unity 6! You have been a lifesaver for me, and I truly appreciate your contributions to the community. Thank you so much!
I would like to address one issue and hear your thoughts on it: I need to ENABLE Compatibility Mode (Render Graph Disabled) from the Project Settings. You can find this under Graphics > Pipeline Specific Settings > URP > Render Graph.
If I don't do this, I encounter the following error:
Execute is not implemented; the pass GaussianSplatting.Runtime.GaussianSplatURPFeature+GSRenderPass won't be executed in the current render loop. UnityEngine.GUIUtility:ProcessEvent (int, intptr, bool&)
I hope this configuration will be suitable for VR developers. What are your thoughts?

I have no idea about any of that, but it sounds completely unrelated to the current issue, which is about null reference exception. If you see a new / another issue, please open a new issue in github.

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

3 participants