Announcement

Collapse
No announcement yet.

Making Trees and Plants with Max and PFlow

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Making Trees and Plants with Max and PFlow

    I know this isn't specifically VRay rendering related, however as the result is really only useful with VRayProxies...I figured this is appropriate
    In another thread, there was some interest in how I make plants using max and pflow. I don't have time for a full out tutorial with pictures, but I can give a bit of an over view and answer questions if anyone is interested in trying this.

    First off, here are some examples I made
    http://www.charleycarlat.com/products/index.html
    Most of these plants were made with this technique.

    Ok, to start with, you need good reference of the plant you want to make. Good images of the branching structure and the leaves are important.

    I then start the model with the main branches. For a tree this is the trunk and maybe 2-3 branching levels after that. For plants that are more stems, it would be the stems.

    During this step it is very important to follow your reference as close as possible. I don't mean that you need every twist and turn in the image. But study the locations of branchings relative to other branches, the direction they flow, the amount of gnarliness in their path, their general lengths relative to other branches and from parent to child. If this step does not resemble your final plant, it wont when you are finished.

    1 - First, I make Splines of the general shape of the branch paths. Sort of like drawing it out in the front viewport. Then I tweak the Splines to have 3d curves (don't want them just flat).
    1a -this is an important step, because your lines need to reflect the branching shapes of the actual plant pretty accurately.

    2 - Next, I make a circle the thickness of the first branch (or trunk) and adjust it's interpolation to have around 8 sides (interpolation step of 1). Too many and it gets hard to add thick enough branches later on, and too few and it wont hold its shape.
    2a -I convert this to Editable Poly and use the Extrude along Spline tool in the Polygon Sub-Object set. Pick the Spline that represents the initial branch/trunk. Set the number of segments to a value that gets the shape across, but at most, creates square-ish faces. I usually keep the faces elongated in the flow of the branch. Add a bit of taper as needed per reference images, and a bit of twist (not too much). This twisting is important because it really helps the plant flow more naturally.
    2b -At this point, the reference really starts coming into play. A lot of plants branch at this point, but some continue on to form sort of one main branch the whole way up the plant. I will continue as if it branches at this point, but if your plant continues on, skip the next step.
    2c -To branch this initial trunk, cut the top polygon in half and adjust the two poly's to form two pretty uniform pentagons. Add a vertex to the shared edge, so that once extruded, you will have hexagons rather than pentagons. I then add a small extrusion and model these into pretty uniform hexagons. This uniformity keeps the next set of branches having the correct cross section. I also generally model these into a wedge shape so that each branch goes off in a new direction.
    2d -Use Extrude along Spline to add your new branches. At this point, I generally use the Align to face normal feature and adjust the rotations as desired. Many times these are longer than your initial trunk was, so you may need more segments and a touch more twist.

    3 - Ok, at this point the branching method changes. I pick a horizontal edge at the point where I want my next branch. Chamfer this until the two horizontal verts touch the vertical edges on either side. You end up with a new hexagon in the side of your branch. Remove the two interior edges of this hexagon so that you have a clean poly.
    3a -Then use the Hinge along Poly tool to get the new branch direction. Very few plants branch off at right angles, so typically you will choose an edge at the top of the hexagon as your hinge.
    3b -Use Extrude along Spline to add in the new branch. By now, keep the taper values enough so that the branches are pretty small at the ends. If they are too thick, it will look odd later on. Also remember to keep using different Splines as you do this to keep good variation in the plant. Adjust the rotations so that the general flow of the branches follow your reference images.
    3c -Repeat the last step as many times as you need to go out to about 3 or so levels of branches. The basic idea is that if you are close enough to the plant, these are the only branching levels that might catch attention ad thus look like they are seamlessly part of the trunk.
    3d -Once PFlow is used, you will need to have a Poly selection to tell PFlow where to add the new branches. The fastest way to do this is to select the bottom faces of the trunk, grow it up until the unselected part is where you want you new branches and then Invert Selection of faces. Now you have a selection of faces where you want you new branches.

    4 - Grab your a few of your favorite Splines from the first step and we will model these into the next levels of branches. I usually use the Renderable Spline modifier so that I can use the Generate Mapping (very useful later on). Apply the modifier and reduce the Spline interpolations so that these branches have no more than the general mesh resolution than trunk you just made. I tend to set the Renderable Spline sides to 4 or 3 depending on how many branches I will need. It is good to save polys where you can, by the end these can get big. Model them to have a taper and a bit of twist similar to the trunk branches. Also, I delete the poly cap at the base for two reasons. It allows me to use the Border feature of Poly object to easily create the base, and if you mesh smooth (Turbosmooth) these later on, it will retain its diameter.
    4a -Set the pivot point of each branch in the center of its base, this what is used as the point of attachment. Also, make sure all your pivots are orientationally aligned. I typically just align them to World, so that Z is up with all of them.
    4b -Parent all branches to one of them, this is how PFlow will know to use all of them.

    At this point we start with PFlow. I will write this assuming that you don't have PFTools box 1 or 3. If you do, you can ask about it and I will share methods for getting a lot better control.

    5 - Create a PFlow system. Adjust the Viewport particle display to show 100% of particles.
    5a -Set the Birth Op to birth all particles from frame 0 to frame 0 (essentially birthing at frame 0)
    5b -Replace the Position Icon Op with a Position by Object Op. Use the Trunk as your Emitter Object. Set the Location to Selected Faces. Turn on Separation and set a value great enough relative to your trunk to try and avoid many branches at any single point. (if the trunk is 15' tall, set this to about 2'-4')
    5c -Replace Speed Op with Speed by Surface. Create a Geosphere (about the diameter of the trunk) at the base of the trunk and add it as the Surface Geometry. This Op is used to get the Rotation correct, so the actual amount of Speed doesn't matter.
    5d -In the Rotation Op, set the Orientation Matrix to Speed Space. You may have to do some adjusting in here later on once you have added the Shape Instance OP.
    5e -Replace the Shape Op with a Shape Instance Op. Pick the Parent Branch from the branches you created. In the Separate Particles for: list, choose Object and Children.
    5f -Set the Display type to be Geometry
    5g -Adjust the Particle amount in the Birth Op relative to you reference images. Remember, these are not all your branches and each branching set will have more branches. Typically this number is between 20-100 depending on the plant.

    6 - Now, you should be able to see your particle branches on the trunk, but they may not be pointing in the right direction. First off, all the branches need to be pointing away from the Geosphere. If they are pointing off to the side, you need to adjust the Rotation Op. Adjust the XYZ amounts to get the branches pointing in the right direction. The only values you should need to use are about 90 or -90 as if you have a problem, it should be 90 degrees out of axis in some direction.
    6a -Once they are pointing in the right direction, move the Geosphere towards the center of mass of the trunk object. Decide based off your reference how high the Geosphere needs to be to get the branches to point off at the correct angels. You can either adjust the Divergence in the Rotation Op or in the Speed By Surface Op to get a bit of variation. Also, adjust the scale as needed in the Shape Instance Op and add a bit of variation there as well.
    6b -Once you are happy with your branchings, select the Pflow Icon and use this script to create a Mesh of your particles. www.charleycarlat.com/MaxScripts/pf_FreezeR7.zip
    6c -Delete the Wire between the Render Op and the Event to turn off the particles (there is a reason I do this rather than just turning off the PFSource, but you can do either).
    6d -Select the new Mesh branches created by the script, convert to Editable Poly and select all the Borders. Holding Ctrl, click the Polygon Selection icon in Editable Poly to grab all the base polygons, grow as needed and invert selection to create the faces you want for the next level of branching.

    7 - In Particle View, select the Event just used and copy and paste a new one. If you are a good worker, you will name the original Branching1 and this new one branching2 (or something to that effect). Replace the Trunk selections used in Branching1 Event with the new Branching Mesh created previously (also named by this point by those of you who are neat).
    7a -Adjust these branches to be slightly smaller than the Previous ones. If you need to make them a lot skinnier, but retain some of their length (or add more if desired) add a Scale Op below the Shape Instance Op and set it to Inherit Once. Now you can adjust the scale as needed.
    7b -Also, remember to add more branches.
    7c -Generally you will begin to adjust the Geosphere at this point as well to get the branches going in the directions desired by your reference images.

    8 - Repeat step 7 until you get to a point you think you have enough branches to add the leaves and have a decent looking plant.

    9 - To add the leaves, start with a copy of the Branch Event. Model up a leaf, texture it and set its pivot to be like the branches. I usually add only the absolute amount of poly detail needed here as you can get out of hand really fast with leaves. If you need good leaf variation, make several leaves, each with slightly different materials and parent them to one leaf as you did with the branches.

    That is an overview of process. I will now add a few tips and advanced ideas.

    Tips;

    -by slowing raising the Geosphere over the course of the Branching Events, you can simulate Gravity's effect on the branches, leading to a more natural plant.
    -You can use more than one Geosphere if you need to.
    -Leaves that are slightly out of scale (on the large side) can make up for having a lot more of them. Know your leaf's poly count, and do the math to avoid leaf counts that will crash your computer.
    -Some plants work better if the last level of branching has the leaves manually placed on the branches before using PFlow to add those leafy branches to the plant.
    -For 'weeping' type plants, model the branches to arch down and droop, and use the Rotation method of Random Horizontal to put them on the branches.
    -A really good way to UVMap your Trunk object is to (a-make a copy of it (b-turn it upside down and add Cloth modifier (c-group the base Verts as Preserved (d-Simulate to hang down straight (e-convert to mesh and UVMap (f-Morph back to original shape (using the Copy).

    Advanced tips;

    -Use gradient materials on the Trunk and the Branches in conjunction with the Density by Material parameter of the Position Object Op to get more accurate results when needed.
    -If you know scripting, try and use the Speed by Material data to create a scale by material Script Op to get the outer most branches/leaves to be smaller than the inner ones. PFBox3 has a Data Op that does this.


    Ok, That is about all I can think of. Please feel free to ask questions and or tell me how much easier it is to use other products (and I will tell you how much more control I have using this method )

  • #2
    Very nice

    Great info!!

    Comment


    • #3
      Whoa.... This looks like some good reading and I hope I can find the time to work it in. Nice work - Thanks a ton

      Comment


      • #4
        uau...there are fantastic stuff in your site!!!!
        but there is any chance to download your perfect 3d trees and plants from your site?

        Comment


        • #5
          Thanks for the compliments guys.

          arch.san - I do sell the collection of plants. If you are interested, send me an email at charleyc@charleycarlat.com.

          Comment


          • #6
            i've been looking for this.
            thanks a lot mate. really cool tutorial there.
            Dominique Laksmana

            Comment


            • #7
              Nice work...what kind of render times could one expect, let's say for example, compared to xfrog or onyx stuff? I know it's kind of a tough question to answer being so general...
              Thanks for the great write-up!

              Comment


              • #8
                I don't think there would be an difference in speed with comparable models. This is really just showing how you can use native max to create plants. The biggest benifit these models have over some others is that they don't use opacity maps which really slow down renders. Both Onyx Tree and Xfrog are capable of producing this.

                Comment


                • #9
                  As far as render times, it really depends on a lot of things. The average plant up close probably takes about 6-10 min to render with full GI on my dual 2.8 Xeon depending on final face count. However, that plant pulled a bit away from the camera can render in much less. I did a test once when I was figuring out VRayProxies where I rendered several hundred instances of a 700,000 face plant in around 10 mins. I have also done production work with over 6,000 instances of various plants with render times at about 3-4 hours at final resolution. But those also included fully raytraced cars and building windows. Those images (at final resolution) required more than 2GB of RAM, or they would have rendered VERY slowly.

                  Comment


                  • #10
                    Thanks , very impressive.

                    Comment

                    Working...
                    X