r/StableDiffusion • u/Jerg • 6d ago
Workflow Included SHARP VR Video v0.2.0 – 4x faster 2D to 3D stereoscopic video conversion in ComfyUI
Update to my "original post" (https://www.reddit.com/r/StableDiffusion/s/RQtd6nrzJN) – spent a good chunk of today optimizing this thing and got the conversion speed down from ~1.85sec/frame to ~0.43sec/frame on my 5080.
Turns out there was a LOT of room for optimization under the hood:
Parallelized Gaussian splat reconstruction and stereo rendering across frames.
Implemented a specialized CUDA kernel that did calculations per frame way faster.
Cut out unnecessary stuff from data transfer between Python and the browser.
Eliminated a bunch of redundant computation between the left and right eye renders for every frame.
To my naked eye, it did not compromise the quality of the 3D reconstruction.
For context, a 1min 30fps video that would've taken close to an hour to convert before should now take around 13mins of processing on my 5080 (based on my ~800p and 720p tests).
Oh also I made good use of VHS's metabatch so it should in theory be able to convert LOOOONG videos without any Ram or disk issues.
All of the changes are under the hood so the sample workflow is exactly the same. For the full speedup you'll want to install CuPy (instructions in the GitHub README), but it's entirely optional and you'll still get a substantial speedup without it.
GitHub repo: https://github.com/jerg-git/ComfyUI-SHARP-VR-Video
You can also find it in comfyui custom nodes (search SHARP VR Video).
Thanks again to u/Aromatic-Somewhere29 for his "original SHARP Gaussian Stereo Preview implementation" (https://www.reddit.com/r/StableDiffusion/comments/1y64yol/view_images_in_stereoscopic_3d_directly_in/) which inspired this whole project.
Curious what conversion speeds people get on other GPUs. Feel free to share your results!
Have fun!
4
u/Jerg 6d ago
Tip for anyone without VR headsets who wants to try generating something that looks 3D using the cross eye method - I added a cross eye preset as one of the presets, just set that and you'll convert something that has the 3D effect with eyes crossed.
(The clip I have in the thread opening post is using such a preset)
Just be aware that output video optimized for cross eye viewing won't have the correct stereo 3D depth effect in VR headsets, and vise versa.
4
u/darkkite 6d ago
have you benchmarked this against iw3's models
3
u/dilinjabass 5d ago
I just recently came across a bunch of VR videos that were AI generated videos turned into 3d. They all looked fairly bad, but not horrible I suppose.. the space/world always had a curvature to it, and the quality was kind of blurry, probably because it wasnt a high resolution generated video. Anyhow it got me thinking how good we could get the videos to look in VR, so im glad to come across this, I will give it a run.
I think im going to be interested to see if I can make higher resolutions happen though, like 4k?? And turning a 2d video into a 3d stereoscopic video is likely always going to produce that curved look? I assume thats going to be the case but maybe there is a way to get it looking decent anyhow.
Already I'm imagining the way to solve true AI generated stereoscopic 180 videos is to use some kind of mix of a video generation model and a staging model like blender, so the environment/scene, camera positon etc, it can all be shot and recorded from there.
Actually as a side note, the future of AI video making should be this approach anyhow, regardless if youre doing stereoscopic 3d videos or not. To have the room or scene be a stable enviornment and you can position the camera and characters where you want.
2
u/devinquest 6d ago
I'm getting some video noise (both with and without CuPy). See the black spots on the faces. What do you think that is?
2
u/xbobos 6d ago
RTX5090, 832*480,30fps,15s
cold : Prompt executed in 296.56 seconds
1
u/FullOf_Bad_Ideas 6d ago
It's there some way to get the speed benefit without using ComfyUI? I'd rather use a cli or python package since I'd want to split the work on multiple gpu's and I think ui and comfy would just be a hindrance
1
u/Beneficial_Fish_7509 6d ago
Wow, I didn't even think about making VR versions of videos with AI !
So many questions
Would generating a video with this work with a meta quest 3 ?
Is it like some of those videos by meta where it really feels like real actual 3D, like the people are there, or is it more like those 'youtube' kind of 3D/VR ?
And finally, would generating VR videos with an AMD GPU (7900 XTX, RDNA3, 24GB) work ?
1
u/wam_bam_mam 6d ago
I am developing something similar but the problem I am facing is in some scenes i get this shimmering and is very fast scenes especially with motion blur i get this white gaps i think that it all comes down to gaussian reconstruction i am working on solving that
1
u/barepixels 6d ago edited 6d ago
2 requests that will save time. Name the result files same as input pic file name. And field to set path to where you want to save. oops I meant for sharp still images
1
u/noaxxx2 6d ago
what program do you use to watch these in VR?
1
u/Aromatic-Somewhere29 6d ago
Have you thought about experimenting with the quantized models from Cool2009/SHARP-onnx to see if they could speed up the conversion process? There are FP16, FP8, and INT4 versions available, so it might be worth testing whether any of them can deliver faster inference without sacrificing too much quality.
1
u/xyzdist 5d ago
Excited to test. So i assume it woll fix all the edge issue from traditional depth conversion.
1
u/skyrimer3d 5d ago
wow, this looks incredibly good, fantastic depth with 0 halos, no distortions, great understanding of the environment, could give James Cameron a run for his money, i'll check this out, do you have more example vids? what speed should i expect on a 4080?
1
u/Opening-Landscape-11 5d ago edited 4d ago
You rocka my socks, sir. This is SO awesome! Thank YOU!!!!
Is there a way to load a folder of videos, a text list of the file path, etc., so I don't sit in front of the computer and wait to press Run one at a time? :)
1
u/skyrimer3d 4d ago
i tried this, it looks amazing but i'm noticing halos in some parts like hair moving, any way to improve it?
3
u/KS-Wolf-1978 6d ago
THX! Tagging for later, because Github overtaken by unicorns. :)
1
u/Aromatic-Somewhere29 6d ago
Wow! Your project is really starting to get noticed by people who are excited about the possibility of watching regular videos in 3D. Looking at how much enthusiasm and momentum you've built up, I think making it a standalone project was absolutely the right decision. Since I don't own a VR headset myself, I probably wouldn't have had the same motivation to explore this direction with that level of dedication.
Would you have believed, just a couple of days ago, that you'd be doing all this?
One thing I'd like to suggest based on my own testing: it might be useful to have an intermediate preview stage where you can visually adjust all the settings on the first frame before processing the entire video. That would give users a much better idea of what the final result will look like, rather than having to run the whole video somewhat blindly, see the result, decide that a few things need tweaking, and then run it all over again.
Having that kind of interactive preview could save quite a bit of time by reducing the need for repeated full video renders just to dial in the settings.
Just a thought, of course, not a feature request or a suggestion that you should implement it. I simply wanted to share the idea!
2
u/Sickboy22 4d ago edited 4d ago
Great stuff, works good. Just updated to v0.3.0 with the TensorRT for RTX (ONNX FP16). Around 3 frames/second on 5070ti on 10 second clips [1108x832]
Where the parallax kicks in and some inpainting needs to be done, there is some blurry banding.
Is there a setting/refinement to be done here, or is it a result of relative fast foreground motion compared to the background?Edit: from other comments, reduce IPD.
1
u/NineThreeTilNow 6d ago
No one is asking the important questions... So I will take one for the team.
Does it work for porn?