Apparatus for painting an object, in particular a car body part, said apparatus comprising: - a painting head equipped with at least one spraying nozzle arranged to deliver a flow of paint of a predetermined colour on a surface of said object; - a moving means for moving said painting head in a workspace, said moving means having at least two degrees of freedom; characterized in that it further comprises: - an identification device for identifying the three-dimensional shape of said surface of said object, said identification device being integral to said painting head and comprising: - an infrared projection means arranged to project a grid, or matrix, of points on said surface of said object obtaining a projected image comprising a plurality of points; - an optical sensor means arranged to detect said projected image on said object obtaining a detected projected image, said detected projected image comprising a plurality of points, or pixels, having determined spatial coordinates (x,y,z); - a processing means arranged to receive said detected projected image from said optical sensor means and to determine said spatial coordinates (x, y, z) of each of said points of said projected image in such a way to determine the three-dimensional shape of said surface; in that said moving means is arranged to move said painting head in said workspace on the basis of said determined spatial coordinates of said points in such a way that during said painting step of said object said spraying nozzle is arranged at a substantially fixed distance from said surface to be painted and is able to follow its curvature; and in that said processing means is arranged to process said three-dimensional shape to obtain a corresponding two-dimensional geometric shape, said processing means arranged to process said grey-level values of said points, or pixels, of said three-dimensional shape, and therefore the distance of said points, or pixels, from said sensor means to obtain said corresponding two-dimensional geometric shape. - a painting head equipped with at least one spraying nozzle arranged to deliver a flow of paint of a predetermined colour on a surface of said object; - a moving means for moving said painting head in a workspace, said moving means having at least two degrees of freedom; - an identification device for identifying the three-dimensional shape of said surface of said object, said identification device being integral to said painting head and comprising: - an infrared projection means arranged to project a grid, or matrix, of points on said surface of said object obtaining a projected image comprising a plurality of points; - an optical sensor means arranged to detect said projected image on said object obtaining a detected projected image, said detected projected image comprising a plurality of points, or pixels, having determined spatial coordinates (x,y,z); - a processing means arranged to receive said detected projected image from said optical sensor means and to determine said spatial coordinates (x, y, z) of each of said points of said projected image in such a way to determine the three-dimensional shape of said surface; - an infrared projection means arranged to project a grid, or matrix, of points on said surface of said object obtaining a projected image comprising a plurality of points; - an optical sensor means arranged to detect said projected image on said object obtaining a detected projected image, said detected projected image comprising a plurality of points, or pixels, having determined spatial coordinates (x,y,z); - a processing means arranged to receive said detected projected image from said optical sensor means and to determine said spatial coordinates (x, y, z) of each of said points of said projected image in such a way to determine the three-dimensional shape of said surface;