Shooting on the Imtiaz Ali-directed project took place at Mumbai's Grant Road red light district.
"They (the sex workers) were very shy initially. They were reluctant about coming in front of the camera," said a production source.
"But Imtiaz and Ranbir spent some time talking to them and created a comfortable environment after which we commenced shooting."
The actor is then reported to have spoken with the sex workers, once the scene was completed.
"Once the shoot was over, some of them even took pictures with Ranbir and requested for autographs; and Ranbir happily obliged. They wished Ranbir and Imtiaz good luck for the film's success," the insider added.
Kapoor reportedly suffered from depression during the filming of some of the project's emotional content.
The sequence filmed at Grant Road shows Kapoor's character playing the guitar and singing.
Rockstar is scheduled to release November 11.
Watch the trailer for Ranbir Kapoor's Rockstar below: