Clearance requirements for ventilation are meant to prevent potential fires and maintain the air quality in your home. Check with your local city hall to determine which codes apply to you. In addition to local and manufacturer requirements, some ventilation clearance codes are available via the Table of Type B-Vent Rooftop Clearance Requirements in Inspectapedia.com.
Inspectapedia says the 1992 Vent Sizing Table requires gas vents to terminate above the roof in accordance with the manufacturer's directions. Vent caps 12 inches or less in diameter can end anywhere from 1 to 4 feet above the roof, depending on the pitch of the roof and proximity of other buildings.Larger above-roof vent caps have higher minimum clearance requirements.
Tim Carter of Ask The Builder says each installation will be different. Be meticulous about following a manufacturer's exhaust pipe clearance directions.