i've found the biggest factor is rockhard nugs vs loose airy buds is genetics really. plain and simple. indica leaning plants tend to grow tighter more compact flower clusters where sativa leaners grow more fluffy airy buds. its moister in tropical climates so there is more space between the leaves and buds to keep the airflow. in the colder climates the air tends to be drier so the buds can grow tighter.
the second most limiting factor seems to be light like was said. try and get the plants as close to the lights as you can with your specific type of lighting. but not too close as there is such a thing as too much light. not really about the wattage but the lumens and intensity. a weaker light covering more plant area does more than a brighter light that only hits the canopy. if that makes any sense. if you have a 400w light for instance you need to keep it like 1 foot away from the plants of it will do damage to the leaves it is very bright, but if you let the plants grow upwards freely the majority of the light will only his the top parts of the plant. if you trained the plant low and wide so that there was more surface area being lit then you will easily yield more than they did growing free, and if you only had 200w and you train that way you will achieve similar if not more yield than with the 400w.
thirdly is the nutrients. not really the brand, but how much you feed and when. if you feed more nitrogen past like week 6 of flower then you get plants that will start making leaves again halfway through flower then stop and resume flower. you see it all the time. someone will show a big bud full of foxtails. thats it. but that also makes rock hard nugs because the calyxes started to turn back to leaves and put on mass but then resumed flowering and frosted over with trichomes. but adding nitrogen late in flower also takes away from the high because while it should have been ripening and finishing it was busy growing more mass instead of converting compounds.
they naturally add mass during the last 2-4 weeks of flower also but a lot of people chop early and lose weight. near the end of flower the plants start drinking a lot, you might have to water more than once in a day. this is the time to make sure that they are getting as much water as you can supply without overwatering or anything negative also wanna have cut out all nutes at this point. after that point they stop drinking pretty much altogether. that lets you know they are done and you can harvest if you like.
anyway that was my 2-3 cents one or all of those should help you get denser buds. take it or leave it. good luck in your endeavors.