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

Error on play: "Object reference not set to an instance of an object" #2

Closed
matthewrbrennan opened this issue Sep 12, 2023 · 6 comments

Comments

@matthewrbrennan
Copy link

Getting this error in Unity 2022.3.9:
NullReferenceException: Object reference not set to an instance of an object
GaussianSplatRenderer.OnPreCullCamera (UnityEngine.Camera cam) (at Assets/GaussianSplatting/Scripts/GaussianSplatRenderer.cs:345)
UnityEngine.Camera.FireOnPreCull (UnityEngine.Camera cam) (at <10871f9e312b442cb78b9b97db88fdcb>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

I'm using a pointcloud.ply from NerfStudio with the transforms.json renamed to the expected "cameras.json"

Not sure where I went wrong, but any guidance would be much appreciated!

@carlosnavarro-cn
Copy link

carlosnavarro-cn commented Sep 13, 2023

I have the same issue. The content of my transforms.json is formatted very differently from your camera.json. Is there a practical way to match the content?

@aras-p
Copy link
Owner

aras-p commented Sep 13, 2023

@matthewrbrennan my guess is that there was some other error before that, that causes the later nullref exception. Anything else in the previous console error messages?

@carlosnavarro-cn I only made it support cameras.json files as I found them among the Gaussian Splatting paper data files. If you have something that is different format, and you'd like it to be supported by this, then feel free to either send a pull request, or at least show how your file looks like.

@matthewrbrennan
Copy link
Author

matthewrbrennan commented Sep 13, 2023

@aras-p So there was! It jumped so quickly to "999+ errors" I didn't think to scroll all the way to the first one, which was this:

Exception: InputVertex size mismatch, we expect 248 file has 27
GaussianSplatRenderer.LoadPLYSplatFile (System.String folder, System.Boolean use30k) (at Assets/GaussianSplatting/Scripts/GaussianSplatRenderer.cs:169)
GaussianSplatRenderer.OnEnable () (at Assets/GaussianSplatting/Scripts/GaussianSplatRenderer.cs:257)

Again, I'm using a .ply output from NerfStudio (it's about ~180 megabytes) - I don't recall exactly what settings I had at export, but there was nothing that jumped out at me as potentially gamechanging.

Do the images (jpegs) need to be in the folder as well?

Thanks Aras!

@aras-p
Copy link
Owner

aras-p commented Sep 13, 2023

@matthewrbrennan "Exception: InputVertex size mismatch, we expect 248 file has 27" would mean the file is not a PLY file containing Gaussian Splats, but rather a file containing something else (perhaps just a sparse point cloud?)

@matthewrbrennan
Copy link
Author

matthewrbrennan commented Sep 13, 2023

@aras-p OK - so that means simply exporting a PLY pointcloud from Nerfstudio won't work (duh) - guess I've got to do some more reading up. Thanks!

edit:
After some more reading - it sounds like I just need to go through the original paper... 2nd "duh" of the day.

For anyone in the future: @carlosnavarro-cn came to the same conclusion below - follow the steps outlined in the paper to get an appropriate pointcloud!

@carlosnavarro-cn
Copy link

carlosnavarro-cn commented Sep 14, 2023

@carlosnavarro-cn I only made it support cameras.json files as I found them among the Gaussian Splatting paper data files. If you have something that is different format, and you'd like it to be supported by this, then feel free to either send a pull request, or at least show how your file looks like.

Thank you, @aras-p ! I realized I couldn't just use a NeRF transforms.json, but needed to train a Gaussian Splatting scene to get the proper camera.json. I got it working now!

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