Almost all computer models of the musculoskeletal system represent muscle geometry using a series of line segments. This simplification (i) limits the ability of models to accurately represent the paths of muscles with complex geometry and (ii) assumes that moment arms are equivalent for all fibers within a muscle (or muscle compartment). The goal of this work was to develop and evaluate a new method for creating three-dimensional (3D) finite-element models that represent complex muscle geometry and the variation in moment arms across fibers within a muscle. We created 3D models of the psoas, iliacus, gluteus maximus, and gluteus medius muscles from magnetic resonance (MR) images. Peak fiber moment arms varied substantially among fibers within each muscle (e.g., for the psoas the peak fiber hip flexion moment arms varied from 2 to 3 cm, and for the gluteus maximus the peak fiber hip extension moment arms varied from 1 to 7 cm). Moment arms from the literature were generally within the range of fiber moment arms predicted by the 3D models. The models accurately predicted changes in muscle surface geometry over a 55 degrees range of hip flexion, as compared to changes in shape predicted from MR images (average errors between the model and measured surfaces were between 1.7 and 5.2 mm). This new framework for representing muscle will enhance the accuracy of computer models of the musculoskeletal system.