"There's no CG — we captured that moment," says the creator of the HBO comedy, who describes the sequence as "horse porn."

Two years ago, Silicon Valley nearly broke the internet with its elaborate dick joke. Now in its third season, the HBO series is poised to do it again — this time with a horse dick.

On Sunday, the Mike Judge-created comedy served up a jaw-dropping scene featuring two thoroughbreds having sex (see below). The horse-humping takes place in the background as tech genius Richard Hendricks (Thomas Middleditch) attempts to have a serious conversation with newcomer Jack Barker (Stephen Tobolowsky) about the future of his startup.

But Richard, understandably, becomes distracted by the explicit act, which involves a very large, erect horse penis, lots of thrusting and, yes, even fluids. The graphic scene begs the question: Was it real? "Yes, they are really having sex," Judge, who directed the episode, tells The Hollywood Reporter. "There is no CG — we captured that moment."

Given the unconventional nature of the shoot and HBO's less-than-perfect track record with horses (see: David Milch's short-lived drama Luck), THR caught up with Judge to discuss how YouTube videos inspired the scene, the FBI raid that delayed filming and why they had to repeat the footage in the editing room ("The horses actually go very quickly," he says with a laugh).

So, the horses were really going at it?

Yep, it's real horse porn.

How did the idea originate?

Originally we had them at a vintage racetrack, but we just weren't finding anything funny about it. I think it was Dick Costello, the ex-Twitter CEO who was in the writers room part-time this season, who told us about a guy who had just blown a ton of money on racehorses. So we started talking about racehorses and looked on YouTube. That's where we saw these videos of them having sex and it was just making us laugh. That's how it started.

And then what did the next steps look like?

Well, we had to do a lot of horse research. We kind of had our hopes dashed at one point because someone was saying, "Oh no, it's all done artificially. They would never do that." But then we looked into it further and found out that most species of thoroughbreds will only inseminate naturally. So we just looked for a place where it was actually going to happen.

Are places like that fairly easy to find?

Well actually the first place we went to shoot it, if our camera crew had gotten there about 15 minutes later, they would have gotten arrested. The whole place was some kind of front for selling pot down in Temecula somewhere. The FBI raided it and there were all these cop cars there saying, "Turn around!" So we had to reschedule it for a couple weeks later.

Wow, so where did you actually end up filming?

Up in one of the canyons between Westlake and Malibu. We just had to look for places where this was going to happen already and just shoot it since it's all real.

How long did it take to get the money shot?

Oh, less than a minute. That's the only thing that's fake is, well, the horses actually go very quickly. So we had to repeat the footage some — not too much, but if you cut it all together, the horse just finishes really fast. It would not go on as long as that conversation Richard and Jack are having in the scene.

Do the horses need any sort of … encouraging?

Nope, the minute the male sees the mare in heat, no coaxing has to be done. (Laughs.) I mean, they go crazy. There's a bunch of videos on YouTube …

Did you have to do multiple takes?

No, just that one shot. We had lined up some other opportunities in case that other one didn't work. But after the first one, we were good. We just set up those cameras and they went at it.

Did you shoot the scene with the actors in front of the action or did you work some magic in post?

We did a little bit of combining. We shot the horses getting it on, got that out of the way and then did the dialogue. It wasn't happening entirely when they were talking — that would have been very difficult to coordinate, but they were definitely at the horse place.

How did everyone on set react?

There was lots of laughing and lots of, "Oh my god, this is crazy. I can't believe we're doing this." It was funny, you would see one person after another just [lose it]. I think their reaction was basically similar to what Thomas' character is doing in the show.

And you didn't have to cycle through multiple horses or anything?

No, just those two onscreen. They're hard to find, but we got very lucky that it all worked. I mean, I would have kept trying if we hadn't gotten those two. Like I said, the only thing that threw us off was the FBI raid, which is just insane.

What about the people onscreen who are holding the horses?

Those are the wranglers. Their job is to breed the horses. They're there because you have to be careful — the studs get so excited that they sometimes injure the mare. So they are there specifically to keep the horses from getting hurt during the process because the horses are obviously really valuable as is their sperm. (Laughs.) I didn't really know much at all about horses before this, so we had to get some horse experts involved.

I'm assuming the American Humane Association was also there to monitor things, yes?

Yeah, we had the American Humane Society reps who oversee things any time there's an animal. HBO is really good about that. One thing I learned about this is that in the artificial insemination process — which is not the method we used but is the more standard way to do it — there are these male horses who start having sex with the female horses but are then pulled off before they ejaculate. So basically, this horse's entire life is having sex not to completion and being blue balled. I think the Humane Society ought to get involved in that one because that's really cruel. (Laughs.)

Is that why you chose to go the natural route?

It's just more clear what's going on. And the artificial way just doesn't look as fun. (Laughs.) If you look closely on camera, you can see that the horse definitely finished.

What notes did HBO have?

It's funny, I actually have an email from [senior vp of comedy programming] Amy Gravitt where she said, "I can't believe I'm saying this, but can we have more screen time with the horses having sex?" She actually asked for more sex. (Laughs.) She was right though, so we put it behind some more shots than we originally had. You might as well go all the way, right?

Given that HBO has a questionable history of working with horses on Luck, what was their reaction when you pitched them a horse sex scene?

They were just very sensitive and wanted to make sure that we did everything right. They're very good about that. Obviously, none of us wanted any damage to be done to the horses. But this is something they do all the time since, well, the evolution of horses so there was never any risk.

Are you happy with how the scene turned out?

I have to say, I was a little worried about it, but I've seen it in front of an audience and it got huge laughs. It came off better than I had hoped. It's funny, in the writers room, we were like, "Has anybody done this before? It seems like someone would have done this before." But I guess no one has had the poor taste.