Home Technical Talk

Building Placement on Complex Terrain

polycounter lvl 11
Offline / Send Message
leechdemon polycounter lvl 11
I'm building a small village, and I'm trying to find out the best way to place buildings onto my terrain. I've already created and placed all of the buildings' X and Y coords. I created terrain for the village, and I'm hoping to use some sort of modifier or clever trick to place the buildings correctly on top of the terrain. If I do something like a displacement map, the buildings will all be vertically skewed. Is there a better way to do this?

Replies

  • Justin Meisse
    Options
    Offline / Send Message
    Justin Meisse polycounter lvl 18
    why not hand place them?
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    Maybe "Village" doesn't explain well enough. I've got 1500 buildings to place. They're pretty much all tiny huts, but there's a lot of them. I can place them by hand, but it's a long, miserable process. I was hoping to use something smart like a displacement or even Reactor to "drop" them onto the terrain, but so far nothing is panning out. Was just curious if anybody else had similar experiences with placing buildings.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Personally if i had to do it I would script it. It depends on the buildings tho, they would need to be individual meshs with correctly placed pivots.
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    All the buildings are individual, and the pivots are centered, but can easily be placed at the bases.

    What type of script would do this? I'm not even sure what operation to use to make a single building sit on the ground correctly, at this point.
  • Mark Dygert
    Options
    Offline / Send Message
    Yea I agree scripting it would be a good way to go if you know what you're doing.

    If the huts are instances or clones, you could use the object paint tools. Load them up in the library and click/paint them into place. If they're all individual that probably won't work that well...

    There was a plug-in called "Glue-it" I think that would move object to the surface of another object.

    You could experiment with the "conform compound object". This won't work on your huts, it will smash them flat. I'm not sure if it moves an objects pivot to the surface or just the mesh. If it moves the pivot you could link the hut to a dummy object of some kind and conform that to the surface and then snap the hut to the conformed shape. That could probably be automated through scripting also.

    You could also use a Position Attachment Constraint, depending on your scripting knowledge you could set up a quick script that lets you click on a hut, and place it on the terrain. You probably want to make a "snapshot" of the mesh and delete the attachment constrained version.

    Or actually you might not even need the attachment constraint, you could probably get the poistion from a mouse click and just move it there...

    You could paint a spline on the surface, then link the huts to dummy objects and path deform the dummies?

    I dunno... didn't give it much thought there are some ideas.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Script! You will need to make sure your houses pivots are at their base.
    i can give you a script for that if need be. I made the script only position the house not change their orientation to fit the terrain, I can do that too, but it struck me as a dumb idea.

    If you find the houses are not fully bedded into the ground there are 2 solutions, you can move their pivots up a little and re cast or you can model a platform for them to sit on.
    (
    fn placeOnTerrain aObjects nTarget = 
    (
    	dir = [0,0,-1]
    	
    	for obj in aObjects do
    	(
    	  rRay = ray obj.position dir
    	  hit = intersectRay nTarget rRay
    	  obj.position = hit.pos
    	)
    )
    
    rollout r_placeOnTerrain "Place On Terrain" width:280 height:128
    (
    	pickbutton pb_getTerrainObject "Pick Terrain" pos:[8,104] width:73 height:21
    	button btn_placeSelection "Place Selection" pos:[88,104] width:90 height:21
    	GroupBox grp1 "Instructions" pos:[8,8] width:264 height:88
    	label lbl3 "Make Sure Terrain is Editable Mesh" pos:[16,24] width:248 height:16
    	
    	label lbl4 "Pick Terrain" pos:[16,40] width:248 height:16
    	label lbl5 "Press Place Selection" pos:[16,56] width:248 height:16
    	label lbl6 "Buy R_Fletch_R a beer" pos:[16,72] width:248 height:16
    	on btn_placeSelection pressed do
    	(
    		placeOnTerrain (selection as array) pb_getTerrainObject.object
    	)
    )
    createDialog r_placeOnTerrain
    )
    
  • CheeseOnToast
    Options
    Offline / Send Message
    CheeseOnToast greentooth
    If that ^ isn't what you're after, there's a great script called "spPaint3d.mel" which you can grab from here :

    http://www.creativecrash.com/maya/downloads/scripts-plugins/rendering/misc/c/sppaint3d

    You get a lot of control and can randomize which meshes are placed, their orientation jitter etc. It's a bit of a duplicate of some of Maya's existing tools, but whith some additions and a simple interface.
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    You could experiment with the "conform compound object". This won't work on your huts, it will smash them flat. I'm not sure if it moves an objects pivot to the surface or just the mesh. If it moves the pivot you could link the hut to a dummy object of some kind and conform that to the surface and then snap the hut to the conformed shape. That could probably be automated through scripting also.

    That sounds promising. Not sure how I'd script it, though.
    r_fletch_r wrote: »
    Script! You will need to make sure your houses pivots are at their base.
    i can give you a script for that if need be. I made the script only position the house not change their orientation to fit the terrain, I can do that too, but it struck me as a dumb idea.

    If you find the houses are not fully bedded into the ground there are 2 solutions, you can move their pivots up a little and re cast or you can model a platform for them to sit on.

    Sweet, I'll give that a shot in the morning. If that doesn't work, I'll try Cheese's "spPaint3d.mel". Thanks for all the suggestions!
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    leechdemon wrote: »
    That sounds promising. Not sure how I'd script it, though.
    Sweet, I'll give that a shot in the morning. If that doesn't work, I'll try Cheese's "spPaint3d.mel". Thanks for all the suggestions!

    Cool keep us posted.
  • leechdemon
    Options
    Offline / Send Message
    leechdemon polycounter lvl 11
    r_fletch_r wrote: »
    Cool keep us posted.

    http://myfacewhen.com/96/

    In otherwords, "OMIGOD, that was sweet". It worked, quickly, and didn't crash or do anything crazy.

    city_preview1.jpg

    It seems like some buildings were placed at different heights than others; not sure if that's a problem with pivots on my place or something to do with the scripts (I think most of the misplaced buildings were 2-story buildings as opposed to 1-story, if that makes a difference), but select-by-name and moving them as a group helped clear that up.

    Thanksx100. I'm holding a cold Worldwide Stout against the monitor for you, as per your instructions. :)
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Excellent :), probably a pivot issue with the 2 story buildings.
  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    when the bottom of the door is on 0,0,0 you can just place it directly to the heightmap
    you probably need to add an oversized fundament mesh, thats what i did everytime
Sign In or Register to comment.