I do a lot of painting, from my imagination as well as references... I have to think through where a shadow would go, I also doodle a lot and try and work stuff out by talking to myself! I reckon its mainly just lots of practice, and even so I get stuff wrong.. I really admire the people here who are photorealistic!
drawn in 39 min