POV-Ray : Newsgroups : povray.text.scene-files : RSoCP & Particles (Sunset Edition) Server Time
31 Oct 2024 08:16:47 EDT (-0400)
  RSoCP & Particles (Sunset Edition) (Message 1 to 1 of 1)  
From: Kontemplator
Subject: RSoCP & Particles (Sunset Edition)
Date: 28 Jan 2018 11:50:06
Message: <web.5a6dfe0cd6b6d02189314e20@news.povray.org>
//-------------------------------------------------------------------------
// PoVRay 3.7 Scene File "jk_random_01.pov"
// author:  Kontemplator
// date:    01/2018
//
// +kff250
//------------------------------------------------------------------------
#version 3.7;
global_settings{ assumed_gamma 1.0
                 max_trace_level 5

                 }

#default{ finish{ ambient 0.1 diffuse 0.9 }}

#declare Timer = (-sin(pi/2-pi*clock)+1)/2; //function for soft start and stop
//------------------------------------------------------------------------

#include "stdinc.inc"

//------------------------------------------------------------------------
camera {angle 50
        location  <0.0 , 14.0 ,-35.0>
        right     x*image_width/image_height
        look_at   <-4.5 , 3.0 , -1>
       }

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

light_source {
  <0,0,0>             // light's position (translated below)
  color rgb 1.0       // light's color
  area_light
  <20, 0, 0> <0, 0, 20> // lights spread out across this distance (x * z)
  3,3              // total number of lights in grid (4x*4z = 16 lights)
  adaptive 1         // 0,1,2,3...
  //jitter              // adds random softening of light
  circular            // make the shape of the light circular
  orient              // orient light
  translate <-80+30*clock, 150-100*clock, -250>  // <x y z> position of light
  }

  light_source {
  <0,0,0>
  color rgb <1,1,1>-<0,.5,.9>*Timer
  translate <-80+30*clock, 150-100*clock, -250>
  shadowless
  }

//sky -------------------------------------------------------------------

sky_sphere{ pigment{ gradient <0,1,0>
color_map{ [0   color rgb<1,1,1>-<0,.5,.9>*clock]
           [0.4 color rgb<0.14,0.14,0.56>]
           [0.6 color rgb<0.14,0.14,0.56>]
           [1.0 color rgb<1,1,1>-<0,.5,.9>*Timer]
                              }
                     scale 2 }
           }


plane{y,30   //animated clouds
      pigment{rgbf .75}
      normal {granite 50 translate <0,clock/4,-clock/8> scale 200}
      finish {phong .25}
      }

//ground -------------------------------------------------------

difference {
    plane{y,0}
    cylinder {<-20,0,0>,<20,0,0>,7 rotate <0,-30,0> translate <0,4.13,-12.3>}
        texture{ pigment{ checker color rgb .1 color rgb .05 rotate <0,-30,0>}
                 finish { diffuse .75 phong .25 reflection .02}
                 scale 5
               }
}
//====================================================
//  Statistics
//====================================================

#declare A_Stats = array[4][18] {
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
  }

#macro   Stats(P1)
#declare A_Stats[0][int(vlength(P1))]=A_Stats[0][int(vlength(P1))]+1;
#declare A_Stats[1][int(P1.x)]=A_Stats[1][int(P1.x)]+1;
#declare A_Stats[2][int(P1.y)]=A_Stats[2][int(P1.y)]+1;
#declare A_Stats[3][int(P1.z)]=A_Stats[3][int(P1.z)]+1;
#end

#macro  Show_Stats()  // distribution of particle as distance from origin
union {

#declare SC = (1/Count)*100;

#for (A,1,15,1)
object{ Round_Cylinder (<0,0,0>,<0,A_Stats[0][A]+1,0>,.99,.25,0)
    scale <1,SC,1>
    translate <2*A-32,.1,0>
    pigment {rgb <A/16,1-A/16,0>}
    finish {F_0}}
#end

box {-1,1 scale <18,.1,3>  translate <-16,0,0> pigment {rgb <1,.9,.8>} finish
{F_1}}

#declare Text = concat("pow(rand(R1),",str(F,3,3),")");

text { ttf "arial.ttf", Text, 0.02, 0.0 // thickness, offset

       texture{ pigment{ color rgb<1,1,1> }
                finish { F_1}
              } // end of texture
       rotate <90,0,0>
       scale<1,1.25,1>*2
       translate<-25,0.1,-6>
      } // end of text object ---------------------------------------------

sphere_sweep {      // graph
    cubic_spline
    19,
    <-34,0,0>,.1
    <-32,0,0>,.1
    #for (A,1,15,1)
    <2*A-32,-.5+(A_Stats[0][A]+1)*SC,0>,.1
    #end
    <0,0, 0>, .1
    <2,0,0>,.1

    tolerance 0.0001
    pigment {rgb <1,.9,.8>}
    finish {F_1}
    translate <0,-1,-1.1>
 }

cylinder { <-34,(Count/8)*SC,-1.1>,<-34,0,-1.1>,.1
           pigment {rgb <1,.9,.8>}
           finish {F_1}
         }
cylinder { <2,(Count/8)*SC,-1.1>,<2,0,-1.1>,.1
           pigment {rgb <1,.9,.8>}
           finish {F_1}
         }

cylinder { <-34,(Count/8)*SC,-1.1>,<2,(Count/8)*SC,-1.1>,.1
           pigment {rgb <1,.9,.8>}
           finish {F_1}
         }

scale .43

translate <-3.5,0,-6.5>
}

