This paper presents formulations for hybrid casting and additive manufacturing (AM) in the density-based topology optimization. A location-based Heaviside function is introduced to represent the parting surface. The optimized part on two sides of the parting surface can be fabricated with casting, additive manufacturing, or both. Through the location-based Heaviside function and density gradient, two global constraints are formulated to remove undercuts and overhangs for casting and AM, respectively, inside the design domain. Since density gradient vanishes on the design domain boundary, two extra density-based global constraints are developed to control the overhangs and undercuts outside the design domain. Due to the smoothed parameterization of the parting surface, we are able to optimize the part and partition surface (including location and parting direction) simultaneously for hybrid casting and additive manufacturing. The proposed formulations for hybrid manufacturing processes are validated through 2D and 3D numerical examples. The proposed approach further enlarges the design space with manufacturing constraints, and has the potential to be used in the design for hybrid and multi-component manufacturing.