Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:36:18+00:00 2026-05-15T11:36:18+00:00

I’m looking at creating map tiles based on a 3D model made in blender,

  • 0

I’m looking at creating map tiles based on a 3D model made in blender,

The map is 16 x 16 in blender.

I’ve got 4 different zoom levels and each tile is 100 x 100 pixels. The entire map at the most zoomed out level is 4 x 4 tiles constructing an image of 400 x 400.

The most zoomed in level is 256 x 256 obviously constructing an image of 25600 x 25600

What I need is a script for blender that can create the tiles from the model.

I’ve never written in python before so I’ve been trying to adapt a couple of the scripts which are already there.

So far I’ve come up with a script, but it doesn’t work very well. I’m having real difficulties getting the tiles to line up seamlessly. I’m not too concerned about changing the height of the camera as I can always create the same zoomed out tiles at 6400 x 6400 images and split the resulting images into the correct tiles.

Here is what I’ve got so far…

#!BPY

"""
Name: 'Export Map Tiles'
Blender: '242'
Group: 'Export'
Tip: 'Export to Map'
"""

import Blender
from Blender import Scene,sys
from Blender.Scene import Render

def init():
        thumbsize = 200
        CameraHeight = 4.4
        YStart = -8
        YMove = 4
        XStart = -8
        XMove = 4
        ZoomLevel = 1
        Path = "/Images/Map/"
        Blender.drawmap = [thumbsize,CameraHeight,YStart,YMove,XStart,XMove,ZoomLevel,Path]


def show_prefs():
        buttonthumbsize = Blender.Draw.Create(Blender.drawmap[0]);
        buttonCameraHeight = Blender.Draw.Create(Blender.drawmap[1])
        buttonYStart = Blender.Draw.Create(Blender.drawmap[2])
        buttonYMove = Blender.Draw.Create(Blender.drawmap[3])
        buttonXStart = Blender.Draw.Create(Blender.drawmap[4])
        buttonXMove = Blender.Draw.Create(Blender.drawmap[5])
        buttonZoomLevel = Blender.Draw.Create(Blender.drawmap[6])
        buttonPath = Blender.Draw.Create(Blender.drawmap[7])

    block = []
    block.append(("Image Size", buttonthumbsize, 0, 500))
    block.append(("Camera Height", buttonCameraHeight, -0, 10))
    block.append(("Y Start", buttonYStart, -10, 10))
    block.append(("Y Move", buttonYMove, 0, 5))
    block.append(("X Start", buttonXStart,-10, 10))
    block.append(("X Move", buttonXMove, 0, 5))
    block.append(("Zoom Level", buttonZoomLevel, 1, 10))
    block.append(("Export Path", buttonPath,0,200,"The Path to save the tiles"))

    retval = Blender.Draw.PupBlock("Draw Map: Preferences" , block)

    if retval:
        Blender.drawmap[0] = buttonthumbsize.val
        Blender.drawmap[1] = buttonCameraHeight.val
        Blender.drawmap[2] = buttonYStart.val
        Blender.drawmap[3] = buttonYMove.val
        Blender.drawmap[4] = buttonXStart.val
        Blender.drawmap[5] = buttonXMove.val
        Blender.drawmap[6] = buttonZoomLevel.val
        Blender.drawmap[7] = buttonPath.val
        Export()

def Export():
    scn = Scene.GetCurrent()
    context = scn.getRenderingContext()

    def cutStr(str): #cut off path leaving name
        c = str.find("\\")
        while c != -1:
            c = c + 1
            str = str[c:]
            c = str.find("\\")

        str = str[:-6]
        return str

    #variables from gui:
    thumbsize,CameraHeight,YStart,YMove,XStart,XMove,ZoomLevel,Path = Blender.drawmap


    XMove = XMove / ZoomLevel
    YMove = YMove / ZoomLevel
    Camera = Scene.GetCurrent().getCurrentCamera()
    Camera.LocZ = CameraHeight / ZoomLevel
    YStart = YStart + (YMove / 2)
    XStart = XStart + (XMove / 2)

    #Point it straight down
    Camera.RotX = 0
    Camera.RotY = 0
    Camera.RotZ = 0
    TileCount = 4**ZoomLevel
    #Because the first thing we do is move the camera, start it off the map
    Camera.LocY = YStart - YMove
    for i in range(0,TileCount):
        Camera.LocY = Camera.LocY + YMove
        Camera.LocX = XStart - XMove
        for j in range(0,TileCount):
            Camera.LocX = Camera.LocX + XMove
            Render.EnableDispWin()
            context.extensions = True
            context.renderPath = Path

            #setting thumbsize
            context.imageSizeX(thumbsize)
            context.imageSizeY(thumbsize)

            #could be put into a gui.
            context.imageType = Render.PNG
            context.enableOversampling(0)

            #render
            context.render()

            #save image
            ZasString = '%s' %(int(ZoomLevel))
            XasString = '%s' %(int(j+1))
            YasString = '%s' %(int((3-i)+1))
            context.saveRenderedImage("Z" + ZasString + "X" + XasString + "Y" + YasString)

            #close the windows

            Render.CloseRenderWindow()

try:
        type(Blender.drawmap)
except:
        #print 'initialize extern variables'
        init()
show_prefs()    
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:36:19+00:00Added an answer on May 15, 2026 at 11:36 am

    This was relatively simple in the end.

    I scaled up the model so that 1 tile on the map was 1 grid in blender.

    Set the camera to be orthographic.

    Set the scale on the camera to 1 for the highest zoom, 4 for the next one, 16 for the next one and so on.

    Updated the start coordinates and move values accordingly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.