Metoda praćenja zrake (engl. ray tracing)

Marija Arki i Luka Majstorović

Programski kod

                
                    #version 3.7;
                    global_settings { assumed_gamma 1.2} 
                    
                    #include "colors.inc"
                    #include "textures.inc"
                    #include "shapes.inc"
                    #include "metals.inc"
                    #include "glass.inc"
                    #include "woods.inc"
                    #include "functions.inc" 
                    
                    //Postavljanje kamere
                    camera 
                    {
                       angle 110
                       location <0, 6, 6>
                       right x*image_width/image_height
                       look_at <0,0,0>
                    }
                    
                    
                    //Postavljanje izvora svjetlosti 
                    light_source 
                    {
                        <-25,50,-15> 
                        color White 
                    }
                    /*
                    //Postavljanje drugog izvora svjetlosti
                    light_source 
                    {
                        <25,50,-15> 
                        color White 
                    }
                    */   
                    //Kreiranje stozca
                    cone
                    {
                        <0,-8,0>,
                        3,
                        <0,4,0>,
                        0
                    
                        texture 
                        {
                            Chrome_Texture
                        }
                        pigment
                        {
                            rgb<0.5, 0.5, 0.5>
                        }
                        
                    }
                    //Kreiranje valjka (na vrhu stozca)
                    cylinder
                    {
                        <0,0,0>,
                        <0,0.5,0>,
                        0.5
                        
                        translate <0, 3.5, 0>
                        texture
                        {
                            Chrome_Texture
                        }
                        pigment
                        {
                            rgb<0.18,0.18,0.18>
                        } 
                    }
                    
                    //Lopata 1 pocetak
                        //Valjak 1
                        cylinder
                        {
                            <0,2.5,0>,
                            <0,0,0>,
                            0.15
                            
                            translate <3.7, 0, 0>
                            rotate < clock*360,0,90>
                            texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                                rgb<0.4,0.4,0.4>
                            } 
                         
                        }
                        //Kugla 1
                        sphere
                        {
                            <0, 0, 0>, 
                            0.5
                            translate <3.7, 2.5, 0>
                            rotate < clock*360,0,90>
                                    texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                                rgb<0.18,0.18,0.18>
                            }  
                        
                            
                        }
                    //Lopata 1 kraj
                    //Lopata 2 pocetak
                        //Valjak 2
                        cylinder
                        {
                            <0,2.5,0>,
                            <0,0,0>,
                            0.15
                    
                            translate <3.7, 0, 0>
                            rotate < 120+clock*360,0,90>
                            texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                                rgb<0.4,0.4,0.4>
                            }
                        
                        }
                        //Kugla 2
                        sphere
                        {
                            <0, 0, 0>, 
                            0.5
                            
                            translate <3.7, 2.5, 0>
                            rotate < 120+clock*360,0,90>
                            texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                               rgb<0.18,0.18,0.18>
                            } 
                        }
                    //Lopata 2 kraj
                    //Lopata 3 pocetak
                    //Valjak 3
                        cylinder
                        {
                            <0,2.5,0>,
                            <0,0,0>,
                            0.15
                        
                            translate <3.7, 0, 0>
                            rotate < 240+clock*360,0,90>
                            texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                                rgb<0.4,0.4,0.4>
                            }
                            
                        
                        }
                        //Kugla 3
                        sphere
                        {
                            <0, 0, 0>, 
                            0.5
                           
                            translate <3.7, 2.5, 0>
                            rotate < 240+clock*360,0,90>
                            texture 
                            {
                                Chrome_Texture
                            }
                            pigment
                            {
                                rgb<0.18,0.18,0.18>
                            } 
                        }
                    //Lopata 3 kraj
                    
                    //Postavljanje poda
                    plane 
                    { 
                        y,
                        0 
                        pigment 
                        { 
                            Brown_Agate scale 0.1 
                        }
                    }
                
              

Preuzimanje programskog koda