For each .proto file there is a canonical name and this name is used in the import statement. The canonical name is a relative file path name ("." and ".." is not allowed) and you can choose which directory to relative to by using the --proto_path argument properly.
For example, suppose you have a .proto file /foo/bar/baz.proto.
It's canonical name can be "foo/bar/baz.proto" if you compile it as:
protoc --proto_path=/ /foo/bar/baz.proto ...
Or it can be "bar/baz.proto" if you use:
protoc --proto_path=/foo /foo/bar/baz.proto ...
Generated files will have the same structure as the canonical name of the .proto file. So for the first command, it will generate foo/bar/baz.pb.(h|cc) and for the second one it will generate bar/baz.pb.(h|cc).
The name used in import statement must be the canonical name. When you have multiple .protos in different directories you can specify multiple --proto_path.
For example:
protoc --proto_path=/foo --proto_path=/test /foo/bar/baz.proto /test/test.proto ...
The canonical name for baz.proto will be "bar/baz.proto" and the name for test.proto will be "test.proto". If you want to import baz.proto in test.proto, you must use "bar/baz.proto", not "/foo/bar/baz.proto" or "../foo/bar/baz.proto".