mlavik1 / UnityVolumeRendering

Volume rendering, implemented in Unity3D. Want to support the project? Donate a small sum to Save The Children(https://www.savethechildren.net/) or another charity, and send me a message, and I will be greatly motivated!
https://fosstodon.org/@unityvolrend
MIT License
448 stars 127 forks source link

Performance in VR (Lagging issues in Oculus Quest 2) #135

Open bittu97 opened 1 year ago

bittu97 commented 1 year ago

Lagging issues are there even though I followed the VR Performance instructions provided on the readme of the GitHub link.

  1. define MAX_NUM_STEPS to 100 (also tried by tuning MAX_NUM_STEPS of other functions too)

  2. and deleted this line: #pragma multi_compile DEPTHWRITE_ON DEPTHWRITE_OFF

It starts lagging when it is rendering the Model, I observed, if the model is not inside the camera field range, the application is working fine, and when the model is in front of us it starts lagging. If we go closer to the 3D-Model it lags increasingly and the application goes out of control.

mlavik1 commented 1 year ago

Hmm, I don't have an Oculus Quest 2 (or any VR headsets at the moment) to test with, so it's difficult for me to be helpful here, since I can't do any profiling.. It's expected that performance is worse when looking closely at the model (since more pixels are visible then), but the last time I tried with a VR headset the performance was still quite Ok. That was not a standalone headset, like Quest 2, and I had a relatively good GPU.

One thing I expect would help is to reduce the screen resolution, but it will look pixelated then. Do you also have poor performance with the other rendering modes? (isosurface, maximum intensity projection)

bittu97 commented 1 year ago

Hmm, I don't have an Oculus Quest 2 (or any VR headsets at the moment) to test with, so it's difficult for me to be helpful here, since I can't do any profiling.. It's expected that performance is worse when looking closely at the model (since more pixels are visible then), but the last time I tried with a VR headset the performance was still quite Ok. That was not a standalone headset, like Quest 2, and I had a relatively good GPU.

One thing I expect would help is to reduce the screen resolution, but it will look pixelated then. Do you also have poor performance with the other rendering modes? (isosurface, maximum intensity projection)

Yes, I have tried the maximum possible ways from my side. Also tried changing the transfer functions by tuning density and opacity, but nothing works.

mlavik1 commented 1 year ago

Then I'm not sure.. Sorry! I'm hoping to get a VR headset I can test with soon, so I can do some performance profiling for VR.

Only think I can think of is: If it helps to turn down the screen resolution, you might be able to get a performance boost by using DLSS. But AFAIK Unity only supports that in HDRP render pipeline, and I'm not sure if the shader is going to work with that out of the box. (see #130 )

mlavik1 commented 1 year ago

Hi again! So it seems like the project works well with HDRP (just add HDRP package, and do auto-upgrade). Not sure about VR though.. but if it works there as well, you could give DLSS a try! https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@12.0/manual/deep-learning-super-sampling-in-hdrp.html

bittu97 commented 1 year ago

Hi again! So it seems like the project works well with HDRP (just add HDRP package, and do auto-upgrade). Not sure about VR though.. but if it works there as well, you could give DLSS a try! https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@12.0/manual/deep-learning-super-sampling-in-hdrp.html

Hi buddy, For now, I implemented a workaround by adjusting the near-clipping plane of the camera.

I'll try that too. I have one more doubt, as it is working quite decent on VR Devices, after that I tried building the app on SmartPhones too and the application keeps stopping.

mlavik1 commented 1 year ago

Ok, thanks for the feedback! I'll try building it on Android to see.

bittu97 commented 1 year ago

Ok, thanks for the feedback! I'll try building it on Android to see.

ok thanks, I am confused that the 3D Model displayed is a runtime display of data points or it's a static mesh generated after scanning the raw data.

mlavik1 commented 1 year ago

Ah yes, so it's not a static mesh :) It's real-time raymarched volumetric data.