My parents thought it was nice to develop my imagination but they never seriously thought that anything would ever come of it. They said that I couldn't be an actress because I would be taller than all my leading men so I thought I would be a writer instead.
Sometimes a character is really based on research that you do. Other times it's just based on your imagination or perhaps your conversation with the director. Or sometimes all of the above. It depends on the movie and character.