Like all clouds, it forms when the air reaches its dewpoint, which is the temperature to which an air mass must be cooled for the water vapor in it to condense into liquid droplets.
The NWS Web site features a handy on-line calculator for determining the heat index based on a combination of either temperature and relative humidity or temperature and dewpoint.
And the bubble line. Sometimes, instead of having a nice separation between the bubble and the dew line, there's a special point which for some reason those two curves meet. Non-ideality.