SandmanNinja Posted September 5, 2009 Share Posted September 5, 2009 Situation: I have a plane that has a lot of subdivisions, with hills and valleys, and is an editable poly. It represents terrain. I have a collection of circular editable polys that are physically higher (z-axis) than the terrain. These circular editable polys represent where tree meshes are meant to be placed on the terrain. Problem: Using a tree mesh as the scatter object and the circular editable polys as the surface to get the tree mesh scattered onto, I have managed to get the trees nearly perfectly centered on each circular editable poly. HOWEVER: The trees are at the same z-axis height as the circular editable polys. When I selected the scattered tree meshes and tried to move them down, they (obviously) do not plant themselves at the proper z-axis to match the hills and valleys of the terrain. Question: What method would give me the desired solution? I was considering using the terrain as a particle flow emitter , but the 'mask' or the position information is higher and on an even z-axis. Thanking you Link to comment Share on other sites More sharing options...
rmccoy Posted September 5, 2009 Share Posted September 5, 2009 I think this plug-in may help you out. It's called Glue. Basically it will allow you to place an object on a surface using the pivot point as the reference. I use it all the time to place proxied items onto uneven terrain. http://www.itoosoft.com/english/menu.php?id=download Link to comment Share on other sites More sharing options...
ronel Posted September 5, 2009 Share Posted September 5, 2009 i assume you know how to compile maxscripts, if not on your 3d max go to maxscripts then new scripts, copy the text below after the line and paste it to your new scripts. save it ( anyname you want). After saving it as maxscripts, run it on maxscripts. To use, right click on an empty space of the maintoolbar, hit customize. Go to Toolbar -->> Category and look for Move, then on its subdirectory you will see MoveToSurface, drag it to your toolbar. To apply: select the items you wish to move, hit your move to surface toolbar, then select the destination object ---------------------------------------------------------------------- macroscript MoveToSurface category:"Move" ( fn g_filter o = superclassof o == Geometryclass fn find_intersection z_node node_to_z = ( local testRay = ray node_to_z.pos [0,0,-1] local nodeMaxZ = z_node.max.z testRay.pos.z = nodeMaxZ + 0.0001 * abs nodeMaxZ intersectRay z_node testRay ) on isEnabled return selection.count > 0 on Execute do ( target_mesh = pickObject message:"Pick Target Surface:" filter:g_filter if isValidNode target_mesh then ( undo "MoveToSurface" on ( for i in selection do ( int_point = find_intersection target_mesh i if int_point != undefined then i.pos = int_point.pos )--end i loop )--end undo )--end if )--end execute )--end script Link to comment Share on other sites More sharing options...
Chad Warner Posted September 5, 2009 Share Posted September 5, 2009 I think this plug-in may help you out. It's called Glue. Basically it will allow you to place an object on a surface using the pivot point as the reference. I use it all the time to place proxied items onto uneven terrain. http://www.itoosoft.com/english/menu.php?id=download Glue is a beautiful plugin. One of the most uuseful things I do with it is to apply cars to a sloped parking lot. It allows you to align the normals of the glued object and the normal of the surface it's being applied to, so the card drop into exactly the right position. Link to comment Share on other sites More sharing options...
SandmanNinja Posted September 6, 2009 Author Share Posted September 6, 2009 Great stuff! Glad to know I wasn't going crazy or am not alone in this situation. Some great info - thanks to Ronel for taking the time to post the script, and thanks to Chad and Ross for putting me on to a good plug-in. Cheers Link to comment Share on other sites More sharing options...
SandmanNinja Posted September 6, 2009 Author Share Posted September 6, 2009 I tried the above posted script, but I couldn't get it to behave for me. I then downloaded Glue (free?? amazing!) and it worked a charm! I also used a free script from http://www.scriptspot.com called DetachElement and it works amazingly well. My "targets" were a collection of 389 circular spots pieces of editable polies. For whatever reason, I was unable to get neither the built-in Scatter nor the very good script Scatter to properly align the trees in the middle of the circular spots. Soooo.... I detached each element to its own object (thanks to the above mentioned script) and then I aligned each tree by hand to each new circular object. With the Align on my quad menu it only took 20 minutes to get the job done on all 389 trees. I then used Glue and they all dropped down beautifully. Here's a screen grab - thanks again everyone. Link to comment Share on other sites More sharing options...
Crazy Homeless Guy Posted September 6, 2009 Share Posted September 6, 2009 (edited) I guess I am confused why you would want the z value to be aligned with the normal, rather than always vertical when creating trees? Or am I reading this wrong? Typically, I will use Soulburn scripts to accomplish this. Object Replacer to replace the circles with trees. Object Rropper to drop the trees to the surface. Then drag them slightly below the surface if needed. The Transform Randomizer to randomly adjust the scales. The actually I switch over to Quizzy's random rotate for random rotation. This couyld probably be done with the Soulburn Transfrom Randomizer script also, but I like the way Quizzy's behaves better. But anyway, this is the process I use for planting trees according to CAD plans. Once the CAD data is in 3dsMax, and you already have the tree ready, the process of placing them with the scripts above shouldn't take more than 6-7 minutes for 389 trees, as long as the same tree was used. Edited September 6, 2009 by Crazy Homeless Guy Link to comment Share on other sites More sharing options...
SandmanNinja Posted September 6, 2009 Author Share Posted September 6, 2009 Hi Travis, I might have gone the long way around to get the solution. I don't do a lot of CAD-> 3DS work. The file as presented to me had the 'place holders' around 300m above the terrain. They were all level - all had the same Z-Axis. I wasn't aware of the Object Replacer script and that would have saved me quite a bit of time (and I'll check it out next time I do this!!), so I just did the best with what tools I knew about. It only took about 20 minutes to manually align the trees once I got into the swing of things. I then used Glue and dropped the trees down to the uneven terrain. Thanks for pointing the Soul Burner scripts out to me. Thanks for providing your detailed workflow - I appreciate it. Link to comment Share on other sites More sharing options...
dean@pikcells Posted September 10, 2009 Share Posted September 10, 2009 Another recommendation for SoulBurn scripts! There's so many useful scripts that I use on a daily basis in production! Link to comment Share on other sites More sharing options...
Bruce Hart Posted September 10, 2009 Share Posted September 10, 2009 I might mention that the glue plugin is also good for draping splines onto a mesh surface (without using shapemerge). I've used it for putting road lines on undulating roads. Just make sure you change the default subdivision value of 100 down to something less than 10 or you may get a crash. Link to comment Share on other sites More sharing options...
SandmanNinja Posted September 10, 2009 Author Share Posted September 10, 2009 Thanks Bruce - good tip! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now