POV-Ray : Newsgroups : povray.text.scene-files : yet another grass inc Server Time
28 Jul 2024 14:25:24 EDT (-0400)
  yet another grass inc (Message 1 to 1 of 1)  
From: Mick Hazelgrove
Subject: yet another grass inc
Date: 14 Nov 1999 13:43:17
Message: <382f02c5@news.povray.org>
Here's the grass file I used in Mountain Tarn please use and abuse and if
you improve it send me a copy!

Mick
file://Mick's Grass.inc

#declare GrassTex=texture {
  pigment {
    wrinkles
    color_map {
            [0.25 color rgb <.7, 0.7, 0.3>]
            [0.5 color rgb <.5, 0.6, 0.2>]
            [0.85 color rgb <1, 1, 0>]
              }
          }
  finish{ specular 0.5}
}

#declare GrassTex2=texture {
  pigment {
    wrinkles
    color_map {
            [0.25 color rgb <1, 0.7, 0.2>]
            [0.5 color rgb <1, 1, 0.3>]
            [0.85 color rgb <1, 1, 0>]
              }
          }
  finish{ specular 0.5}
}

#declare R = seed(343);

#declare XP = -2.5;
#declare ZP = -2.5;

#declare blade = mesh {

 #declare No_Segs = 15;
 #declare C = 0;
 #declare Seg_length = .25;
 #declare Rot = 90-15;
 #declare Ox = 0;
 #declare Oy =0;
 #declare Nx = Seg_length;
 #declare Ny = Seg_length;
 #declare Z= 0.15;

    #while (C<No_Segs)

                #declare xdist = sin(radians(90-Rot))*Seg_length;
                #declare ydist = cos(radians(90-Rot))*Seg_length;
                   #declare No_Segs = 15+(rand(R)*10);
                    #declare Nx = Ox+xdist;
                    #declare Ny = Oy+ydist;


               #if (C<(No_Segs-1))
                 triangle{<Ox,Oy,Z> <Ox,Oy,-Z> <Nx,Ny,Z> }
                 triangle{<Ox,Oy,-Z> <Nx,Ny,Z> <Nx,Ny,-Z>}
               #else
                 triangle{<Ox,Oy,Z> <Ox,Oy,-Z> <Nx,Ny,0>}
               #end

                #declare Rot = Rot-pow((2+rand(R)*1.5),2);

                  #declare Ox = Nx;
                  #declare Oy = Ny;

                #declare Z=Z-0.012;
                #declare Seg_length = Seg_length +.01;
                #declare C=C+1;
    #end

}//end mesh

#declare Patch = union{
#declare Inc = .1;
#declare Angle = 0;
#declare CT = 0;

    #while (CT<300)

    object{blade
      rotate y* pow((2+rand(R)*180),2)
      scale .5+(rand(R)/2)
        translate<0,0,Inc+(rand(R)) >
          rotate y*Angle
          #if(mod(CT,3)=0)
            texture{GrassTex2}
          #else
            texture{GrassTex}
          #end
             }
       #declare CT = CT + 1;
       #declare Inc = Inc + .025;
                #if(CT>150)
                    #declare Angle = Angle + 7.5;
                #else
                    #declare Angle = Angle + 15;
                #end

    #end
}//end of union

file://object{Patch scale 1 translate y*-3}


Post a reply to this message

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