Skip to content

Commit

Permalink
Update for Fortnite v14.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nevecex committed Sep 9, 2020
1 parent 10a9cb7 commit 8c0d610
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 148 deletions.
Binary file modified apollo/fortnite_apollo_height_l16_lod0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apollo/fortnite_apollo_height_l16_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apollo/fortnite_apollo_normal_rg8_lod0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apollo/fortnite_apollo_normal_rg8_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
217 changes: 69 additions & 148 deletions fortnite-tga-slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
sys.exit('unknown map identifier \'' + mapIdentifier + '\'')

if mapIdentifier == 'apollo':
numTiles = 361
numTiles = 256
elif mapIdentifier == 'papaya':
numTiles = 64

Expand Down Expand Up @@ -57,7 +57,7 @@
# tile_offset = int({ 0: 0, 1: 512 * 512 * 4 * (1.0), 2: 512 * 512 * 4 * (1.0 + 0.25)}[lod])

if mapIdentifier == 'apollo':
tile_scale = 19;
tile_scale = 16;
elif mapIdentifier == 'papaya':
tile_scale = 8;

Expand Down Expand Up @@ -93,11 +93,7 @@ def extract_tiles(asset_path, offsets, height_target, normal_target, texture_key
channel_r = numpy.asarray(tile_b).flatten()
channel_g = numpy.asarray(tile_a).flatten()

# since lobby texture is 512*512
if texture_key == 'LOBBY':
channel_b = numpy.resize(numpy.uint8(), int(512 * 512));
else:
channel_b = numpy.resize(numpy.uint8(), tile_size);
channel_b = numpy.resize(numpy.uint8(), tile_size);
channel_b.fill(255)

rgb = numpy.dstack((channel_r, channel_g, channel_b)).flatten()
Expand All @@ -112,15 +108,9 @@ def extract_tiles(asset_path, offsets, height_target, normal_target, texture_key
target_x = offset[0] * (tile_width - 1)
target_y = offset[1] * (tile_height - 1)

# since lobby texture is 512*512
if texture_key == 'LOBBY':
tile_width = { 0: 512 }[lod]; tile_height = { 0: 512 }[lod];
normal_tile = Image.frombytes('RGB', (tile_width, tile_height), rgb).crop((0, 0, 320, 320));
height_tile = Image.frombytes('I;16', (tile_width, tile_height), numpy.asarray(channel_l, order = 'C')).crop((0, 0, 320, 320));
else:
tile_width = { 0: 128 }[lod]; tile_height = { 0: 128 }[lod];
normal_tile = Image.frombytes('RGB', (tile_width, tile_height), rgb);
height_tile = Image.frombytes('I;16', (tile_width, tile_height), numpy.asarray(channel_l, order = 'C'));
tile_width = { 0: 128 }[lod]; tile_height = { 0: 128 }[lod];
normal_tile = Image.frombytes('RGB', (tile_width, tile_height), rgb);
height_tile = Image.frombytes('I;16', (tile_width, tile_height), numpy.asarray(channel_l, order = 'C'));

# ordered_index = y * 10 + x

Expand Down Expand Up @@ -154,137 +144,68 @@ def extract_tiles(asset_path, offsets, height_target, normal_target, texture_key
height_composite = Image.new("I", (tile_width * tile_scale, tile_height * tile_scale), (26050))


apollo_indices = {

'AB12': {

0: (16, 6), 8: (12, 4), 10: (13, 4), 16: (12, 5), 18: (13, 5), 26: (13, 6),
28: (14, 6), 30: (15, 6), 120: (12, 6),

},

'AB34': {

0: (8, 3), 2: (9, 3), 4: (10, 3), 6: (11, 3), 8: (8, 4), 10: (9, 4), 12: (10, 4),
14: (11, 4), 16: (8, 5), 18: (9, 5), 20: (10, 5), 22: (11, 5), 24: (8, 6),
26: (9, 6), 28: (10, 6), 142: (11, 6),

},

'AB56': {

30: (7, 6), 28: (6, 6), 26: (5, 6), 24: (4, 6), 22: (7, 5), 20: (6, 5), 28: (6, 6),
2: (5, 3), 18: (5, 5), 16: (4, 5), 14: (7, 4), 12: (6, 4), 10: (5, 4), 6: (7, 3),
4: (6, 3),

},

'AB78': {

20: (2, 5), 30: (3, 6), 28: (2, 6), 26: (1, 6), 22: (3, 5),

},

'CD12': {

24: (12, 10), 22: (15, 9), 20: (14, 9), 2: (13, 7), 18: (13, 9), 16: (12, 9),
14: (15, 8), 123: (12, 7), 12: (14, 8), 10: (13, 8), 8: (12, 8), 6: (15, 7),
4: (14, 7), 30: (15, 10), 28: (14, 10), 24: (12, 10), 26: (13, 10),

},

'CD34': {

8: (8, 8), 4: (10, 7), 30: (11, 10), 28: (10, 10), 26: (9, 10), 24: (8, 10),
22: (11, 9), 20: (10, 9), 2: (9, 7), 18: (9, 9), 16: (8, 9), 14: (11, 8),
131: (11, 7), 12: (10, 8), 10: (9, 8), 0: (8, 7),

},

'CD56': {

12: (6, 8), 10: (5, 8), 0: (4, 7), 8: (4, 8), 6: (7, 7), 4: (6, 7), 30: (7, 10),
28: (6, 10), 26: (5, 10), 24: (4, 10), 22: (7, 9), 20: (6, 9), 2: (5, 7),
18: (5, 9), 16: (4, 9), 14: (7, 8),

},

'CD78': {

4: (2, 7), 30: (3, 10), 28: (2, 10), 26: (1, 10), 24: (0, 10), 22: (3, 9),
20: (2, 9), 2: (1, 7), 18: (1, 9), 16: (0, 9), 14: (3, 8), 12: (2, 8),
10: (1, 8), 6: (3, 7),

},

'EF12': {

18: (12, 11), 16: (12, 12), 14: (12, 13), 12: (12, 14), 10: (13, 14), 0: (15, 11),
8: (14, 14), 6: (15, 14), 4: (15, 13), 30: (13, 13), 28: (14, 13), 26: (13, 12),
24: (14, 12), 22: (14, 11), 20: (13, 11),

},

'EF34': {

12: (10, 12), 10: (9, 12), 0: (8, 11), 8: (8, 12), 6: (11, 11), 4: (10, 11), 30: (11, 14),
28: (10, 14), 26: (9, 14), 24: (8, 14), 22: (11, 13), 20: (10, 13), 2: (9, 11),
18: (9, 13), 16: (8, 13), 14: (11, 12),

},

'EF56': {

6: (7, 11), 4: (6, 11), 30: (7, 14), 28: (6, 14), 26: (5, 14), 24: (4, 14), 22: (7, 13),
20: (6, 13), 2: (5, 11), 18: (5, 13), 16: (4, 13), 14: (7, 12), 12: (6, 12), 10: (5, 12),
0: (4, 11), 8: (4, 12),

},

'EF78': {

12: (2, 12), 10: (1, 12), 0: (0, 11), 8: (0, 12), 6: (3, 11), 4: (2, 11), 30: (3, 14),
28: (2, 14), 26: (1, 14), 24: (0, 14), 22: (3, 13), 20: (2, 13), 2: (1, 11), 18: (1, 13),
16: (0, 13), 14: (3, 12),

},

'GH12': {

10: (13, 15), 0: (15, 16), 8: (14, 15), 6: (15, 15), 30: (14, 16), 28: (13, 16),
26: (13, 17), 24: (14, 17), 18: (12, 18), 16: (12, 17), 14: (12, 16), 12: (12, 15),

},

'GH34': {

12: (10, 16), 10: (9, 16), 0: (8, 15), 8: (8, 16), 6: (11, 15), 4: (10, 15),
30: (11, 18), 28: (10, 18), 26: (9, 18), 24: (8, 18), 22: (11, 17), 20: (10, 17),
2: (9, 15), 18: (9, 17), 16: (8, 17), 14: (11, 16),

},

'GH56': {

12: (6, 16), 10: (5, 16), 0: (4, 15), 8: (4, 16), 6: (7, 15), 4: (6, 15),
30: (7, 18), 28: (6, 18), 26: (5, 18), 24: (4, 18), 22: (7, 17), 20: (6, 17),
2: (5, 15), 18: (5, 17), 16: (4, 17), 14: (7, 16),

},

'GH78': {

2: (1, 15), 18: (1, 17), 16: (0, 17), 14: (3, 16), 12: (2, 16), 10: (1, 16),
0: (0, 15), 8: (0, 16), 6: (3, 15), 4: (2, 15), 30: (3, 18), 28: (2, 18),
26: (1, 18), 24: (0, 18), 22: (3, 17), 20: (2, 17),

},

'LOBBY': {

0: (15, 0),

},
apollo_indices = {

'A4': { 0: (8, 0), 10: (9, 0), 5: (8, 1), 15: (9, 1), },
'A3': { 0: (10, 0), 10: (11, 0), 5: (10, 1), 15: (11, 1), },
'A6': { 5: (5, 1), },
'A5': { 5: (6, 1), 15: (7, 1), },
'A2': { 5: (12, 1), 10: (13, 1), },
'B7': { 10: (3, 2), 5: (2, 3), 15: (3, 3), },
'B6': { 0: (4, 2), 10: (5, 2), 5: (4, 3), 15: (5, 3), },
'B5': { 0: (6, 2), 10: (7, 2), 5: (6, 3), 15: (7, 3), },
'B4': { 0: (8, 2), 10: (9, 2), 5: (8, 3), 15: (9, 3), },
'B3': { 0: (10, 2), 10: (11, 2), 5: (10, 3), 15: (11, 3), },
'B2': { 0: (12, 2), 10: (13, 2), 5: (12, 3), 15: (13, 3), },
'B1': { 14: (14, 2), 20: (15, 2), 0: (14, 3), 5: (15, 3), },
'C7': { 0: (2, 4), 10: (3, 4), 5: (2, 5), 15: (3, 5), },
'C6': { 0: (4, 4), 10: (5, 4), 5: (4, 5), 15: (5, 5), },
'C5': { 0: (6, 4), 10: (7, 4), 5: (6, 5), 15: (7, 5), },
'C4': { 0: (8, 4), 10: (9, 4), 5: (8, 5), 15: (9, 5), },
'C3': { 0: (10, 4), 10: (11, 4), 5: (10, 5), 15: (11, 5), },
'C2': { 0: (12, 4), 10: (13, 4), 5: (12, 5), 15: (13, 5), },
'C1': { 0: (14, 4), 10: (15, 4), 5: (14, 5), 15: (15, 5), },
'C8': { 5: (1, 5), },
'D8': { 0: (0, 6), 10: (1, 6), 5: (0, 7), 15: (1, 7), },
'D7': { 0: (2, 6), 10: (3, 6), 5: (2, 7), 15: (3, 7), },
'D6': { 0: (4, 6), 10: (5, 6), 5: (4, 7), 15: (5, 7), },
'D5': { 0: (6, 6), 10: (7, 6), 5: (6, 7), 15: (7, 7), },
'D4': { 0: (8, 6), 10: (9, 6), 5: (8, 7), 15: (9, 7), },
'D3': { 0: (10, 6), 10: (11, 6), 5: (10, 7), 15: (11, 7), },
'D2': { 0: (12, 6), 10: (13, 6), 5: (12, 7), 15: (13, 7), },
'D1': { 0: (14, 6), 10: (15, 6), 5: (14, 7), 15: (15, 7), },
'E8': { 0: (0, 8), 10: (1, 8), 5: (0, 9), 15: (1, 9), },
'E7': { 0: (2, 8), 10: (3, 8), 5: (2, 9), 15: (3, 9), },
'E6': { 0: (4, 8), 10: (5, 8), 5: (4, 9), 15: (5, 9), },
'E5': { 0: (6, 8), 10: (7, 8), 5: (6, 9), 15: (7, 9), },
'E4': { 0: (8, 8), 10: (9, 8), 5: (8, 9), 15: (9, 9), },
'E3': { 0: (10, 8), 10: (11, 8), 5: (10, 9), 15: (11, 9), },
'E2': { 0: (12, 8), 10: (13, 8), 5: (12, 9), 15: (13, 9), },
'E1': { 0: (14, 8), 10: (15, 8), 5: (14, 9), },
'F8': { 0: (0, 10), 10: (1, 10), 5: (0, 11), 15: (1, 11), },
'F7': { 0: (2, 10), 10: (3, 10), 5: (2, 11), 15: (3, 11), },
'F6': { 0: (4, 10), 10: (5, 10), 5: (4, 11), 15: (5, 11), },
'F5': { 0: (6, 10), 10: (7, 10), 5: (6, 11), 15: (7, 11), },
'F4': { 0: (8, 10), 10: (9, 10), 5: (8, 11), 15: (9, 11), },
'F3': { 0: (10, 10), 10: (11, 10), 5: (10, 11), 15: (11, 11), },
'F2': { 0: (12, 10), 10: (13, 10), 5: (12, 11), 15: (13, 11), },
'F1': { 0: (14, 10), 10: (15, 10), 5: (14, 11), 15: (15, 11), },
'G8': { 0: (0, 12), 10: (1, 12), 5: (0, 13), 15: (1, 13), },
'G7': { 0: (2, 12), 10: (3, 12), 5: (2, 13), 15: (3, 13), },
'G6': { 0: (4, 12), 10: (5, 12), 5: (4, 13), 15: (5, 13), },
'G5': { 0: (6, 12), 10: (7, 12), 5: (6, 13), 15: (7, 13), },
'G4': { 0: (8, 12), 10: (9, 12), 5: (8, 13), 15: (9, 13), },
'G3': { 0: (10, 12), 10: (11, 12), 5: (10, 13), 15: (11, 13), },
'G2': { 0: (12, 12), 10: (13, 12), 5: (12, 13), 15: (13, 13), },
'G1': { 0: (14, 12), 5: (14, 13), },
'H8': { 10: (1, 14), 15: (1, 15), },
'H7': { 0: (2, 14), 10: (3, 14), 5: (2, 15), 15: (3, 15), },
'H6': { 0: (4, 14), 10: (5, 14), 5: (4, 15), 15: (5, 15), },
'H5': { 0: (6, 14), 10: (7, 14), 5: (6, 15), 15: (7, 15), },
'H4': { 0: (8, 14), 10: (9, 14), 5: (8, 15), 15: (9, 15), },
'H3': { 0: (10, 14), 10: (11, 14), 5: (10, 15), 15: (11, 15), },
'H2': { 0: (12, 14), 10: (13, 14), 5: (12, 15), },
'H1': { 0: (14, 14), },

}

Expand Down Expand Up @@ -344,7 +265,7 @@ def extract_tiles(asset_path, offsets, height_target, normal_target, texture_key


if mapIdentifier == 'apollo':
map_size_info = ['2.432k'][0]
map_size_info = ['2.048k'][0]
elif mapIdentifier == 'papaya':
map_size_info = ['1.024k'][0]

Expand Down

0 comments on commit 8c0d610

Please sign in to comment.