We recently reported on a mathematical formalism for analyzing the result of a direct-write scanning system applied to photoaligned liquid crystal films. We use that formalism to study the direct-write recording of polarization gratings (PGs). First, we evaluate three scan paths in simulation and experiment, describe their tradeoffs and practical constraints, and identify the most favorable. Second, we explore the parameter space of direct-write PGs in simulation, which includes four dimensions in general: grating period, line spacing, beam size, and spatially averaged fluence. Using this analysis, we predict that a certain portion of the parameter space should be optimal, leading to high diffraction efficiency and well-aligned PGs. Finally, we experimentally fabricate and characterize nine PGs with scan parameters within and around this optimal parameter space and conclude that the prediction is validated. This work is the first in-depth study of direct-write PGs; it identifies many challenges and solutions, and shows, for the first time, direct-write recorded PGs with quality equivalent to those recorded via holography. In particular, we demonstrate a PG (20 μm period) with first-order diffraction efficiency 99.5%, 0.2% haze, and polarization contrast of 2000.