During the process of plastic deformation, the mechanical response of materials is often influenced by stress states and anisotropic effects, and many existing yield functions are difficult to characterize this phenomenon accurately. This article proposes a yield function based on stress invariants that can encompass a variety of existing relevant models and further expand upon them, conducts parameter sensitivity analysis and concavity convex analysis, and analytically calculates the function parameters under four fundamental stress states. The strain-hardening behavior of four metals, AA7075-T6, QP1180, AA5754-O, and DP980, was described using this function. The advantages and disadvantages of parameter analysis calculation and fitting calculation methods were analyzed. On this basis, the nonlinear dependence of the hydrostatic pressure of the function is expanded and used to describe the yield behavior of three metal foams, namely low-density, high-density, and Duocel, and the failure behavior of rock materials. Extend the function to anisotropy using the Balat'91 linear transformation tensor to describe the anisotropic yield behavior of AA2008-T4, using the interpolation method to describe the anisotropic hardening behavior of zirconium plates. The results show that the yield function proposed in this paper can accurately predict the anisotropic yield and hardening behavior of metal materials, foam metal yield behavior, and geotechnical materials' fracture characteristics.