Tutorial: Generating Fantasy Maps from Sketches
In this tutorial, we'll use Krita and Krita AI Diffusion to convert a rough sketch of an RPG map into something a little easier on the eyes that we wouldn't mind bringing to the table.
Installation of Krita and the diffusion plugin are beyond the scope of this tutorial.
Basic Setup
Open Krita and create a new 1024x1024 image and select
Digital Artwork (XL)
for the model.
The Sketch
First, create a crude sketch of your map. Include any details you can manage, but it doesn't need to be very detailed, or even good - the broad strokes are what is important.
Here, I've drawn a castle town on a lake, with neighboring farmland; the plains are divided from the forest by a river, feeding the lake.
The Main Prompt
The main prompt is going to control the artistic style that the map is drawn in: the color palette, whether it's a 3d isometric or parchment map, etc. However, the prompt shouldn't include any of the details about what is actually drawn on it, those details will be specified in the region prompts.
My main prompt is simply: a hand drawn medieval map
.
Control Layer
Your sketch will help to control layout and composition of the map and constrain how the subjects of the map are laid out.
Click the Add Control Layer
button
and select the layer containing your sketch from the dropdown. Leave
the
control strength
slider set to its default, in the middle.
The layer currently selected in the
Layers
pane is automatically populated into the control layer drop down when adding a new control layer.
Region Prompts
Regions will describe the details of the map that were intentionally left out of the main prompt. Each region will have a prompt tied to a group layer, which will act as a mask that controls which pixels are directly affected by its prompt.
Select the Background
layer and click the Add Region
button
to create the background region and link it
to the
Background
layer. This layer can be used to fill in background
details, not covered by other regions, but we will construct the other
regions to cover the rest of the map, so we will leave the prompt and
layer empty.
Then, for each geographical region on the map, add another region. New group layers with a single drawing layer are created each time. For each, describe the region in the prompt and color the part of the map for that region. Be sure that the correct layer for the region is selected when creating the mask.
Any color will do, since any non-transparent part of the layer will serve as a mask to indicate which pixels are affected by the region's prompt. I tend to use a color representative of the content I want to generate and distinct from the other regions, so that the layer boundaries can be seen easily.
town region | all regions |
---|---|
![]() |
![]() |
The prompts for the regions in my map are:
color | region prompt |
---|---|
gray | medieval castle surrounded by houses |
brown | ploughed farm fields |
blue | lake and river |
green | pine forest |
yellow | grassy plains |
Generate
Now, hit Generate
and start iterating and tweaking.
Varying Styles
Below, you can see the results for different primary prompts that change the style of the map; all of the region layers were the same for all generations.
prompt | ||||
---|---|---|---|---|
a hand drawn medieval map | ![]() |
![]() |
![]() |
![]() |
a top down overworld rpg map | ![]() |
![]() |
![]() |
![]() |
a black and white ink-drawn top down overworld rpg map | ![]() |
![]() |
![]() |
![]() |
a neon pixelated top down overworld rpg map | ![]() |
![]() |
![]() |
![]() |
a rough parchment map drawn in pencil, treasure map | ![]() |
![]() |
![]() |
![]() |
Impact of Control Layer and Regions
To see how the sketch and regions impact the composition of the map,
here is a comparison of maps all generated with the prompt
a hand drawn medieval map
.
with sketch and regions | ![]() |
![]() |
![]() |
![]() |
without sketch | ![]() |
![]() |
![]() |
![]() |
without regions | ![]() |
![]() |
![]() |
![]() |
The regions are doing a lot of the heavy lifting here for the placement of map contents, but they seem to also be washing out the style. The sketch, too, has pros and cons: it seems to prevent too much improvisation from occurring, especially with the lake and river, but it's also preventing the fields from being drawn in a more natural style.
Other Observations and Thoughts
- The houses are often subsumed into the castle in the town region; it might need to be split into two separate regions: one for the castle and one for the houses.
- Many generations looked more like pictures of a landscape than maps, some even including the horizon and sky in the far distance. Adjustments to the main prompt to reinforce the style with additional keywords, weights and negative prompts might be able to compensate.