Add different capture areas

- "Full" map capture is now "extended" map capture
- Made coordinates align with in-game chunks
- Add images for different capture modes
- Update README.md
- Add AREAS.md
This commit is contained in:
David Vogel 2020-10-20 15:29:28 +02:00
parent 0aa2a0f724
commit 6a9c32cd99
12 changed files with 237 additions and 20 deletions

5
.gitignore vendored
View File

@ -104,5 +104,6 @@ $RECYCLE.BIN/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option) # Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
/libs/ /libs/
output/ /output/
/distribution /distribution/
/bin/stitch/output.png

66
AREAS.md Normal file
View File

@ -0,0 +1,66 @@
# Capture areas
A list of available capture areas.
Coordinates are in in-game "virtual" pixels.
`Right` and `Bottom` coordinates are not included in the rectangle.
The dimensions of the capture rectangle are exactly:
``` lua
Width = Right - Left
Height = Bottom - Top
```
Depending on the virtual resolution you use, the resulting capture may be a bit larger.
If you need the output to have exact dimensions, supply your needed coordinates to the stitcher tool.
Coordinate system:
![Coordinate system](images/coordinates.png)
## `Base layout`
This area features only the "base layout".
Everything around this area uses a similar layout, but with different materials and a different seed.
``` lua
Left = -17920
Top = -7168
Right = 17920
Bottom = 17408
```
The end result will have a size of `35840 x 24576 pixels ~= 880 megapixels`.
![Base layout](images/scale32_base-layout.png)
## `Main world`
This area features only the "base layout" plus the area above (sky) and below (hell).
It totals to a height of exactly 3 times the base layout's height.
``` lua
Left = -17920
Top = -31744
Right = 17920
Bottom = 41984
```
The end result will have a size of `35840 x 73728 pixels ~= 2642 megapixels`.
![Base layout](images/scale32_main-world.png)
## `Extended`
This area consists of `Main world` plus fractions of the left and right parallel worlds.
``` lua
Left = -25600
Top = -31744
Right = 25600
Bottom = 41984
```
The end result will have a size of `51200 x 73728 pixels ~= 3775 megapixels`.
![Base layout](images/scale32_extended.png)

View File

@ -2,7 +2,7 @@
Addon that captures a Noita world and saves it as image. Addon that captures a Noita world and saves it as image.
![missing image](images/example1.png) ![missing image](images/example2.png)
A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom.com/image/223556) (Warning: Spoilers). A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom.com/image/223556) (Warning: Spoilers).
@ -14,7 +14,7 @@ A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom
- A processor. - A processor.
- Optionally a monitor, keyboard and mouse to interact with the mod/software. - Optionally a monitor, keyboard and mouse to interact with the mod/software.
- A sound card to listen to music while it's grabbing screenshots. - A sound card to listen to music while it's grabbing screenshots.
Capturing and stitching will take about 180 minutes (160 + 20). Capturing and stitching the "extended" map will take about 180 minutes (160 + 20).
## Usage ## Usage
@ -25,7 +25,7 @@ A resulting image with nearly 3.8 gigapixels can be [seen here](https://easyzoom
5. Enable the mod and restart Noita. 5. Enable the mod and restart Noita.
6. In the game you should see text on screen. 6. In the game you should see text on screen.
- Either press `>> Start capturing map around view <<` to capture in a spiral around your current view. - Either press `>> Start capturing map around view <<` to capture in a spiral around your current view.
- Or press `>> Start capturing full map <<` to capture the whole map. - Or press any other option to capture [specific areas](AREAS.md).
7. The screen will jump around, and the game will take screenshots automatically. 7. The screen will jump around, and the game will take screenshots automatically.
- Screenshots are saved in `.../Noita/mods/noita-mapcap/output/`. - Screenshots are saved in `.../Noita/mods/noita-mapcap/output/`.
- Don't move the game window outside of screen space. You can cover it with other windows, and continue using your PC. - Don't move the game window outside of screen space. You can cover it with other windows, and continue using your PC.
@ -82,7 +82,7 @@ Here is a step by step explanation how to do so:
6. When the game is loaded (When you can control your character): 6. When the game is loaded (When you can control your character):
- Press `F5`, `F8` and `F12` (In that order). - Press `F5`, `F8` and `F12` (In that order).
7. Press the `>> Start capturing full map <<` button. 7. Press the `>> Start capturing extended map <<` button.
8. Wait a few hours until it's complete. 8. Wait a few hours until it's complete.
@ -104,7 +104,7 @@ The following two equations have to be true:
You can also change how much the tiles overlap by adjusting the `CAPTURE_GRID_SIZE` in `.../Noita/mods/noita-mapcap/files/capture.lua`. If you increase the grid size, you can capture more area per time. But on the other hand the stitcher may not be able to remove artifacts if the tiles don't overlap enough. You can also change how much the tiles overlap by adjusting the `CAPTURE_GRID_SIZE` in `.../Noita/mods/noita-mapcap/files/capture.lua`. If you increase the grid size, you can capture more area per time. But on the other hand the stitcher may not be able to remove artifacts if the tiles don't overlap enough.
The rectangle for the full map capture mode is defined in `.../Noita/mods/noita-mapcap/files/capture.lua`. The rectangles for the different capture modes are defined in `.../Noita/mods/noita-mapcap/files/capture.lua`.
## License ## License

View File

@ -7,10 +7,29 @@ CAPTURE_PIXEL_SIZE = 1 -- Screen to virtual pixel ratio
CAPTURE_GRID_SIZE = 512 -- in ingame pixels. There will always be exactly 4 images overlapping if the virtual resolution is 1024x1024 CAPTURE_GRID_SIZE = 512 -- in ingame pixels. There will always be exactly 4 images overlapping if the virtual resolution is 1024x1024
CAPTURE_FORCE_HP = 4 -- * 25HP CAPTURE_FORCE_HP = 4 -- * 25HP
CAPTURE_LEFT = -25000 -- in ingame pixels. Left edge of the full map capture rectangle -- "Base layout" (Base layout. Every part outside this is based on a similar layout, but uses different materials/seeds)
CAPTURE_TOP = -36000 -- in ingame pixels. Top edge of the full map capture rectangle CAPTURE_AREA_BASE_LAYOUT = {
CAPTURE_RIGHT = 25000 -- in ingame pixels. Right edge of the full map capture rectangle (Pixels are not included in the rectangle) Left = -17920, -- in ingame pixels.
CAPTURE_BOTTOM = 36000 -- in ingame pixels. Bottom edge of the full map capture rectangle (Pixels are not included in the rectangle) Top = -7168, -- in ingame pixels.
Right = 17920, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 17408 -- in ingame pixels. (Coordinate is not included in the rectangle)
}
-- "Main world" (The main world with 3 parts: sky, normal and hell)
CAPTURE_AREA_MAIN_WORLD = {
Left = -17920, -- in ingame pixels.
Top = -31744, -- in ingame pixels.
Right = 17920, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 41984 -- in ingame pixels. (Coordinate is not included in the rectangle)
}
-- "Extended" (Main world + a fraction of the parallel worlds to the left and right)
CAPTURE_AREA_EXTENDED = {
Left = -25600, -- in ingame pixels.
Top = -31744, -- in ingame pixels.
Right = 25600, -- in ingame pixels. (Coordinate is not included in the rectangle)
Bottom = 41984 -- in ingame pixels. (Coordinate is not included in the rectangle)
}
local function preparePlayer() local function preparePlayer()
local playerEntity = getPlayer() local playerEntity = getPlayer()
@ -117,7 +136,7 @@ function startCapturingSpiral()
) )
end end
function startCapturingHilbert() function startCapturingHilbert(area)
local ox, oy = GameGetCameraPos() local ox, oy = GameGetCameraPos()
local virtualWidth, virtualHeight = local virtualWidth, virtualHeight =
@ -127,10 +146,18 @@ function startCapturingHilbert()
local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2) local virtualHalfWidth, virtualHalfHeight = math.floor(virtualWidth / 2), math.floor(virtualHeight / 2)
-- Get size of the rectangle in grid/chunk coordinates -- Get size of the rectangle in grid/chunk coordinates
local gridLeft = math.floor(CAPTURE_LEFT / CAPTURE_GRID_SIZE) local gridLeft = math.floor(area.Left / CAPTURE_GRID_SIZE)
local gridTop = math.floor(CAPTURE_TOP / CAPTURE_GRID_SIZE) local gridTop = math.floor(area.Top / CAPTURE_GRID_SIZE)
local gridRight = math.ceil(CAPTURE_RIGHT / CAPTURE_GRID_SIZE) + 1 local gridRight = math.ceil(area.Right / CAPTURE_GRID_SIZE) -- This grid coordinate is not included
local gridBottom = math.ceil(CAPTURE_BOTTOM / CAPTURE_GRID_SIZE) + 1 local gridBottom = math.ceil(area.Bottom / CAPTURE_GRID_SIZE) -- This grid coordinate is not included
-- Edge case
if area.Left == area.Right then
gridRight = gridLeft
end
if area.Top == area.Bottom then
gridBottom = gridTop
end
-- Size of the grid in chunks -- Size of the grid in chunks
local gridWidth = gridRight - gridLeft local gridWidth = gridRight - gridLeft

