Ungoliant aided the evil Vala Melkor in his attack upon the Two Trees of Valinor, draining them of their sap after Melkor had injured them, extinguishing the source of light for the world. She also consumed the reserves of light from the wells of Varda. Afterward the light of the trees persisted only within the Silmarils of Fëanor. Ungoliant helped Melkor evade the Valar by shrouding them both in her impenetrable darkness, causing blindness and confusion amongst the hosts of the Valar that attempted to intercept them.
Melkor had promised Ungoliant that he would yield anything she wished in return for her aid, but betrayed this promise by attempting to withhold the Silmarils from her. This angered Ungoliant, who, having grown immensely powerful from ingesting the life force of the Two Trees, trapped Melkor in her webs. At this point he gave out a cry of such fear and intensity that it was heard in the depths of Angband, and the Balrogs rushed to the aid of their master, scourging Ungoliant with their whips of flame.
Ungoliant fled to the Ered Gorgoroth in Beleriand. At some point she gave birth to Giant Spiders, including the character Shelob in The Lord of the Rings. In The Silmarillion, it is stated that when she went into hiding her hunger was such that she would mate with spiders only to devour them later, with her offspring to be used as food once they were fully grown.
Shelob was an "evil thing in spider form...[the] last child of Ungoliant to trouble the unhappy world", living high in the Ephel Dúath mountains that border Mordor. There are numerous references to her being ancient, predating the events of The Lord of the Rings by many ages. Although she resided in Mordor and was unrepentantly evil, she was independent of Sauron and his influence.
This creature makes her first appearance in the chapter "The Stairs of Cirith Ungol", though she is formally introduced in the next chapter "Shelob's Lair" where the author says "But still she was there, who was there before Sauron, and before the first stone of Barad-dûr; and she served none but herself, drinking the blood of Elves and Men, bloated and grown fat with endless brooding on her feasts, weaving webs of shadow; for all living things were her food, and her vomit darkness." Her descendants (upon whom she would often feed) include the Giant Spiders who captured and were defeated by Bilbo Baggins's Dwarf allies in Mirkwood in The Hobbit.
Shelob's lair was Torech Ungol, below Cirith Ungol ("Pass of the Spider"). It lay along the path that Sam Gamgee and Frodo Baggins took into Mordor along their route to Mount Doom. Her spider-silk, which was spun in both rope and cobweb form, was strong and cleverly made, trapping those who walked into it. Shelob had encountered Gollum during his previous trip to Mordor, and he apparently worshipped her after his fashion. The Orcs of the Tower of Cirith Ungol called her "Shelob the Great" and "Her Ladyship," and knew of Gollum's relationship with her (they referred to him as "Her Sneak"). Sauron himself was aware of her existence, but left her alone, as she was a useful guard on the pass. He occasionally sent her prisoners for whom he had no further use.
Gollum led the Hobbits into her lair so that he could get the One Ring after she consumed them, as she had no use for it. After losing track of Gollum, the Hobbits realized that the tunnel was blocked by her webs. She cornered them, but Frodo used the Phial of Galadriel's light to drive her off. Frodo then used Sting to cut the webs and the Hobbits thought that they had escaped the trap.
However Gollum waylaid the pair and tried to strangle Sam, while Shelob stung and paralysed Frodo. An enraged Sam fought off Gollum and then battled Shelob desperately using his master's sword Sting. Sam first hewed off a claw from one of her legs and stabbed out one eye (the latter being the only soft part of her body). Then he inflicted a deep gash upon her body. Seeking to crush Sam, she instead impaled herself upon Sting. Shelob's rage was rekindled and she resolved to kill Sam, but he defeated her by unleashing the light of the Phial of Galadriel, which burned and temporarily blinded her. Shelob fled into her lair, significantly wounded. Her final fate, according to the text, will remain unknown to the people of Middle-earth。
more art about LOTR ：