The main factor affecting NOx generation in diesel engines is the temperature of the combustion.
Higher the combustion temperature and longer the gas is under its influence - the greater the NOx emission.
The other important factor is the oxygen content of air supplied into the combustion chamber.