Grass Plugin for POVRay This document describes the usage of the grass.inc plugin. Included with it are the plugin and a sample file. This plugin is written for POVRay version 3.0. I have not The grass.inc plugin file takes several (read lots) parameters as described below and creates a mesh object when #included. You can create MANY copies of this mesh object as POVRay's memory usage is very efficient for this type of object. I have created over 9000 copies of a Grass mesh and traced them in a few hours in 64 Meg. This plugin uses the coordinate system used by Moray. This means that X is right, Y is away from you,and the Z axis is up. I did it this way as it makes it easier to add objects in Moray without converting coordinates. I also just prefer this coordinate system! The grass consists of "clumps" of blades with optional flowers. Each flower consists of a stem and a flower proper. The flower proper consists of one or more rows of petals, a centre section (stamens, pistils, etc), and a set of sepals. The parameters are grouped to reflect this structure. These parameters are defined below with sample values. Grass Parameters #declare R1 = seed(0) R1 is a random seed used throughout the plugin. #declare NumTri = 0 Initialized here. The plugin sends counts of triangles to the debug stream so you can see how many there are. #declare XStep=0.25 Average gap between clumps in the X direction #declare XStepRand=0.5 Fractional variation of position in X direction #declare YStep=0.25 Average gap between clumps in the X direction #declare YStepRand=0.5 Fractional variation of position in X direction #declare ZPos=0 Vertical position of ground. This is the base of all plants. #declare PatShape = 1 Set to 0 for a rectangle, 1 for a circle. #declare PatRad = 0.5 Set this variable to the required radius if you are creating a circular patch OR #declare XStart=-2.5 #declare YStart=-2.5 #declare XEnd=2.5 #declare YEnd=2.5 Set these for a rectangle. #declare MeanBladeHeight=0.2 Average length of a grass blade. #declare HeightVar=0.5 Fractional variation of length. 0.5 means vary the length by plus or minus 50%. #declare MeanBladeWidth=0.012 Average width of a single blade. #declare WidthVar=0.15 As for length. #declare MinAngle=15 Minimum angle between blade and vertical #declare MaxAngle=60 Maximum angle between blade and vertical #declare MinCurve=20 Minimum total angle of curvature of blade #declare MaxCurve=50 Maximum total angle of curvature of blade #declare MaxBladeSegs=8 Maximum number of segments in blade. There are a maximum of twice this number of triangles plus one in a grass blade. #declare MinBladeSegs=7 Minimum number of segments in blade. #declare MaxBlades=25 Maximum number of blades in a clump #declare MinBlades=15 Minimum number of blades in a clump #declare FlowerProb = 1 Probability of flower(s) in this clump Stem Parameters #declare MeanStemHeight=0.5 Average height of flower stem #declare StemHeightVar=0.1 As for blade length above #declare MeanStemWidth=0.005 Pretty obvious by now! #declare StemWidthVar=0.15 As for blade length above #declare StemTaper = 0.7 Fraction by which to reduce diameter of stem along length #declare MinStemAngle=10 Angles work the same as for blades above. #declare MaxStemAngle=20 #declare MinStemCurve=80 #declare MaxStemCurve=110 #declare StemCurvePower = 0.2 Sets the location of the curvature on the stem. 1 makes the stem curve evenly along its length, <1 makes the curvature move toward the top, and, >1 moves the curve down. Play with it! #declare MaxStemSegs=10 Max and min segments as for blades. Number of trianges is 6 time this number. #declare MinStemSegs=8 #declare MinStems = 2 Minimum number of flower stems to draw #declare MaxStems = 4 Maximum stems Flower Parameters #declare PetNum = 5 Number of petals in each row #declare PetLen = 0.05 Total length of petal #declare PetBendLen = 0.025 Length at which to bend petal. Should be less than PetLen #declare PetWidL = 0.012 Left half width of petal at bend point #declare PetWidR = 0.013 Right half width of petal at bend point. These two parameters let you create asymetric petals #declare PetWidB = 0.006 Width at base of petal #declare PetWidT = 0.027 Width at top of petal #declare FlowerSizeVar = 0.2 Fractional variation of flower size #declare PetAng = 80 Angle of petal from flower axis. 90 degrees means sticking straight out. #declare PetKink = 25 Angle to bend petal at PetBendLen. Positive means bend down at tip #declare PetArch = 15 Side to side bow of petal. Positive means bend down at edges #declare PetTwist = 1 Angle to rotate petal about its own axis. Think of a propeller! #declare PetTipLen = 0.012 Length of tip triangle of petal. This puts a point on the petal if it is larger. #declare PetTipKink = 10 Angle to offset tip triangle. Positive is down. #declare PetCentRad = 0.005 Radius of centre piece of petal. #declare PetCentHght = 0.004 Height of centre piece #declare SepalRad = 0.007 Radius of sepals (The green bits around the base of the flower) #declare SepalHght = 0.007 Height of sepals below the flower. #declare PetRows = 2 Number of rows of petals to draw. #declare PetRowScale = 0.8 Amount to scale each successive row #declare PetRowOff = -0.001 Amount to move each row along flower axis. Positive is up #declare PetRowRot = 36 Amount to rotate each successive row around flower axis #declare PetRowAngOff = -70 Amount to change PetAng each successive row. Negative means towards the vertical As well as the parameters, you need to declare several textures for the various parts of the plants. Grass_Text - is the texture used for the grass blades themselves and the stems. PetalText0 - is used for the first row of petals. PetalText1 - is used for any subsequent rows of petals. I did this because I wanted to draw daffodils! PetCentreText - is used for the flower centre section. SepalText - is used for the sepals. Usually this is the same as the grass blades and stems. All the parameters might seem overwhelming at first, but persist and you will find that they are fairly obvious to use after a few goes. Define the grass, then the stems, then the flower and you should be OK.