How to accurately shade an object while texture painting I'm trying to initiate the process of texture-painting in this object but when I turn to the texture paint mode, the object turns flat. All the shadows are gone.

Searching for some explanations, I found out that the solution is just to open the overlays menu and turn the Texture Paint opacity to zero. Turns out this does not solve the problem, since I need the shading elements to a texture-painting I can see, like in the second image, down below.

How can I solve that?
Perhaps you just need to turn on the Shadow and Cavity in Viewport Shading tab as below: