Animate Map with Blender: Difference between revisions

From wikiluntti
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


== Download Data ==
== Get the data and edit it ==


<youtube>Lgc4YXRElh8</youtube>
=== Download Data ===
Download data from https://www.maanmittauslaitos.fi/ . The Licence is Maanmittauslaitoksen avoimien aineistojen CC 4.0 -lisenssi. There can be found
Download data from https://www.maanmittauslaitos.fi/ . The Licence is Maanmittauslaitoksen avoimien aineistojen CC 4.0 -lisenssi. There can be found
* Map
* Map
Line 8: Line 11:
* Height model
* Height model


== GIMP: Make a larger image ==
=== GIMP: Make a larger image ===
 
Change the Canvas size of each three downloaded image
Change the Canvas size of each three downloaded image
* Image → Canvas Size. Height to 2x.  
* Image → Canvas Size. Height to 2x.  
Superpose the images: make it larger.
Superpose the images: make it larger.


== Python: Adjust the scale of the 3d map ==
=== Python: Adjust the scale of the 3d map ===
 
Load the image, concatenate and scale it. Then save. <syntaxhighlight lang="python3">
Load the image, concatenate and scale it. Then save. <syntaxhighlight lang="python3">
import rasterio
import rasterio
Line 41: Line 44:
</syntaxhighlight>Easy, fast.
</syntaxhighlight>Easy, fast.


== GIMP ==
=== GIMP: Crop the data ===
Superpose the images and crop to correct size.


Superpose the images and crop to correct size.
== Blender: Make the animation ==


== Blender ==
<youtube>RMX4xWUAAk4</youtube>


* Add (the earth) plane
* Add (the earth) plane

Latest revision as of 19:18, 3 June 2024

Introduction

Get the data and edit it

Download Data

Download data from https://www.maanmittauslaitos.fi/ . The Licence is Maanmittauslaitoksen avoimien aineistojen CC 4.0 -lisenssi. There can be found

  • Map
  • Air photos
  • Height model

GIMP: Make a larger image

Change the Canvas size of each three downloaded image

  • Image → Canvas Size. Height to 2x.

Superpose the images: make it larger.

Python: Adjust the scale of the 3d map

Load the image, concatenate and scale it. Then save.

import rasterio
import numpy as np
from PIL import Image

names = ['Q4121F.tif', 'Q4122E.tif']

imgs = []
for n in names:
    imgs.append(rasterio.open(n))

image = imgs[0].read(1)   
print( np.shape(image) )
for img in imgs[1:]:
    tmp = img.read(1)     
    image = np.concatenate( (tmp, image  ), 0)

print( np.shape(image) )
print( image.max() )
print( image.min() )
image = 256*(image-image.min())/(image.max()-image.min())
im = Image.fromarray( image )
im = im.convert("L")
im.save( "heightModel1.png" )

Easy, fast.

GIMP: Crop the data

Superpose the images and crop to correct size.

Blender: Make the animation

  • Add (the earth) plane
  • Change the size
  • Image Texture
  • Add some light to the World
  • Make 3d plane (earth)
    • Modifier → Displacement
    • Texture → heightmodel.png
    • Edit mode → subdivide
    • Object → Shade smooth
    • Modifier → Subdivide
  • Render F12
  • Make the Glass cube
    • Move, rotate, scale. Use N
    • Modifier → Bevel
    • Material → Glass BSDF. Roughness
  • Render Engine → Cycles
  • Add → Sun
  • Make the animation
    • Add → Path
    • Edit mode: E extrude uudet pisteet
    • Move the camera
    • Add object constraint: Follow Path. Offset. I
  • Turn the camera
    • Add → Empty Cube: Camera Follow Spot
    • Add Object Constraint: Tracking, Track To
    • Animation & Graph Editor
  • Make the smoke
    • Shift D Duplikoi. Skaalaa, siirrä
    • Object → Quick effect → Smoke
    • Cube Glass Smoke → Uncheck Flow
    • Smoke Domain → Buoyancy density
  • Animate
  • Add → Light → Spot. Power 5000 W
  • The Fog
    • Add → Mesh → Cube
    • Material → Surface → Disconnect
    • Volume → Scatter. Density 0.002
  • Mix the map and photo
    • Shader Editor. Mix & Factor.