-
Notifications
You must be signed in to change notification settings - Fork 337
[VR] Single Pass Instanced/Multiview Support for Gaussian Splatting in URP #173
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
base: main
Are you sure you want to change the base?
Conversation
…ting functionality for multipass and non VR intact
… done twice and other steps are done only once.
6481e22
to
25344b4
Compare
Did not try it, but cool to see someone working on this! Just from looking at it, it seems to only sort for the original camera position, not both eyes? I guess this is fine as long as you don't get too close, but maybe it would be worth it to expose this behavior? |
@arghyasur1991 @ninjamode I ran into some issues on macOS with latest LTS (6000.0.46f1) in non-VR mode: Also, I've been working on similar updates but focused on Apple Vision Pro (happy to test on device for AVP); see #17 (comment), maybe you can use some of it: https://github.com/arvinkx/UnityGaussianSplatting/tree/spi. Specifically, handling foveated rendering and I used a separate render pass for the composite that is a normal render pass (as opposed to unsafe) which I believe would let the api optimize the composite stage in the pipeline (if it can find a way to). Hope it can be helpful. |
@arvinkx I upgraded unity editor to latest 46f1 and it works correctly for me in mac M4. Will look at your code for other suggestions. Thanks.
@arvinkx That will be very helpful. Pls let me know if it works.
@ninjamode Thanks for the input. Will add optional support for sorting per eye. |
My current priority is to improve performance if possible by clubbing draw calls to tex2darray render textures in instanced mode. Have not been able to get it working yet. |
@ninjamode Added parameter for Sorting Per Eye (disabled by default) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall looks great thanks for contributing this!
It might be worth looking into that issue further as that specific splat works in the latest in main but that screenshot is what I get in editor with this PR. That specific splat is in the repo I linked (in my fork), if that's helpful. Trying with other splats I am getting odd results as well such as the preview in scene view not matching game view. I don't know if it makes a difference but I'm on an M1 Max.
My repo has code in
and
Those shaders would have to be updated if you want to be able to support building for Apple Vision Pro. I believe my repo has updated versions of those two debug shaders (but they use Also, I would recommend using |
@arvinkx I have fixed a bug in editor. It should hopefully work now.
Unity doesn't set this variable correctly when shader is run using DrawProcedural or Blit. I have tried multiple ways to make it work but this is the only way it will work currently. There is another approach to prevent 2 draw calls which is to use geometry shader for setting |
With the latest changes, it looks correct in scene view but when you run it doesn't display in the game view. Unfortunately, I can't build for device due to the shaders not compiling to test further.
I would recommend looking at my repo - it works correctly (I have not had any issues with |
I have not tested with Quest 3 but it's mentioned here that it worked so not sure but works on Apple Vision Pro with a single draw call. The point was I don't think there's an issue with
Ok, glad to hear it works on yours. Hopefully others don't run into the same. |
It only worked with multipass until now. This PR adds support for single pass instanced and multiview. Quest3 only supports multiview so I could not directly test "single pass instanced". "also there is a weird disparity between L and R eye. Tested on Quest 3." The comment mentions the weird disparity between eyes. That is the core issue with unity_stereoIndex. It is always passed as 0 in these shaders so you won't get correct L and R buffers. At least that's the case with Quest. Maybe it works in AVP.
Yes I have tried that and used it as a reference for debugging during my development. That's why I know for sure, in quest3 it didn't work. I spent a lot of time trying getting it to work with unity_stereoIndex
In quest3 even if foveated rendering is on through OpenXR settings, it works fine with my change. Although, I am not totally sure if this is actually working since quest3 hardware doesn't support eye tracking. |
@arvinkx I don't have vision Pro but i built a new project with VisionOS target and built with this package installed. It built with my code and the shaders got built as well. Can you directly clone my repo and try to build? |
@arghyasur1991 I did clone your repo and built with the Apple Vision OS plugin for device and ran into those compile errors which are known issues on AVP with this library, example here. As I said, not sure about Quest 3 as I have not personally tested it but the repo I've been working on does work with Apple Vision Pro. I'll keep my changes for AVP in a separate repo as the goal there is to support single pass instanced for Apple Vision Pro which doesn't seem compatible with this PR the way it is. It would probably be a good idea to report the |
@arvinkx Thanks for the suggestions. For now, this is the only way I could make it work for Quest3. Added workaround and TODO notes in the file for future revisit. |
@arghyasur1991 On my side the splats are much smaller when using SPI (either on PC or native Quest 3). It really changes the appearance of the scenes. Is it a known issue? |
@cdrintherrieno Strange. Didn't see this issue. I tested in Quest3 with both multipass and SPI (multiview) mode and things look correct and identical in both. In Editor, it is in non-stereo mode right? |
@arghyasur1991 For the repro I simply opened the URP project from the repo (multiview7 branch) under Unity 6000.0.33f (DX12). I added my splat asset to the scene and added the OpenXR plugin to the project. |
![]() @cdrintherrieno This is what shows in My macbook M4 (6000.0.46f). Wonder if this is a DX12 specific issue with my code. Will have to check. |
@arghyasur1991 I tried updating to 6000.0.41f, and also switch to Vulkan, but still the same problem. What is strange is that when not in play mode it works fine in the game window, the splat size is correct but when hitting play and entering VR it becomes scaled down (both in VR and in the game window). Setting a "Splat Scale" of 2 is almost the same as it should be, but then when not in play mode splats are too big. I also noticed that the "Debug Points" render mode is affected by it (points are smaller), but the "Debug Boxes mode" is fine. |
@cdrintherrieno I am not able to repro this on windows machine as well. Graphics card - RTX 4060. DX12 and Vulkan both are giving same results in my machine as mac. Only if I reduce the splat scale from 1, I see similar output as yours. To diagnose this, can you tell me -
|
@arghyasur1991 I have the same issue as @cdrintherrieno .
|
@Aupuma Thanks for the info. Based on this, it seems in editor mode, somehow isStereo is getting set. Are you using MockHMD package as XR provider by any chance? Anyway, has commited a potential fix just for editor. Pls test and let me know if this fixes editor issue. |
@arghyasur1991 I tested it out but it doesn't work, it actually breaks VR rendering altogether (right eye renders black). |
…n Splatting in URP aras-p#173
I had the same small splats issue in SPI, the splats are exactly half as big as they should be. I do not know for sure but my suspicion is that For my quest 2 the following change fixed the issue: #if defined(UNITY_SINGLE_PASS_STEREO) || defined(STEREO_INSTANCING_ON) || defined(STEREO_MULTIVIEW_ON)
float2 deltaScreenPos = (quadPos.x * view.axis1 + quadPos.y * view.axis2) * 4 / _ScreenParams.xy;
#else
float2 deltaScreenPos = (quadPos.x * view.axis1 + quadPos.y * view.axis2) * 2 / _ScreenParams.xy;
#endif |
Support for Single Pass Instanced/Multiview rendering mode. Tested on Quest3
Also, ensured that non-VR mode and Multipass continue to work correctly
Not resolved in this PR: