//do culling test in clip space, result is the same as doing test in NDC space. //prefer clip space here because doing culling test in clip space is faster than doing culling test in NDC, because we can skip 1 division. //the test is using OpenGL standard projection matrix, because all matrix from unity C# is OpenGL standard //if instance is inside camera frustum, and is within draw distance, we append it to _VisibleInstanceOnlyTransformBuffer //y test allow 50% more threshold (hardcode for grass) //x test allow 10% more threshold (hardcode for grass) if (absPosCS.z <= absPosCS.w && absPosCS.y <= absPosCS.w*1.5 && absPosCS.x <= absPosCS.w*1.1 && absPosCS.w <= _MaxDrawDistance) _VisibleInstancesOnlyPosWSIDBuffer.Append(id.x + _StartOffset);