#end

#macro Show_Stats1()   // average position of all particle
#declare Su_X =0;
#declare Su_Y =0;
#declare Su_Z =0;
#for (A,0,10)
#declare Su_X = Su_X + A_Stats[1][A]*A;
#declare Su_Y = Su_Y + A_Stats[2][A]*A;
#declare Su_Z = Su_Z + A_Stats[3][A]*A;
#end
#declare Av_X = Su_X/Count;
#declare Av_Y = Su_Y/Count;
#declare Av_Z = Su_Z/Count;

//#debug concat(str(Av_X,3,3),",",str(Av_Y,3,3),",",str(Av_Z,3,3))
union {
cone {<Av_X,10,Av_Z>,.2,<Av_X,12,Av_Z>,0}
cone {<Av_X,0,Av_Z>,.2,<Av_X,-2,Av_Z>,0}
cone {<0,Av_Y,Av_Z>,.2,<-2,Av_Y,Av_Z>,0}
cone {<10,Av_Y,Av_Z>,.2,<12,Av_Y,Av_Z>,0}
cone {<Av_X,Av_Y,10>,.2,<Av_X,Av_Y,12>,0}
cone {<Av_X,Av_Y,0>,.2,<Av_X,Av_Y,-2>,0}
/*
cylinder {<Av_X,10,Av_Z>,<Av_X,0,Av_Z>,0.1}
cylinder {<10,Av_Y,Av_Z>,<0,Av_Y,Av_Z>,0.1}
cylinder {<Av_X,Av_Y,10>,<Av_X,Av_Y,0>,0.1}

sphere {<Av_X,Av_Y,Av_Z>,.5}
*/
pigment{rgb <1,1,0>} finish {F_0}
translate <-5,0,-5>
rotate <0,150,0>
rotate <0,180*clock,0>
translate <4,0,1>
}

#end
//====================================================
//  textures and finish defs
//====================================================

#declare F_0 =  finish{diffuse albedo 1
                       specular albedo 1
                       roughness .0001
                       metallic on
                       fresnel on
                       brilliance 10
                       emission 0
                       reflection {.25
                       metallic on
                       fresnel on}
                       irid {1 thickness .01 turbulence .05}
                       }

#declare F_1 =  finish{diffuse albedo 0.2
                       phong 1
                       reflection 1
                       metallic on
                       brilliance 5
                       }


//====================================================
// Cube with randomly placed spheres
//====================================================

#declare Cover = box{ .75,9.25    pigment {rgb 0} no_shadow
                                  finish {diffuse 0}
                    }


union {  // random particle

#declare R1=seed(123);
#declare F=frame_number/(final_frame/5);  // range 0...5
#declare V=9.85;
#declare Count = 20000;
    #if (frame_number > final_frame*4/5)
    #declare Step = final_frame*4/5 - frame_number;
    #declare Count = 1+(Count+Step*400); // avoid div by zero
    #end

union {
#for (N,0,Count,1)
#local P1 =<pow(rand(R1),F)*V,pow(rand(R1),F)*V,pow(rand(R1),F)*V>;
#declare L= vlength(P1);
#local Radius = pow(.8,L);
    #if(inside(Cover,P1)=0)
    sphere {P1,.05 pigment {rgb vnormalize(P1)}
                   finish {F_0}
           }
    #end

Stats(P1)

#end
translate <.1,.1,.1>
}
object{ // Wire_Box(A, B, WireRadius, UseMerge)
        Wire_Box(<0,0,0>,<10,10,10>, 0.15   , 0)

        texture{ pigment{ color rgb <1,.9,.8>}
                 finish { F_0}
               }
        scale 1  rotate<0, 0,0> translate<0,0,0>
        no_shadow
        no_reflection
      } // ---------------------------------------------

object {Cover}

box{0,9.95 pigment {rgbf .95}
         finish {
         ambient 0.2
         diffuse 0.0
         reflection 0.12
         specular 1.0
         roughness 0.001
      }

    interior{
         ior 1.45
         fade_distance 2
         fade_power 2
         caustics 2.0
      }
  }


translate <-5,0,-5>
rotate <0,150,0>
rotate <0,180*clock,0>
translate <4,.075,1>
 }


// RSoCP -----------------------------------------------------
sphere {0,5.5 translate <-20,5,15> pigment {rgb <1,.9,.8>}
                                 finish {F_1}
       }

 Show_Stats()
 Show_Stats1()

//EOF


Post a reply to this message

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