-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
IW3 - Any possibility of a realtime mode? #319
Comments
If you specify However, those who want realtime actually expect to be able to choose the video they want to play from the VR headset. |
@nagadomi Thank you for the response! What I’m suggesting isn’t about watching a file while it’s being converted. It’s rather about applying the depth estimation and 3D conversion in real-time to anything displayed on a PC screen, including games, web videos, or live streams. Essentially, the idea would be to process frames dynamically as they appear, rather than converting a pre-existing video file. The reason I brought up Virtual Desktop is that it already allows you to stream your PC screen to VR with SBS support. If IW3 had a real-time mode, it could theoretically take the live video feed from a PC screen and apply its depth-based conversion before sending it to VR, effectively turning anything you see into 3D. |
Maybe it is technically possible.
However, the results other than full screen playback maybe not good. |
If it's a toy level (HTML5 Video player with MJPEG stream, maybe laggy), |
I implemented this. |
If anyone gets interested, please give it a try. switch to the dev branch first. then see |
I tested it, and I’m genuinely impressed that you were able to implement this in just one day, it works pretty good! I had a couple of questions and suggestions regarding performance optimizations:
Let me know what you think! I’d be happy to test any further improvements. |
Little follow-up to my last message: I wanted to propose an additional optimization that could help improve performance in real-time mode. Instead of processing depth estimation for every frame, an adaptive motion-based depth frame skipping mechanism could be implemented. The idea is to dynamically adjust depth processing frequency based on motion intensity:
Combining motion-based depth frame skipping + depth frame skipping with with interpolation + proper batch size implementation for real-time mode (may already exist, but my testing didn’t yield noticeable improvements) could lead to significantly better performance and higher FPS. |
I will consider improving the FPS, but when using Any_V2_S, it seems that the performance of depth estimation model is not a bottleneck. On my machine(RTX3070Ti), the performance of Any_V2_S(resolution=392) itself can achieve about 120 FPS even with batch-size=1. Increasing the batch size will be helpful for improvement because it can improve everything including device memory transfer, image resizing and warping, etc. |
Wait, what? I'm barely getting 17 FPS in normal mode and around 7–9 FPS in desktop mode. My specs: Any idea what could be causing this? |
I made some minor improvements to iw3.desktop. 14FPS->24FPS. JPEG encoding was slow, I changed that. 120 FPS is the performance of the depth estimation model itself, not the video conversion. nunif/iw3/depth_anything_model.py Lines 235 to 252 in b3a5208
I changed B = 4 -> B = 1 , Any_L -> Any_V2_S ,then
Video conversion speed depends on the resolution of the input video, but can achieve 30 FPS(*1) for HD and 100 FPS for SD on my machine. If you think your env is too slow, check the following.
other settings are default values |
After implementing these changes, my performance has improved to around 15-17 FPS on average, already a good improvement. Do you have any additional ideas for further optimizing performance? Also, I believe the following features would greatly enhance usability, particularly when the user is not directly in front of the PC:
|
Hi, first of all, nice work! I can get over 800fps in the benchmark if I set batch size = 8, but only about 27fps streaming, my specs: it seems that changing the preset, model or CRF etc, makes little to no effect |
I parallelized screenshot and 3D conversion. on my machine improved 24FPS -> 48FPS.
iw3.desktop uses JPEG sequential images(MJPEG) not video codec, so those options are ignored. EDIT: |
That last update really helped, I'm getting ~60fps. It is still very stuttery, but much better than before. |
this is dream come true for me! I only have 14 streaming frames though on 4070ti. this is the same if i stream localy on my pc and also while watching on my browser app in mibox. Any way i can increase that stream speed. i'm currently using command : python -m iw3.desktop --depth-model Any_V2_S --divergence 2.75 --convergence 0.7 Thank you so much for doing this. if i can get it to 20-25 frames that would be amazing! |
@Salmaun321 @loawizard Also note that while iw3.desktop web page is open on the PC side, performance will be degraded due to browser rendering load. |
With the full-sbs option the aspect ratio was solved, but I noticed another issue. When I start the stream it reaches 60+fps, then over time stabilizes to ~40 while on the desktop, but as soon as I open any fullscreen video it gradually drops to ~12fps, and never returns above that |
Does anyone know how to watch on the apple vision pro? Safari browser does not seem to play the sbs in 3d. |
@Salmaun321 |
@francdn Is the video not animated and only the first frame is displayed? Or no image is shown at all? |
The video plays but not in 3d. I can only see the sbs image. |
This can be used with any VR video player that allows playback by specifying a video URL(and MJPEG video), but I don't know which players support it. |
Dude, you're awesome, now its playing at 28fps very stable. Still lacks audio, but man, that's incredible, anything real time 2d to 3d better than any pre rendered movie, fucking awesome |
Thank you. |
got Estimated FPS = 19.85, Streaming FPS ! much better already! python -m iw3.desktop --depth-model Any_V2_S --divergence 2.75 --convergence 0.7 --batch-size 2 --stream-fps 30 anyway i can crank it up a bit more or have we reached the limit? 4070ti |
Even if you close the web browser, does it still only run at 20 FPS? |
@loawizard |
@nagadomi Can you please add audio streaming? |
@IkariDevGIT |
@nagadomi Would it be too complicated to make run the streaming server in https? |
@francdn |
Just secure streaming. |
I vote for window capturing support cause I don't have two screens but one glasses-free 3d screen on my desktop. |
@francdn However, it is not recommended to use iw3.desktop on networks that are not managed by you, such as FreeWiFi. |
@tufeixp |
I'm a user of lenovo 27 inches 3d monitor, see : https://www.lenovo.com/nl/nl/p/accessories-and-software/monitors/professional/63f1uar3eu?msockid=2856b3b76490673105dca7fa65f666c5 |
@tufeixp Your request is to convert application windows on one monitor to 3D and view it on the same monitor? |
Yes, in that way I'm able to watch youtube 2d videos and play games in 3d on the same monitor, makes sense for everybody! |
@tufeixp Anyway, that is different from my intended use, so that support will be later. |
Yes, it has built-in support for all kinds of 3d contents, including SBS media. |
If that could be possible it would be could than I can hook up my projector through HDMI. But how can you capture something in 3d on one screen and display it on same one . That doesn't sound like something that's possibly. If we can capture something on one screen. And display it on another monitor through HDMI . Makes more sense to me |
Is there anything we have to do so see the cursor in windows? I don't see it with pil. |
@francdn Don't you see these green circles or squares anywhere? |
@francdn |
@francdn |
Thanks a lot. I will try later. |
if i dont set it higher then 30 i get 20 fps if i set it to 60 i get steaming fps of 35-36 |
@loawizard
|
@loawizard |
I think this "motion detection", is what is causing the stuttering. if the screenshot fps is constant and locked to the stream fps the playback would be smoother |
@Salmaun321 |
@Salmaun321 |
I just tried the gui and the python code i used earlier. fresh reinstall. for some reason it was extremely choppy and my browser on my android tv kept on crashing so unusable so far i will try the other ones that are not wc_mp |
yeah it crashes all my android browsers no matter what settings I choose |
@loawizard Did iw3-desktop work in that environment before? |
For now, I changed it to render with requestAnimationFrame again. |
Hey @nagadomi, thanks for merging realtime mode into main and for all the improvements so far. I’m still hitting a critical bottleneck with the current streaming method. The 30 FPS limit, along with browser lag and no audio support, is becoming a real issue for my use cases. I realize I’ve asked a couple of times before, but now it’s impacting practical usability significantly. Is there any possibility of exploring another streaming method, perhaps leveraging a different protocol (like WebRTC) or another approach to optimize performance? I’m more than happy to test out any potential changes or provide further feedback. And again, i am sorry for asking this so much, but this is kind of crucial at this point. Thanks again for your hard work! I definitely noticed the faster overall performance so far tho, so good job on that! |
@IkariDevGIT Once Torch 2.7 is released, GPU JPEG encoder will be available, so performance will improve even further. The protocol change might happen at some point later, perhaps in a few months, but it's not certain yet, as I haven't encountered any issues in my environment. |
I really think adding a real-time mode could be a solid addition. I don’t know all the technical details on how it would work under the hood, but the benefits are definitely there. Here are a few ways it could be useful:
To give some context on how this would even be used, there’s a program called Virtual Desktop that lets you remote into your PC using VR. It has an SBS mode, which means you can already watch anything on your PC in 3D if the output is SBS. If real-time support were possible, this could make that everything you see on your pc into 3D.
I actually think it would be pretty practical. I only have 12GB of VRAM and still manage to get around 26 FPS with IW3, and that’s with just a slight adjustment to the default config.
Not sure how realistic this is, but I’d love to hear your thoughts on it!
The text was updated successfully, but these errors were encountered: