Unity appears to have updated the document page after 5.3, where a checkerboard culling script
Https://docs.unity3d.com/Manual/SL-ShaderSemantics.html
I added a bit of comment and parameter control, the code is as follows:
Shader"Unlit/screen Position"{Properties {_maintex ("Texture", 2D) =" White"{} _sizefactor ("Sizefactor",float) =0.25} subshader {cull Off Blend srcalpha oneminussrcalpha tags {"Queue"="Transparent" "Rendertype"="Transparent"} Pass {Cgprogram#pragmaVertex vert#pragmaFragment Frag#pragmaTarget 3.0structv2f {float2 uv:texcoord0; }; v2f Vert (float4 vertex:position, Float2 uv:texcoord0, outfloat4 outpos:sv_position) {v2f o; O.uv=UV; Outpos=Mul (UNITY_MATRIX_MVP, vertex); returno; } sampler2d _maintex; float_sizefactor; Fixed4 Frag (v2f i, Unity_vpos_type screenpos:vpos): sv_target {//Presumably, after unity5.3, a set of parameter passes is added, which can pass in the vertex ID in the vertex shader, or pass in the screen position and so on. //The Screenpos used here is not a 0-1 range, but a real place like 960x480. //There are a number of new additions, specific to the documentation.Screenpos.xy= Floor (SCREENPOS.XY * _sizefactor) *0.5;//multiplying by 0.5 is divided by 2, so there are only two remainder results. 5 and 0. floatChecker =-frac (SCREENPOS.R + SCREENPOS.G);//here Frac is to obtain the remainder part, take negative number is because of the following clip function. //So the result is-5 and 0. //The clip function only determines positive or negative numbers, and does not render if negative. This way-the value of 5 will not be rendered.Clip (checker); Fixed4 C=tex2d (_maintex, I.UV); returnC; } ENDCG} }}
Final effect (change _sizefactor to adjust checkerboard size):
This culling effect can be used either near the camera or on objects with low Lod in the distance (trees, etc.) to improve performance.
Unity's checkerboard culling shader