This is what I got.
Again, this will work only with tight and not intersecting meshes only.

Cubes have a ColorMask 0 material (plus this wireframe one for visualisation).
The cutting plane has two materials varying with stencil values.
Two pass shader for the cubes:
Shader "Custom/SectionOnly"
{
Properties
{
_StencilMask("Stencil Mask", Range(0, 255)) = 0
[Enum(None,0,Alpha,1,Red,8,Green,4,Blue,2,RGB,14,RGBA,15)] _ColorMask("Color Mask", Int) = 0
_SectionPoint("_SectionPoint", Vector) = (0,0,0,1)
_SectionPlane("_SectionPlane", Vector) = (1,0,0,1)
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry+1" }
LOD 100
Pass
{
ColorMask[_ColorMask]
Cull Off
Stencil
{
Ref[_StencilMask]
Comp Always
PassBack Replace
PassFront Zero
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
uniform float3 _SectionPlane;
uniform float3 _SectionPoint;
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 wpos : TEXCOORD1;
UNITY_FOG_COORDS(0)
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
UNITY_INITIALIZE_OUTPUT(v2f, o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.wpos = mul(unity_ObjectToWorld, v.vertex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
static const bool _frontSide = (dot(_WorldSpaceCameraPos - _SectionPoint, _SectionPlane) > 0);
fixed4 frag (v2f i) : SV_Target
{
if ((dot((i.wpos - _SectionPoint), _SectionPlane) > 0)== _frontSide) discard;
fixed4 col = fixed4(0.5,0.5,0.5,1);
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}
The plane shader:
Shader "Custom/CapUnlit"
{
Properties
{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB)", 2D) = "white" {}
_StencilMask("Stencil Mask", Range(0, 255)) = 1
[Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Int) = 3
}
SubShader
{
Tags { "RenderType" = "Opaque" "Queue" = "Geometry+2" }
LOD 100
Pass
{
Cull Off
Stencil
{
Ref[_StencilMask]
Comp[_StencilComp]
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// make fog work
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
UNITY_FOG_COORDS(1)
float4 vertex : SV_POSITION;
};
sampler2D _MainTex;
float4 _MainTex_ST;
fixed4 _Color;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
UNITY_TRANSFER_FOG(o,o.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
// sample the texture
fixed4 col = tex2D(_MainTex, i.uv)*_Color;
// apply fog
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}
}