render.EnableClipping causing highly noticeable artifacts

So I have used my newly found knowledge of stencils to create portals, but clipping planes are giving me massive amounts of trouble.

Whenever I enable clipping in an RT cam, half of the portal either goes completely black, or goes half black.
Here is the formula I am using for clipping planes, credit to DMG Bobblehead from his portal gun.

local othernormal = exit:GetForward()
local otherdistance = othernormal:Dot( exit:GetPos() )
render.PushCustomClipPlane( othernormal, otherdistance )

Now it works great sometimes, but when my portals are placed at certain angles, funky stuff happens. I’ve seen no one else mention this kind of bug anywhere.



The clipping and portals do work, but it seems when the portals have the same normal or are within like, 90 degrees of being the same normal, they wig out.

90 degrees from each other

And here they are just being wonky…

(notice how the right side of the portal in the first few seconds turns black at certain angles)

Does anyone else experience this when using clipping planes for this sort of thing?

Here’s another video, this one is behaving differently. It renders players through it, but not the world at certain angles.