Patterning of the developing mesoderm establishes primordia of the visceral, somatic, and cardiac tissues at defined anteroposterior and dorsoventral positions in each segment. Here we examine the mechanisms that locate and determine these primordia. We focus on the regulation of two mesodermal genes: bagpipe (bap), which defines the anlagen of the visceral musculature of the midgut, and serpent (srp), which marks the anlagen of the fat body. These two genes are activated in specific groups of mesodermal cells in the anterior portions of each parasegment. Other genes mark the anlagen of the cardiac and somatic mesoderm and these are expressed mainly in cells derived from posterior portions of each parasegment. Thus the parasegments appear to be subdivided, at least with respect to these genes, a subdivision that depends on pair-rule genes such as even-skipped (eve). We show with genetic mosaics that eve acts autonomously within the mesoderm. We also show that hedgehog (hh) and wingless (wg) mediate pair-rule gene functions in the mesoderm, probably partly by acting within the mesoderm and partly by inductive signaling from the ectoderm. hh is required for the normal activation of bap and srp in anterior portions of each parasegment, whereas wg is required to suppress bap and srp expression in posterior portions. Hence, hh and wg play opposing roles in mesoderm segmentation.