View File

@ -11,7 +11,7 @@ function DrawUI()
if modGUI ~= nil then if modGUI ~= nil then
GuiStartFrame(modGUI) GuiStartFrame(modGUI)
GuiLayoutBeginVertical(modGUI, 50, 50) GuiLayoutBeginVertical(modGUI, 50, 20)
if not UiProgress then if not UiProgress then
-- Show informations -- Show informations
local problem local problem
@ -108,9 +108,18 @@ function DrawUI()
UiProgress = {} UiProgress = {}
startCapturingSpiral() startCapturingSpiral()
end end
if GuiButton(modGUI, 0, 0, ">> Start capturing full map <<", 1) then GuiTextCentered(modGUI, 0, 0, " ")
if GuiButton(modGUI, 0, 0, ">> Start capturing base layout <<", 1) then
UiProgress = {} UiProgress = {}
startCapturingHilbert() startCapturingHilbert(CAPTURE_AREA_BASE_LAYOUT)
end
if GuiButton(modGUI, 0, 0, ">> Start capturing main world <<", 1) then
UiProgress = {}
startCapturingHilbert(CAPTURE_AREA_MAIN_WORLD)
end
if GuiButton(modGUI, 0, 0, ">> Start capturing extended map <<", 1) then
UiProgress = {}
startCapturingHilbert(CAPTURE_AREA_EXTENDED)
end end
GuiTextCentered(modGUI, 0, 0, " ") GuiTextCentered(modGUI, 0, 0, " ")
elseif not UiProgress.Done then elseif not UiProgress.Done then

113
images/coordinates.pdn Normal file

File diff suppressed because one or more lines are too long

BIN
images/coordinates.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
images/example2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 283 KiB

BIN
images/scale32_extended.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 796 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

View File

@ -3,7 +3,8 @@ rd distribution /s/q
mkdir distribution mkdir distribution
mkdir distribution/noita-mapcap mkdir distribution/noita-mapcap
robocopy "." "distribution/noita-mapcap/" init.lua LICENSE compatibility.xml mod.xml README.md robocopy "." "distribution/noita-mapcap/" init.lua LICENSE compatibility.xml mod.xml README.md AREAS.md
robocopy "images/" "distribution/noita-mapcap/images/" coordinates.png example1.png example2.png scale32_base-layout.png scale32_main-world.png scale32_extended.png
robocopy "data" "distribution/noita-mapcap/data" /e robocopy "data" "distribution/noita-mapcap/data" /e
robocopy "files" "distribution/noita-mapcap/files" /e robocopy "files" "distribution/noita-mapcap/files" /e