I have a mesh of a terrain with seperate models of a large building and various roads and parking lots on top of it. I wanted to add a tree particle system to the faces of the terrain not covered by the building and roads and I wanted to know if there was a way to select only the faces that are not covered. All of the faces that I want to select are visible when looking from above.
Please click on the image to see a larger image. Particles are emitted in the areas not covered by buildings as explained below. A flat plane is the terrain. A torus and cone represent simple buildings. The buildings are in wire mesh mode to indicate no particles are in that area of the terrain. The yellow arrow shows the particle [density influence] with a check mark.
In the image above the building area have been expanded by blurring in a 2D image manipulation program. Perhaps Blender. Blur, Dilate, Erode can be used. This helps to eliminate trees placed too close to buildings.
- In the particle panel, Textures can determine the areas of particle emission.
- The plane has a UV projection. Use that UV projection as needed.
GIMP image manipulation was used. GIMP is free. Use the image manipulation tool of your choice.
You can hand paint the image if that suits your tastes in what follows below or use the other tools that come with your image editor.
You can easily render and create an image of the top view of your scene, with orthographic projection. I used a low quality workbench render with flat colors. You may choose to temporarily have your terrain in an unusual color such as bright green as in green screen for the top view render. You can save a single image with a name such as image001.png.
Use an image manipulation tool to process the image001.png for about 33 seconds, to increase contrast if necessary, and building area dilation. This image can be processed to achieve a gray scale or black and white image. In the first image above you see a green and white image. Next it was processed to get the solid green and solid black image for high contrast. Black for no trees. White or Bright for trees. The new image was saved as image002. Use this image002.png to control emission density. Of course choose image names that are suited to your tastes.
A texture slot was added in the particles panel. The same texture slot was edited with the texture panel to change the [Influence Density]. The image image002.png was specified.
Please inspect and improve any steps.
Another way is to use vertex weights.
But this technique needs either :
- That you group all of your objects into one (Object > Join when selecting multiple objects)
- Use as many "vertex weights proximity" modifiers as you have different obstructing objects.
- Create a "proxy" object mesh which will encompass all your other objects. You can then deactivate rendering for this object and hide it in viewport or set it to bounding box display so that it doesn't bother you.
- Add a vertex group to your terrain
- Add a particle system to your terrain set to Hair
- In the "Vertex groups" foldout of the particle system, set the "Density" to your group
- Important : In Emission > Source, check "Use modifier stack"
- Add a "Vertex Weight proximity" modifier to your terrain. Place it in first position, before the particle system. Set the Vertex group to your newly created group, the object to the obstructing object. Set the distance to geometry, and you can SHIFT + Drag to select Vertex, Edge and Face. Set the fallof to median step. Keep "Lowest" to 0 and crank up Highest till your trees visibly get pushed out of your geometry.
Note : It won't update directly if you move the obstructing object. You need to toggle off/on the particle system for it to update. It will update if you move the terrain itself.
As @lemon has commented, an alternative method for generating the raw texture might be to temporarily disable all your lighting, replace with a Sun lamp pointing vertically down in Z, and (using Cycles) bake a shadow map, as shown on the left.
If you set the angle of the lamp wide, to get a soft shadow map, you can have some control over the margin between the buildings and the trees, by putting the texture through a color ramp, and out into an Emission shader. You can then re-bake the resulting Emission.
Optionally, retouching can all be done inside Blender, using Texture Paint.