
<PAGE>

                                                                  EXHIBIT 10.40

                               AMENDMENT NO. 2 TO
                       REGISTRATION RIGHTS AGREEMENT (EKI)


     This Amendment No. 2 to Registration Rights Agreement (the "Amendment") 
is made and entered into as of November 3, 1997 by and among EarthShell 
Container Corporation, a Delaware corporation (the "Company"), E. Khashoggi 
Industries, LLC, a Delaware limited liability company ("EKI").

     WHEREAS, the parties hereto or their successors in interest previously 
entered into that certain Registration Rights Agreement dated as of February 
28, 1995, as amended (the "Registration Rights Agreement"), providing certain 
registration rights to EKI for shares of Common Stock of the Company issued to 
EKI; and

     WHEREAS, in connection with the proposed initial public offering of 
shares of common stock of the Company (the "IPO"), the managing underwriters 
in the IPO have advised the Company that in order to effect the successful 
and orderly distribution of shares of common stock in the IPO, it is in the 
best interests of the Company and its stockholders that all stockholders, if 
participating in the IPO, agree not to sell any equity securities of the 
Company for a period of 270 days following the consummation of the IPO and 
all stockholders, if not participating in the IPO, agree not to sell any 
equity securities of the Company for a period of 180 days following the 
consummation of the IPO; and

     WHEREAS, the Registration Rights Agreement, as currently in effect, only 
provides for a lock-up period of 180 days from stockholders selling in the 
offering and no lock-up whatsoever from stockholders not selling in the 
offering; and

     WHEREAS, in order to extend the lock-up period as described above days 
and extend the lock-up to all stockholders party to the Registration Rights 
Agreement, the parties hereto desire to amend the Registration Rights 
Agreement as provided below. Capitalized terms used herein and not otherwise 
defined shall have the meaning ascribed to them in the Registration Rights 
Agreement.

     NOW, THEREFORE, in consideration of the premises and covenants contained 
herein, and other good and valuable consideration, the receipt and 
sufficiency of which are hereby acknowledged, the parties hereby agree as 
follows:

     1.     Section 4(a) of the Registration Rights Agreement is deleted in 
its entirety and the following new Section 4(a) is substituted therefor:

          (a) RESTRICTIONS ON PUBLIC SALE BY HOLDER OF REGISTRABLE 
     SECURITIES. Each holder of Registrable Securities whose Registrable 
     Securities are covered by a Registration Statement filed pursuant to 
     Section 3 hereof agrees, if requested by the managing underwriters in an 
     Underwritten Offering, not to effect any sale or other distribution of 
     equity securities of the Company, including any sale pursuant to Rule 
     144 under the Securities Act (except as part of such Underwritten 
     Registration), during the 10-day period prior to, and during the 180-day 
     period beginning with, the effectiveness of such Registration Statement, 
     to the extent timely notified in writing by the Company or the managing 
     underwriters. Notwithstanding the provisions of the preceding sentence, 
     in the case of the first public offering of Common Stock pursuant to an 
     effective Registration Statement under the Securities Act for the 
     account of the Company at the aggregate offering price in excess of 
     $35,000,000, each

<PAGE>

     holder of Registrable Securities agrees, if requested by the managing 
     underwriters in such an Underwritten Offering, not to effect any sale or 
     other distribution of equity securities of the Company, including any 
     sale pursuant to Rule 144 under the Securities Act (except as part of 
     such Underwritten Registration), during the 10-day period prior to, and 
     if purchasing or selling shares of Common Stock in such offering during 
     the 270-day period beginning with, or if neither purchasing nor selling 
     shares of Common Stock in such offering during the 180-day period 
     beginning with, the effectiveness of the Registration Statement relating 
     to such Underwritten Registration, to the extent timely notified in 
     writing by the Company or the managing underwriters.

     2.     Except as modified by this Amendment, the Registration Rights 
Agreement shall remain unchanged and shall remain in full force and effect.

     3.     Pursuant to Section 10(b) of the Registration Rights Agreement, 
this Amendment shall become effective upon the receipt by the Company of 
executed consents to this Amendment from the holders of at least a majority 
of the Registrable Securities.

     4.     This Amendment may be executed in any number of counterparts and 
by the parties hereto in separate counterparts, each of which when so 
executed shall be deemed to be an original and all of which taken together 
shall constitute one and the same agreement.

     5.     This Amendment shall be governed by and construed in accordance 
with the internal laws of the State of California.

     IN WITNESS WHEREOF, the parties have executed this Amendment as of the 
date first written above.

                                        EARTHSHELL CONTAINER CORPORATION
                                        
                                        By:/s/ Simon K. Hodson
                                           -----------------------------------
                                        Name: Simon K. Hodson
                                             ---------------------------------
                                        Title: CEO
                                              --------------------------------
                                        
                                        E. KHASHOGGI INDUSTRIES, LLC, a 
                                        Delaware limited liability company
                                        
                                        By:   E. Khashoggi Industries, Inc., 
                                              its General Partner
                                        
                                              By: /s/ Essam Khashoggi
                                                 -----------------------------
                                              Name: Essam Khashoggi
                                                   ---------------------------
                                              Title:
                                                    --------------------------
                                        
                                        By:   Concrete Technology Corporation, 
                                              its Member
                                        
                                              By: /s/ Simon K. Hodson
                                                 -----------------------------
                                              Name: Simon K. Hodson
                                                   ---------------------------
                                              Title: CEO
                                                    --------------------------


                                        2

<PAGE>

     By its execution below, the Company certifies that it has received 
consents to this Amendment from the holders of a majority of the Registrable 
Securities, as provided in Section 10(b) of the Registration Rights 
Agreement, and pursuant thereto this Amendment has become effective.

                                        EARTHSHELL CONTAINER CORPORATION

                                        By:/s/ D. Scott Houston
                                           -----------------------------------
                                        Name: D. Scott Houston
                                             ---------------------------------
                                        Title: CFO
                                              --------------------------------










                                        3
 
