Animate Map with Blender: Difference between revisions

From wikiluntti
Line 2: Line 2:


== Get and edit the data ==
== Get and edit the data ==
<youtube>Lgc4YXRElh8</youtube>
=== Download Data ===
=== Download Data ===



Revision as of 19:13, 3 June 2024

Introduction

Get and edit the data

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

Superpose the images and crop to correct size.

Blender

  • 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.