landscape_modeling_example - ptabriz/geodesign_with_blender GitHub Wiki
-
I. Setting up the blender Scene
-
II. Modeling the terrain
-
III. Modeling the water features
-
IV. Modeling vegetation patches
- Download and install latest version of Blender from here.
- Download and install Blender GIS addon from here. Installation guide available here.
- Download and unpack sample_data folder from here
GUI
- Run Blender and open the file "example_Landscape.blend".
- Select the default
Cube
object in 3D viewport and delete it (right-click on the object > press delete > ok ) - Set
render engine
to "Cycles". You can find it in the top header, the default is "Blender Render" - To increase the Lamp elevation and change the Lamp type to "Sun" for appropriate lighting:
- Left click on the
Lamp
object inOuliner
(on the right side wih objects' list) to select it - Go to
Properties editor
>Object
(the orange cube icon) >Transform
section > in theLocation
matrix, change the Z value to 1000 (see below figure if needed)
- Left click on the
- To change lamp type to Sun and increase the emission:
- In
Properties editor
>Lamp
(two icons to the right of theObject
icon) > expand theLamp
section > Change lamp type to Sun - Expand the
Nodes
section > Click onUse Nodes
to enable modifying Sun parameters. - Set the
Strength
parameter to 6.00
- In
|
---|
Python editor
import bpy
# remove the cube
cube = bpy.data.objects["Cube"]
cube.select = True
bpy.ops.object.delete()
# change lamp type and elevation
import bpy
lamp = bpy.data.lamps["Lamp"]
lamp.type = "SUN"
lampObj = bpy.data.objects["Lamp"]
lampObj.location[2] = 1000
# Setup node editor for lamp and increase the lamp power
lamp.use_nodes = True
lamp.node_tree.nodes["Emission"].inputs[1].default_value = 6
# Set render engine to cycles
bpy.context.scene.render.engine = 'CYCLES'
- Download the BlenderGIS addon
- Go to
file
‣user preferences
(Alt + Ctrl + U
) ‣Add-ons
‣Install from File
(bottom of the window) - Browse and select "BlenderGIS-master.zip" file
- You should be able to see the addon
3Dview: BlenderGIS
added to the list. If not, type "gis" in the search bar while making sure that in theCategories
panelAll
is selected. In the search results you should be able to see3Dview: BlenderGIS
. Select to load the addon. - From the bottom of the preferences window click
Save User Settings
so the addon is saved and autmatically loaded each time you open blender
Before setting up the coordinate reference system of the Blender scene and configuring the scene projection, you should know the Coordinate Reference System (CRS) and the Spatial Reference Identifier (SRID) of your project. You can get the SRID from http://epsg.io/ or spatial reference website using your CRS. The example datasets in this exercise uses a NAD83(HARN)/North Carolina CRS (SSRID EPSG: 3358)
- In BlenderGIS add-on panel (in preferences windows), select to expand the
3D View
>BlenderGIS
- In the preferences panel find
Spatial Reference Systems
and click on the+ Add
button - In the add window put "3358" for
definition
and "NAD83(HARN)/North Carolina" forDescription
. Then selectSave to addon preferences
- Select
OK
and close the User Preferences window
![]() |
---|
Learn more about Georefencing management in Blender
Blender's default settings are set to optimize viewport rendering performance and thus transparency parameters are set to minimum. Thus, Before modeling the vegetation we adjust the Blender setting to ensure that the alpha maps are properly displayed on screen.
- In the
Blender User Preferences
(Alt + Ctrl + U)>System
:- In
General
section > adjustDPI
to increase/decrease icon size based on your preferences and monitor resolution. - In
OpenGL
section > deactivateMipmaps
,GPU Mipmap Generation
, and16Bit Float Textures
. - Set
Selection
to Automatic. - Set
Anistropic filtering
to Off. - Set
Window Draw Method
to Automatic and No MultiSample. - Deactivate
Text Anti-aliasing
. - In
Texture
section setTexture limit size
to Off. - Set
Images Draw Method
to GLSL.
- In
- Click on
Save User Settings
on the bottom left corner of user preferences.
Terrain object before (left) and after the material assignment
In this example, we use BlenderGIS import function to import a terrain model with a geotiff format (.tif) and NAD1983 projection.
GUI
- Go to
file
>import
>Georeferenced Raster
- On the bottom left side of the window find
Mode
and selectAs DEM
- Set
subdivision
to Subsurf and select NAD83(HARN) for georeferencing. - Browse to the Sample data folder and select 'terrain.tif'.
- Click on
Import georaster
on the top right header. - If all the steps are followed correctly, you should be able to see the terrain in 3D view window.
We create a simple Terrain material using a Diffuse BSDF
shader with a grass image texture
.
- Change viewport display mode to
Material
. - Go to
Properties tab
>Material
> press+ New
button to create a new Material. Rename the Material to Grass. - To create the diffuse Shader:
- In the
Surface
panel notice that theDiffuse BSDF
shader is selected by defaults as the surface shader. - Click on the radio button in front of the
Color
parameter to open a drop-down. From the second column, select Image Texture. - Click on
Open
and navigate to the folder sample_data/textures/ > Select grass.jpg.
- In the
Grass material shown in properties editor (left) and node editor (right)
Low sample Viewport rendering of the water surface
For modeling water feature, We import a geotiff raster of a shallow pond created in and exported from Grass GIS.
- Repeat the raster import procedure described in 1.1 to import the water surface using water.tif.
- Select the Water object.
- Move the object 6 meters in minus Z direction to so that the object fits the depression.
For shading the water object, we use a more complex material that is composed of several shaders to mimic the color, reflection, wave and ripple characteristics of the actual water surface. This time we use the Node editor
to create the material.
- Go to
Properties tab
>Material
> press+ New
button to create a new Material. Rename the Material to Water. - In the Node editor, bottom header use
Add
menu to add the following nodes:-
Add
>Shader
>Transparent BSFD
to create the surface transparency. -
Add
>Shader
>Glossy BSDF
to create the surface reflection. Set theRoughness
to 0.05 Select a pale blue for the color to represent the water color. -
Add
>Texture
>Wave BSDF
to create the waves. SetScale
to 100 anddistortion
to 0 -
Add
>Texture
>Noise BSDF
to create the ripple. SetScale
to 300 anddistortion
to 4.50 -
Add
>Convertor
>Math
to exaggerate the wave effect. Select Multiply with value of 5. -
Add
>Convertor
>Math
to exaggerate the ripple effect . Select Multiply with value of 2. -
Add
>Shader
>Mix
to combine the surface properties (glossiness and transparency). Set theFac
to 0.55 -
Add
>Color
>MixRGB
to combine the displacement properties (wave and ripple). Set theFac
to 0.5
-
- Now arrange and link the editors to acquire a node network similar to that of the figure below.
- Navigate the 3D viewport to a location close to the water and change the viewport shading mode to Render to see how the water is rendered (it should look similar to the figure below).
- Save the file.
Node network of Water material
I this step, we distribute 3 types of species on the terrain, namely, American Linden, Weeping Willow, and Staghorn (shrubs). We use Xfrog tree models that are models are included in the sample_data folder as separate directories consisting of an object file (.obj), a material file (.mtl), and textures for barks and leaves. The distribution pattern (or the location of patches) of each specie is derived from GIS as a texture map (.png). Using these data we model vegetation in the following two steps.
-
Importing and shading a single model of each specie.
-
Spreading the species on the terrain based on the distribution textures.
- Linden tree object is /sample_data/EA19_American_Linden/EA15.obj and the corresponding pattern is /sample_data/patch_class1.png
- Willow tree object is /sample_data/BL15_Weeping_Willow/BL15.obj and the corresponding pattern is /sample_data/patch_class2.png
- Staghorn shrubs object is /sample_data/SH06_Spindle/SH06_3.obj and the corresponding pattern is /sample_data/patch_class3.png
Distribution textures (top) and corresponding species (bottom). From left to right American Linden, Weeping Willow, and Staghorn.
- Open Blender and delete the default cube object.
- Change the render engine to
Cycles Render
. - From
File
>import
> selectWavefront(.obj)
> browse to sample_data/EA19_American_Linden folder and select EA19m.obj > press enter. The tree object should appear in the 3D view. - You can see that the tree object is 90 degrees rotated. To rotate it back into the vertical position:
- Right-click on the object to select and activate it.
- Go to
Properties
editor >Object
(the cube icon) > in theTransform
panelRotation
section, setX
parameter to 0 .
Notice that while the leaves have material assigned to them but they are shown as rectangular surfaces with a black silhouette. To show the leaves properly we create a Mix Shader composed of a Transparent BSDF and a Diffuse BSDF. In this way we assign the transparent Black areas in the leaf image as transparent leaving the actual leaves as opaque. This technique is called Alpha mapping which is a computationally cheap way to create realistic trees without modeling the complex leaf geometry. The animation below shows how to create the material in Properties
editor.
Tree leaves before (left) and after (right) alpha mapping
- Change viewport display mode to
Material
. - Go to
Properties tab
>Material
and select Leaf. - Click on the
X
button to vacate the material slot.Note
: If you click on-
button you will lose the material slot that has been assigned to leaf objects. - Press
+ New
button to create a new Material. Rename the Material to Leaf. - To create the Mix Shader:
- From the
Surface
panel, Surface drop down select Mix Shader - Click on the radio button in the
Fac
parameter to open a drop-down. From the second column, select Image Texture. - Click on
Open
and navigate to the folder sample_data/EA19_American_Linden > Select EA19lef.tif .
- From the
- To create the Transparent Shader:
- From the Second
Shader
drop down select Transparent BSDF
- From the Second
- To create the Diffuse Shader:
- From the first
Shader
drop down select Diffuse BSDF. - Click on the radio button in the
Color
parameter to open a drop-down. From the second column, select Image Texture. - Click on
Open
and navigate to the folder sample_data/EA19_American_Linden > Select EA10lef.tif .
- From the first
- To adjust the alpha display parameters:
- Go to
Settings
section and decrease theAlpha
parameter inViewport Color
to 0.00.
- Go to
- Select
Viewport Shading
toRender
to see the tree object rendered. - Assign one of the viewports to
Node Editor
to explore the material node structure. - Repeat the steps a and b to import and prepare Willow and Staghorn models.
- Save the Blender file and name it tree.Blend
Alpha mapping procedure
Node editor view of the tree material
In this step, we use Particle Systems Modifier
to populate trees on the terrain. We use texture files that are exported from Grass GIS to delineate the location of different vegetation species class. First, we bring in the trees we created in the previous step to our landscape Blender file. To do so we append
the trees to a separate layer.
- Open landscape_example.blend
- From 3D view bottom header
Layer selector
> select the second slot located on the right side of the active layer. If you have a full keyboard, you can also toggle between layers using keyboard numbers.
- Go to
File
>Append
> browse and find EA_19.blend > go to Objects folder and select EA19m. The tree should be now appended and visible in the scene and outliner. - Now go back to layer 1 (using bottom header or keyboard number 1) and select the terrain object.
- Select Wireframe viewport shading mode.
- Go to
Properties editor
>Modifiers tab
>Add modifier
>Particle_system
. - Type Class1 in front of the
Settings
parameter to change the setting name. - Click on the far left icon in front of the Modifier to expand and view the settings.
- Adjust the following particle settings parameters:
-
Emission
section:- Set
Emission
number to 450. This is the total number of particles that will be populated on the terrain object. - Uncheck
Even distribution
.
- Set
-
Rotation
section:- Activate
Rotation
. - Set
Initial Rotation
to ObjectY
- Activate
-
Physics
section:- Select the None option
-
Render
section:- Activate the Object option.
- Select EA19m for the
Dupli Object
parameter. - Set the
Size
to 1.20 and theRandom Size
to 0.20.
-
Textures
section:- Press on the
+
button to make a new texture. - Rename the texture to Texture1.
- Press the
button to adjust the texture parameters in
Textures
tab.
- Press on the
-
- Now you are automatically routed to the Texture tab.
-
In the image section:
- Click on
Open
and browse to select sample_data/patch_class1.png . You should be able to see the Trees planted according to the texture pattern.
Particle modifier settings (left) and particle texture settings (right)
Plan view of the Linden trees distributed based on the texture
- Click on
-
Instead of making new particle systems for each specie or texture, we can create a copy of an existing particle settings and just switch the emission object and texture.
- To make a copy of the particle system from the Linden tree for the Willows:
- Select terrain object.
- Add a new particle system
- Click on the dropdown menu in front of the
Settings
and select Class1. - You will see that a new icon with number 2 appears, indicating that currently two particle systems are using this settings. Click on 2 to make it a unique setting and name it Class2.
- To replace the texture image:
- Now go to the textures settings and replace the texture image with patch_class2.png found in the sample_data folder
- To replace the tree with the shrub:
- Go to
Render
section > replace the object with BL_15
- Go to
- Change the
Emission
number to 1000 so that the shrubs are distributed more densely. - Clone another particle system to populate the Staghorn shrubs. Use patch_class3.png for the texture and SH06_3 as the emission object. Set the emission number to 300.
Plan view of the Linden trees distributed based on the texture
Viewport rendering of select perspectives views with 32 light sample/s