Most undead in the world of Yamato are not created by spells (Necromancy is prohibited, punishable by death). Instead, particularly intense and/or massive traumas can cause the dead to rise again as undead creatures. The victims of heinous murders and bloody massacres will often rise again as zombies or skeletons. Ghosts arise from those with strong attachments to some aspect of the world, strong enough to bind their spirit and prevent it from passing on.
Legend states that in the dark times before the founding of the Empire, the many wars and general savagery gave birth to legions of undead creatures which preyed upon the people. Upon unifying the various clans and ascending to the throne, the First Emperor commanded his forces to hunt down and destroy the undead wherever they might be found. Massive hordes were destroyed, but the most clever, reclusive and powerful undead remained.
The First Emperor then drew upon the divine power flowing in his veins and issued his edict: no undead creature would be able to look upon the sun – the radiance of his divine mother would sear their flesh and destroy the link that enabled them to remain in the world.