Death used to be a nice line of work for architects, but these days it's not exactly a growth area. It generated the tombs and pyramids of Egypt, the mausoleum at Halicarnassus, the Taj Mahal and countless other magnificent structures. In modern Britain, though, your final architectural experience is likely to take place at a featureless lawn cemetery or a municipal crematorium, designed with all the sensitivity and panache of an out- of-town rubbish dump. The great achievements of modern architecture have been about bringing light, space and optimism to the built environment - yet these qualities often seem to have bypassed our spaces for mourning and burial. Death is a solemn affair, of course, but more often than not, the banality of its architecture only compounds the grief.

Even if there's the will to improve the architecture of cemeteries and crematoriums, there's rarely a way. Commissions for new cemeteries are thin on the ground. The living want new houses, new public spaces, new golf courses; they don't want to bother much with the dead.

At least, that used to be the case. Recently, there have been signs of change. Take Wilbury Hills, a cemetery that opened this year on the outskirts of Letchworth in Hertfordshire. If there's a model 21st-century cemetery, this is it. It was designed to cater for all of Letchworth's relatively diverse population. Its chapel is non-denominational and free of religious iconography - but it does faces east-south-east, towards both Mecca and Jerusalem, making it suitable for Christian and Muslim services. There is also a separate mausoleum block nearby, built at the request of the local Sicilian community, who prefer to arrange their urns vertically.

But perhaps most important of all, Wilbury Hills doesn't even look like a cemetery. The chapel is actually two buildings connected by a covered porch, one containing a high-ceilinged hall, the other an office and toilets. The whole ensemble is in dark grey brick, with warm timber fittings, generous windows and high, metal-clad roofs.

"We took a lot from the surrounding landscape," explains architect Michael Howe, of London practice mæ. "The reference for the chapel buildings was those enigmatic black-painted barns you find on farms around here. We set our two blocks at a slight angle to each other. It just makes it less formal." The landscaping of the cemetery gardens is another departure from the norm: almost domestic in scale, with a variety of settings for burials, from dense copses to lone trees, flower meadows and "rooms" enclosed by hedges.

Daringly, Wilbury Hills is also designed for uses beyond funerals. The gardens attract wildlife, so the chapel is regularly used by schoolkids for nature studies. "It's a great way of preventing vandalism," says Howe. "Kids get to know it as a pleasant landscape rather than a place of fear. Having your ancestors in proximity helps you to identify with places. It's a way of developing community identity."

In Britain's 250-odd crematoriums, good design is even harder to find, though not impossible. London's Italian-influenced Golders Green, built in 1911, is a rare example; and Basil Spence's stark Mortonhall Crematorium in Edinburgh achieves spiritual power in a modernist language, with its stark geometry and vertical slit windows.

On a more modest scale, Haverstock Architects recently completed two crematorium buildings, in Telford and Amersham, both with spacious chapels, large windows and natural materials. According to Haverstock partner John Jenkins, they sought to make the funeral experience more uplifting: "Sometimes when you are grieving, you need a bit of relief - to be able to look out and see sun, landscape and water."

The demands of mourning have changed, Jenkins explains, and the buildings reflect that. Today's funerals might involve any number of people, from one to 200; many are huge affairs, closer to rock concerts. And contemporary mourners want a bit of theatre, to see the coffin go all the way into the furnace rather than just disappear behind a curtain, so special viewing windows into the "backstage" area of the crematoriums are featured in the chapel walls.

Cabe, the Commission for Architecture and the Built Environment, last month entered the debate, with the plea: "Design cemeteries for the living, not just the dead." Burial grounds account for up to half of all green space in some urban boroughs, Cabe pointed out, and with better planning, they could become pleasant places to visit for non-mourners, too.

"It's about re-engaging with the original idea of cemeteries," says Sarah Gaventa of Cabe. "There's the whole Victorian principle of places like Highgate: somewhere to promenade, somewhere to have an afternoon out and admire the architecture. They were public parks designed for the enjoyment of all." Gaventa points to Bristol's Arnos Vale and London's Abney Park as examples. Both were grand Victorian cemeteries full of listed funerary architecture that had fallen into near-terminal neglect. They have been restored and are now visitor attractions and oases of biodiversity.

The Victorians were said to have invented death in Britain, led by a queen who was something of a mourning addict. Victoria commemorated her late husband with George Gilbert Scott's lavish Albert Memorial, and the rest of society followed suit with hugely expensive funerals and elaborate monuments of their own. Combined with population growth, public health concerns and centuries of living in proximity to badly stored corpses, the pressure for grade-A burial space prompted a 19th-century cemetery building boom. Out of it came most of the country's best known burial grounds, including the Glasgow Necropolis and what are known as London's "magnificent seven". Kensal Green was the first, and its plots were so sought-after that it became known as "the Belgravia of Death". But it was soon eclipsed by architect-entrepeneur Stephen Geary's Highgate, with its themed Egyptian Avenue and its circle of catacombs around the cedar of Lebanon. In their bid to outdo each other for eternity, the Victorians deployed every funerary style history had to offer - Egyptian obelisks, Roman urns, mini-classical temples, gothic statuary - and left a spectacularly kitsch legacy, until the first world war put an end to such excesses.

The trend for considerate cemetery design has continued abroad, though, attracting some of the best architects in Europe. There is Stockholm's Woodland Cemetery, for example, designed by Erik Gunnar Asplund and Sigurd Lewerentz. It is more like a calm, romantic forest dotted with gravestones than a formal burial ground. In Italy, Aldo Rossi's striking San Cataldo Cemetery in Modena, begun in 1971, is a key work of late modernism: an imposing, almost surreal landscape of distilled classical forms and deep shadows. Rossi's compatriot Carlo Scarpa designed the equally revered Brion-Vega Cemetery, a poetic, zen-like landscape of concrete and creeping vegetation. And Enric Miralles, designer of the Scottish parliament, completed Barcelona's unique Igualada Cemetery shortly before his death, a curious landscape of winding paths and pagan-like sunken tombs. Like Scarpa, he is buried in his own cemetery.

It is ironic that many rural Europeans imagine their final resting place to be a city, while many urban Britons wish to be buried in an Arcadian woodland. In this country, the trend in burial is to make smaller intrusions in the landscape than our self-regarding ancestors. There has been a growing demand for eco-burials, in biodegradable coffins marked by trees rather than stones, in plots that resemble forests rather than anything identifiable as a cemetery.

Self-recycling is surely the last word in environmental responsibility. It also suggests an acceptance of mortality and a closeness to nature that previous generations found impossible, judging by their zeal for posthumous permanence. No matter where we choose to be laid to rest, however, good design could benefit us all - dead or alive.