Diffractive optical elements such as surface-relief gratings (SRGs) have become popular in modern applications, such as head-up displays (HUD), augmented reality (AR) and virtual reality (VR) head-mounted displays (HMD). Their ability to diffract rays in any desired angle and their wavelength and angular selectivity allows the creation of optical systems that are more compact and lighter than exclusively refractive and reflective optical designs. Traditionally, optical raytracing and diffraction efficiency were calculated separately, and the optical design was done iteratively. OpticStudio now supports the simulation of gratings with the diffraction efficiency by utilizing RCWA calculations. A demonstration of an optical system with the diffraction efficiency implemented will be presented as well.