I found this on a reddit post and then worked with claude to add extensive improvements as well as making it Windows friendly.
It utilizes SAM3 and MatAnyone2 machine learning models to identify the model shape and create a very good mask of the subject for incredibly good passthrough VR video creation. Videos can then be watched on Heresphere without issue with passthrough enabled. It also handles clothed subjects just fine! So cosplay enthusiasts rejoice!
To be 100% clear, the SAM3 and MatAnyone2 scripts DO NOT add any generative AI content, they are finetuned machine learning models created to detect and mask, in this case, human subjects. The SAM3 woman detection model here is pretty unreal in it’s ability to detect and mask the female model/subject, even clothed.
Requires CUDA enabled cards with CUDA 12.8, PyTorch 2.6 and Python 3.12.
Reddit Post - https://www.reddit.com/r/oculusnsfw/comments/1t5li6v/i_made_a_free_masking_tool_to_turn_vr_videos_into/
My Changes (With Claudes Help)
Now supports failure recovery and error log creation.
- You can stop and restart really long jobs without having to redo every previous step.
Supports dual eye frame processing for segments. - Requires pretty beefy cards with a lot of VRAM.
- Best speeds with 5090, 4090 and 3090s with their 24+gb of VRAM.
Automatic video frame identification for perfect syncing between video and mask.
Smart transition detection so areas of black are not created if the model is visible between both frames of a fade or cut.
Full Windows Support - requires installation of triton through python
One script does everything - converts 180 VR video to fisheye, creates the masking, and puts the video back together.
Fixed a lot of bugs in the previous version
Batch files for simple drag and drop video conversion.
Context, I had tried making passthrough videos previously with the scripts made by @blewClue215 and while okay, could never really get to the quality of passthrough videos seen on SLR. SLR for a brief period of time allowed members to create their own passthrough videos but then killed the service shortly after, so I was looking for a better way to create passthrough videos from my existing library. I stumbled on the reddit post and started hacking my way through the scripts with Claudes help to add Windows support and I was able to do that while also improving the pipeline massively and making it easier to work with.
Directions - windows_setup.txt
WINDOWS_SETUP.txt (14.5 KB)
I would ignore the instructions in the original linked github as it’s setup for linux or wsl2 environments specifically. Please follow the instructions in this document. They should work as this is what I did to get it working on my machine.
My New Scripts - The following scripts were heavily edited by Claude to fix a lot of bugs and add features that I suggested to make the process way easier and not require a linux or WSL2 environment to run.
pipeline.txt (84.2 KB)
ffmpeg_utils.txt (22.3 KB)
matanyone_runner.txt (4.0 KB)
sam3_utils.txt (10.9 KB)
inference_matanyone2.txt (9.0 KB)
pipeline.txt - grab the file, drop it into your vr-masking-tools directory, delete the existing pipeline.py file and change the file extension of the txt file to .py
utils/ffmpeg_utils.txt - grab the file, drop it into your vr-masking-tools/utils directory, delete the existing ffmpeg_utils.py file and change the file extension of the txt file to .py
utls/matanyone_runner.txt - grab the file, drop it into your vr-masking-tools/utils directory, delete the existing matanyone_runner.py file and change the file extension of the txt file to .py
utils/sam3_utils.txt - grab the file, drop it into your vr-masking-tools/utils directory, delete the existing sam3_utils.py file and change the file extension of the txt file to .py
inference_matanyone2.txt - grab the file, drop it into your vr-masking-tools/MatAnyone2 directory, delete the existing inference_matanyone2.py file and change the file extension of the txt file to .py
Batch Files
run.txt (580 Bytes)
run_fast.txt (625 Bytes)
unlock_nvenc.txt (1007 Bytes)
run.txt - drop this into your vr-masking-tools folder and change the extension from .txt to .bat - this starts a normal conversion run on the video file you drop onto it.
runfast.txt - drop this into your vr-masking-tools folder and change the extension from .txt to .bat - this starts a super optimized conversion run on the video file you drop onto it. best for testing the pipeline with a much smaller 1 to 2 minute to clip to test that its working and that the output is acceptable.
unlock_nvenc.txt - drop this anywhere and change the .txt to .bat - this will likely require administrator privileges. it modifies the registry to remove the nvenc session limit that is hardcoded for all nvidia video cards.
Support Note - I will do my best to support folks in here, but I am not a programmer, so I likely won’t be able to fix actual programming issues if they pop up. Also remember that Claude worked to try and make this as optimal for my 3090 machine as possible. You’re likely to struggle if you have an old nvidia card or have less than 8gb of VRAM.
AMD video cards are not supported, this requires Nvidia cards from the 3xxx generation and forward afaik.
Good luck! I may add two small 1 minute clips later so folks can get a preview of what this pipeline is capable of! It legitimately shocked me how good it was! I was able to fully convert an older 4k VRCosplayX video overnight in about 4-5 hours and the quality is pretty good! The only issue with all of this is that it converts everything into fisheye190. But if you’re of the coder type and can figure out how to make this work without doing that, feel free to upgrade the script!
DO NOT SELL ANYTHING MADE WITH THIS! - This is using the MIT Matlab license which is free to use for personal use, reach out to them as instructed in the original github posted if you’re interested in commercial use.
I am not responsible for anything that could happen to your GPU when running this pipeline. It’s more intense than any sort of gaming experience for it’s continuous use. A more detailed disclaimer is included in the windows setup document.






