was cast due to his similarity to actress Kate Twa; both portrayed versions of the same character. While discussing the installment's origins, producer
Glen Morgan said that he "wanted an episode with more of a sexy edge". It proved difficult to portray sex as convincingly scary, which caused the producers to introduce the concept of "people like the Amish who are from another planet". "Gender Bender" was penned by freelance writers Larry and Paul Barber, whose initial draft focused heavily on the contrast between the farming community of the Kindred and a version of city life "with very sexual connotations", influenced by the works of Swiss artist
H. R. Giger. This script went through various rewrites during the development process, including the removal of a scene where someone's crotch rots away, to address concerns about the content of the episode. The chants uttered by the Kindred were not in the script handed in by the Barbers; they were added later by producer
Paul Rabwin. The character of Marty was portrayed by two actors: Kate Twa plays the female form and Peter Stebbings the male. Twa was the first of the two to be cast, leading producer
R. W. Goodwin to base the casting of Stebbings mostly on his "very strong resemblance" to the actress. This resemblance was exploited in a scene showing Twa
morphing into Stebbings; Goodwin felt that the two actors were too similar for the effect to be readily apparent, "zapp[ing] the energy out of the moment". Nicholas Lea, who played a would-be victim in the episode, returned to the series in a recurring role as
Alex Krycek, beginning with the
second season's "
Sleepless". Twa also returned that season, playing a former colleague of Scully in "
Soft Light". "Gender Bender" marked
Rob Bowman's directorial debut on the series; he became one of the series' most prolific directors, and also directed the 1998 film adaptation,
The X-Files: Fight the Future. Bowman found "Gender Bender" a difficult episode to work on; the script had initially called for lantern light to illuminate several scenes, but this was found to be unworkable. In addition, an interior set constructed to represent the catacombs under the Kindred's barn was so encumbering to film in that a
second unit crew were required to reshoot a large degree of
camera coverage. This need for extra footage necessitated an additional day of filming for scenes featuring Duchovny. The exterior shots of the village inhabited by the Kindred were filmed at a farm preserved from the 1890s in
Langley,
British Columbia, Canada, while interior sets were built on a
soundstage. The small town visited by the agents was filmed on location in
Steveston, British Columbia, a location which was revisited to film the first-season episode "
Miracle Man". The music used in the episode's nightclub scenes was recycled from composer
Mark Snow's earlier work on the television film
In the Line of Duty: Street War. == Themes ==