Announcement

Collapse
No announcement yet.

Tool to convert opacity mapped faces into geometry leaves

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

  • Tool to convert opacity mapped faces into geometry leaves

    Here's another wee widget, a job I'm working on has a load of trees in it and one of the guys here used the aec trees in 3ds max 7 (objects > aec objects > foliage) which use a plane mapped with a leaf picture and an opacity map which is pretty slow in vray so I wrote a little script that copies a selected object to the position and orientation of the leaf faces - It's a hell of a lot quicker to render geometry than opacity maps. Here's the workflow:

    Take a tree object and convert it into an editable poly object.
    Go into polygon mode and find the material id of the leaves / flowers / whatever you want to replace.
    Make a little bit of leaf geometry to replace the flowers with.
    Select your editable poly tree and run the script.
    Set the replace id spinner to the material id of the objects you want to replace.
    Pick the leaf object using the "pick leaf object" button.
    Hit make leaves.
    Wait for fuck ages.

    You'll end up with a new editable mesh object with all of the leaves so you can now add a delete mesh modifier onto your editable poly tree to remove all of the old leaves. It's not the smartest of scripts and probably has loads of error situations so make sure to save your scene / do a hlod before you run make leaves.

    I reckon the best way to use this is as a step to making vray proxy objects, I wouldnt try using it on multiple obejcts just yet.

    Here's the script:

    http://www.joconnell.com/stuff/Leaf_converter_0.04.ms

    And the really snazzy swiss inspired interface:


  • #2
    Hey thats neat!! Thanks for sharing

    Comment


    • #3
      Again any thoughts on how it could be improved, leave (ha ha) them here - it'd be much appreciated.

      Comment


      • #4
        havent tested it yet but does it instance the new leaves?

        Comment


        • #5
          I actually generates one editable mesh for the new leaves so you can move it along with the tree. I could add in options for instancing quite happily - The reason it was done was mainly to sort out a job where someone here was doing things the dumb, brute force approach on around 4.5 million polygons so the script was meant to facilitate a way to convert the opacity maps to geometry to facilitate the making of vray proxy objects. I'll stick in the option for instancing of the leaves in the next wee bit if you think it'd be helpful.

          Comment


          • #6
            for forests using vray meshes your approach is preferable i guess

            my idea is that if you have only single trees (garden viz or whatever) instanced leaves should be faster than proxying the whole tree

            a nice way to get variety into the look is to assign 3 or 4 randomized mat-ids to the opacity leaves before exchanging with seperate geo-leaves

            i usually did this using the randomFaceSelect script the guys at blur studio wrote

            Comment


            • #7
              Yeah indeed - I've rewritten it to allow you to define a selection of leaf obnjects first and then it'll randomly pick on of the leaf objects to replace an opacity mapped face so you have that functionality now - I'll add in the support for different material ids. I reckon instanced leaves (as in a seperate object for each leaf) would possibly make something like your select by name dialog crawl - I'll add it in as an option but not the default.

              Comment


              • #8
                cool, thanks a lot
                ps: you got the new code into the exact same file size?

                Comment


                • #9
                  Sorry but I havent put it up yet, there's a problem with me accessing certain parts of my site from my work connection so I'll have to upload it from home - it should be up in a few hours, I'll put an entry on the site.

                  Comment


                  • #10
                    hmmn, was reading the source code comments and thought id found a mention of seperate leaf support
                    timestamp was different, too

                    dont worry, i'll check back later...

                    tnx again and cu, mike

                    Comment


                    • #11
                      If you want to stick up a list of bits you'd like in it here, it's all really quick to add in so I can do them before I upload it later - fire away

                      Comment


                      • #12
                        Thanks for this, now I render 2300 trees with lightspeed!
                        this is rendered as a test in about 3 minutes.

                        Comment


                        • #13
                          Excellent - glad its useful. Again any ideas that you think might be useful, post them here. So far I'll be adding in support for multiple selections of leaf objects and random material ids in the leaves to give more variation again - Anything you can think of though I'd be happy to look at adding it in.

                          Comment


                          • #14
                            what would be even cooler if it were able to say, trace the alpha channel of the leave map and make the leaf geometry based on the black outline around the leaf shape in the alpha mat.
                            Then dispose the leaf plane and apply the diffuse texture to the newly create leaf geometry.

                            Although i think thats a little bit impossible.. LOL ... would be great if it was possible tho.

                            Actually you could kinda do it.. althought im sure sure if its feasable and would require some decent scripting... picture this if you will.

                            1. apply a displace modifier (standard max one) to the leaf plane
                            2. put the leafs alpha map into the displace modifiers map slot
                            3. displace by a certain amount say 5mm
                            4. add a slice modifier set to remove top (or bottom, cant remember which)
                            5. move the slice modifier 4.5mm inti the object (thus leaving a small bit of leaf shape geometry)
                            6. add a shell modifier to make it solid

                            you might need to a mesh smooth or tesselate to get enough geometry in the leaf place for it to displace properly.

                            Comment


                            • #15
                              yeah it's called clip mapping and the way you described is a hack to do that - I'd say something like that to do an entire tree would be bonkers and end up with a huge amount of geometry but I'm looking into bitmaps and driving scripts based on their values so it is a possibility. The method you described is very doable though.

                              Comment

                              Working...
                              X