[Chapter six and seven of RUDRASAMHITA Section of Shiva Purana][1] describes how Trimurti were born.

Brahma said this to his son Narada.

 

>  - At the time of great dissolution when all mobile and immobile of the world are dissolved everything gets enveloped in darkness without the
> sun, planets and stars.
>  - There is no moon. The day and the night are not demarcated. There is no fire, no wind, no earth and no water. There is no unmanifest
> primordial being. The whole firmament is one complete void, devoid of
> all Tejas elements.
>  - There is no Dharma or Adharma, no sound ,no touch, smell and colour are manifest.There is no taste. The face of quarters is no demarcated.
>  - When there is a pitch darkness that cannot be pierced with needle and what is mentioned in Vedas " The Existent and that Brahman" is
> alone present.
>  - When the present visible world is not in existence, the Sat Brahman alone is present which Yogins observe perpetually in the inner Soul,
> the inner firmament.
>  - It is incomprehensible to the mind. It cannot at all be expressed by words. It has neither name nor color. It is neither thick nor thin. 
>  - It is free from alternatives. It has no beginning nor end. It is free from illusion and its harassment.It has no second. It has no
> development. It is in the form of Pure knowledge.
>  - People have doubts giving it a name. That Being after, then after sometime, it is said, wished for a second.
>  - The Being, having no form of its own, wished to create, in the course of its own sport, an auspicious form its own endowed with all
> power, qualities and knowledge.
>  - A form of that goes everywhere, that has all forms, that sees all, that is the cause of all, that should be respected by all, that is
> the beginning of all, that bestows everything, and that sanctifies
> everything should be created (So it is wished) and hence created that
> form of **ISVARA** of pure nature. The Original Being without a
> second, with neither beginning nor end, that illuminates
> everything, that is the form of cit(Pure Knowledge), that which is
> termed as Supreme Brahman, the all-pervasive, and undecaying, vanished.
> The manifest of formless being is **SADAASIVA**. Scholars of ancient and
> succeeding ages have sung is **ISVARA.**
>  - ISVARA though alone ,then created the physical form **Sakti** form his body.This Shakti did not affect his body in any way.
>  - This Shakti is called by various names. Pradhaana, Prakriti, Maayaa, Gunavati, Paraa. The mother of Buddhitattva (The Cosmic
> Intelligence), Vikritivarjita (without modification).
>  - That Shakti is Ambika,Parkriti and goddess of all. She is the prime cause and **mother of three deities**.
>  - She has a brilliance which could hardly be conceived. She is the generating cause of all. She sprang up singly as Maaya. In her union
> she manifested into various forms.
>  - The Supreme Purusha is Shiva. He is called Shambu. He has no other lord over Him. He has five faces. He has ten arms. He holds the
> trident. He is as pure and white as camphor. His body is dusted
> entirely with ash.
>  - Shiva thought within Himself like this-" Another being shall be created by me. Let him create everything, protect it and in the end
> dissolve it. The supreme lord , Shiva , spread liquorice essence of
> nectar on His left side, on tenth limb, nectar which was the outcome of
> churning the ocean of His mind wherein thoughts were the waves, Satva
> Guna was the precious Gem, Rajas being coral and Tama being crocodile. 
> Thereupon a person came into being who was most charming one in the
> three worlds, who was calm with sattva guna prominent, and appeared to
> be ocean of immeasurable majesty.
>  - Siva said to him-" You will be famous as **VISHNU** by name as you all pervasive. You will have many other names conferring happiness on
> devotees. Perform penance highly conducive to achievement of matter in
> hand. Be firm on it". Saying so lord bestowed Vedas on him through
> nostrils.
>  - Siva vanished accompanied by Shakti and his attendants. Vishnu began his great penance.
>  - When Vishnu became enlightened by penance, from the body of Vishnu various water currents of various sorts began to flow as a result of
> Shiva's Maya.
>  - Supreme Brahman in the form of divine waters pervaded the entire Void. Vishnu went to the sleep amidst of waters. He was in blissful
> state of delusion for a long time.
>  - In the mean time Principles (Mahat,Ahamakara,the five elements,senses of Knowledge) too were evolved out of great Soul. All
> these Principles emanating from Prakriti are insentient, but not the
> Purusha. Vishnu, the Purusha, accepted all these and began his sleep in
> the Brahman.
>  - When Lord Narayana (as he slept on water) continued to sleep, an excellent lotus of huge size came out of his navel as desired by
> Siva. Shiva, the great lord with Shakti as his half created me from his
> right limb.
>  - O sage, thus deluded me with His illusion immediately, Siva in the course of His Sport produced me through the umbilical cord of Vishnu

Then as we all know, Vishnu and Brahma fought due to the Mayaa of Shiva. Then Shiva  appeared to them in the form of a bright light (column of fire). Vishnu,  as a boar (swetavaraha) went down, and Brahma, as a swan, went up and both of them couldn't find the beginning or the end.

When they were perplexed, they heard sound "OM OM". Vishnu was able to understand the divine sound OM and meditated on divine soul with this divine sound to find the origin of the Linga.
  
> - Then there came a sage who told him the essence of the truth. Vishnu
> realized that that sage himself was great lord and the Supreme Brahman
> embodied in Shabda Brahman (i.e, the mystic syllable OM). That Brahman
> is **Rudra** free from worries.
> - The Lord Shiva then showed them **syllable form and Suguna form**.

 
 

 
  [1]: http://dspace.wbpublibnet.gov.in:8080/jspui/bitstream/10689/20655/5/Part1_Chapter3_161-240p.pdf