Learn how to recreate an expensive, professional soccer offside VAR system using a single camera and open-source computer vision tools. By combining Roboflow's RF-DETR for player detection and SAM3D Body for 3D reconstruction, anyone can turn standard video footage into a 3D offside verdict.
If you've watched any soccer recently, you've seen it: a goal gets scored, the celebration starts, and then everything freezes and a verdict appears. Offside. It looks like magic. It is also extremely expensive.
The semi-automated offside systems used at the top of the professional game are impressive engineering, but out of reach for the average person. They can cost over $1 million to install/operate, rely on a rig of synchronized cameras around the stadium, and need a team of operators in a control room.
I wanted to build a tool that could take any footage and run the same analysis for free.

How the 3D soccer offside (VAR) system works
The pipeline takes one video clip from any camera and turns it into an offside verdict in under 30 seconds. Walking through it end to end:
- Upload and scrub the clip to the frame where the ball is played.
- Auto-detect pitch lines so the system knows the pitch geometry and the scene's vanishing point. If auto-detection is inaccurate, you can manually select 4 points to draw 2 lines.
- Detect the players in the frame (this runs on GPU and gets cached per frame).
- Select the players that matter for the call: the attacker and the relevant defenders. You can select as many or as few players as you want.
- Reconstruct the selected players in 3D (also on GPU, and only for the players you picked, to keep it fast).
- Place them on the pitch in a top-down, metric coordinate system.
- Render the 3D scene and the verdict.



The tech under the hood
There are really three computer-vision problems hiding inside "is this player offside," and each gets its own tool:
- Player detection uses RF-DETR (can be adjusted for other COCO-trained detectors). This is what finds every person in the frame.
- Line detection uses plain HSV color matching to pick out the pitch markings. No deep learning needed as the lines are a known color, so classical methods are fast and reliable. There is a backup option to manually select 4 points to draw 2 lines.
- 3D reconstruction uses SAM3D Body to recover human body shape and position from a single image. That's what lets the system rebuild a believable 3D human from one monocular frame.
Stitch those together and you can take a flat broadcast (or amateur) frame, lift the relevant players into 3D, drop them onto a metric pitch, and draw the offside plane through them.

Seeing the 3D soccer offside (VAR) system work
The fun part is watching the reconstruction come together. The pipeline detects the players and the goal-parallel lines on the original footage, then rebuilds the moment as a 3D scene you can rotate. When an attacker is clearly past the last defender, the plane makes it obvious in a way a 2D line drawn on a broadcast never quite does.
Sample offside 3D recreation with many players
Democratizing computer vision
Can single-camera offside detection match FIFA's multi-camera VAR? Not exactly. Monocular reconstruction is less certain, but the results are very promising. The upside is that this system can run on a phone video, for about $2 in GPU costs per match.

The best part... Offside VAR runs on any footage, available to everyone! Even your kid's local game shot on an iPhone. It's World Cup tech, with access for everyone.


Try it yourself
The project is live as a Hugging Face space. To get started:
- Go to the Hugging Face space https://huggingface.co/spaces/mirrash7/VAR
- Click the three dots at the top of the page
- "Duplicate this Space"
- Connect to a GPU (ideally L4 or better)
- Upload a clip, mark the players, and get a 3D verdict

Cite this Post
Use the following entry to cite this post in your research:
Alexei Alexandrovich. (Jul 3, 2026). Build a 3D Soccer Offside (VAR) System. Roboflow Blog: https://blog.roboflow.com/build-a-3d-soccer-offside-var-system/