POV-Ray : Newsgroups : povray.text.scene-files : megapov mechsim balls on stairs Server Time
31 Oct 2024 23:28:26 EDT (-0400)
  megapov mechsim balls on stairs (Message 1 to 1 of 1)  
From: Thomas van der Veen
Subject: megapov mechsim balls on stairs
Date: 31 Jan 2003 12:28:23
Message: <Xns9314B1B964D38veentukibmcom@204.213.191.226>
// Date: October 2002
// Auth: Christoph Hormann/Thomas van der Veen
// Requirements: IsoCSG library: http://www.tu-bs.de/~y0013390/pov/ic///
//
// Posted as mpeg
// http://news.povray.org/povray.binaries.animations/29955/
//
// Render instructions:
// --------------------
//
// first render as still to generate simulation data:
//
// -w320 -h240
//
// then render as animation:
//
// -w320 -h240 +a0.3 -j +kff150

#version unofficial megapov 1.0;
#declare Radiosity = on;

#include "mechsim.inc"
#include "iso_csg.inc"

#declare BoxArray  = array[11]

#declare BoxArray[0] =  IC_Plane(y, 0.0)
#declare BoxArray[1] =  IC_Box(<-5, -.1, -1>, < 0,.25,1>)
#declare BoxArray[2] =  IC_Box(<-5, -.1, -1>, < -.25,.45,1>)
#declare BoxArray[3] =  IC_Box(<-5, -.1, -1>, < -.5,.65,1>)
#declare BoxArray[4] =  IC_Box(<-5, -.1, -1>, < -.75,.85,1>)
#declare BoxArray[5] =  IC_Box(<-5, -.1, -1>, < -1,1.05,1>)
#declare BoxArray[6] =  IC_Box(<-5, -.1, -1>, < -1.25,1.25,1>)
#declare BoxArray[7] =  IC_Box(<-5, -.1, -1>, < -1.5,1.45,1>)
#declare BoxArray[8] =  IC_Box(<-5, -.1, -1>, < -1.75,1.65,1>)
#declare BoxArray[9] =  IC_Box(<-5, -.1, -1>, < -2,1.85,1>)
#declare BoxArray[10] = IC_Box(<2.45, -.1, 1>, < 3,.35,-5> )

#declare fn_Env = IC_Merge_Array(BoxArray);  

global_settings 
{
    assumed_gamma 1.0

    #if (Radiosity = on )
        radiosity   
        {        
            pretrace_start 0.01
            pretrace_end   0.01        
            count 450        
            nearest_count 4
            error_bound 0.1        
            recursion_limit 1        
            low_error_factor 0.05
            gray_threshold 0.0        
            minimum_reuse 0.015        
            brightness 1.2
            adc_bailout 0.01/2        
        }
    #end        


    mechsim 
    {
        gravity <0, -9.81, 0 >
        method 1
        
        environment 
        {
            function { fn_Env(x, y, z) }
            stiffness 60000
            damping 10000
            friction 0.1, 1.001
            method 1
        }
        
        collision 
        {
            1, 0
            stiffness 60000
            damping 3000
        }
        
        #if (clock_on)
            step_count 1500
            time_step (1/30)/1500
        
            topology 
            {
                load_file "stairs.dat"
        
            #if (mod(frame_number, 16) = 15)
                mass { < -3,2.25,0>, <1.9, 0, 0>, 0.1 density 5000 }
            #end
        
            save_file "stairs.dat"
            }
        #else
            step_count 0
        
            topology 
            {
                mass { < -3,2.25,0>, <1.9, 0, 0>, 0.1 density 5000 }
                save_file "stairs.dat"
            }
        #end
    }
}

// ----------------------------------------

camera 
{
    location <-3, 5, -10.0>
    up y
    sky y
    look_at <0, 0, 0>
    angle 30
}

#if (Radiosity = off )
    light_source 
    {
        <2000, 3000, 2700>
        color rgb <1, 1, 1>
    }
#end    

sky_sphere
{
    pigment
    {
        gradient y 
        poly_wave 2 
        color_map
        {
            [0 rgb <0.7,0.8,1>*0.5]
            [0.75 rgb 1]
            [1 rgb 1]
        }
    translate -y*0.5 scale 2
    }
}


// ----------------------------------------

#declare T_Env = texture 
{
    pigment { rgb <0.7065,0.7065,0.7065>}
    finish { ambient 0.00 diffuse 1 specular 1 roughness 0.01 }
}


plane { y, 0 texture {pigment {  color rgb .5}    finish { ambient 0.00 
diffuse 1 }  }}

union 
{
    box { <2.5, -.1, 1>, < 3,.3,-5> }
    box { <-5, -.1, -1>, < 0,.2,1> }
    box { <-5, -.1, -1>, < -.25,.4,1> }
    box { <-5, -.1, -1>, < -.5,.6,1> }
    box { <-5, -.1, -1>, < -.75,.8,1> }
    box { <-5, -.1, -1>, < -1,1,1> }
    box { <-5, -.1, -1>, < -1.25,1.2,1> }
    box { <-5, -.1, -1>, < -1.5,1.4,1> }
    box { <-5, -.1, -1>, < -1.75,1.6,1> }
    box { <-5, -.1, -1>, < -2,1.8,1> }
    box { <-5, -.1, 1>, < 5,2,1.2> }
    texture { T_Env }
}

// ----------------------------------------

MechSim_Show_All_Objects(-1, false, -1, "")


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.