90% genetics. some things impact it but more so while it's on the plant growing than after it is dead.
hot and humid will produce more airy buds than normal... but again, this is relative to genetics. a warmer light in bloom (CCT, not atmospheric temps) and proper temp/RH won't turn genetically larfy buds into solid nuggets. they were probably larfy to start, and you either exacerbated with environmental variables or limited the larfiness it as best you could.
try to keep fairly cool temps and humidor-like RH and all goes well. light is the greated factor in regard to potency. he temps and rh are more about flavor and smells. light breaks down THC quickly, relatively speaking, so dark is best.