Skip to main content
Fixed image links
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Tests were conducted on a Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz. The binary was built with clang 6.0.0, using an -03 switch.

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

33

In color:
(black is wasted space)

44

Japanese glyphs + some GUI sprites: 3122 subjects.

Runtime: 3.5 - 7 ms
Wasted pixels: 9288 (1.23% - equivalent of a 96 x 96 square)

Output (866 x 871):

55

In color:
(black is wasted space)

66

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Tests were conducted on a Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz. The binary was built with clang 6.0.0, using an -03 switch.

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

Japanese glyphs + some GUI sprites: 3122 subjects.

Runtime: 3.5 - 7 ms
Wasted pixels: 9288 (1.23% - equivalent of a 96 x 96 square)

Output (866 x 871):

5

In color:
(black is wasted space)

6

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Tests were conducted on a Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz. The binary was built with clang 6.0.0, using an -03 switch.

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

Japanese glyphs + some GUI sprites: 3122 subjects.

Runtime: 3.5 - 7 ms
Wasted pixels: 9288 (1.23% - equivalent of a 96 x 96 square)

Output (866 x 871):

5

In color:
(black is wasted space)

6

Added processor notice, other result
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Example results:

Arbitrary game sprites + Japanese glyphs: 3264 subjects in totalTests were conducted on a Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz. The binary was built with clang 6.0.0, using an -03 switch.

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

Japanese glyphs + some GUI sprites: 3122 subjects.

Runtime: 3.5 - 7 ms
Wasted pixels: 9288 (1.23% - equivalent of a 96 x 96 square)

Output (866 x 871):

5

In color:
(black is wasted space)

6

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Tests were conducted on a Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz. The binary was built with clang 6.0.0, using an -03 switch.

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

Japanese glyphs + some GUI sprites: 3122 subjects.

Runtime: 3.5 - 7 ms
Wasted pixels: 9288 (1.23% - equivalent of a 96 x 96 square)

Output (866 x 871):

5

In color:
(black is wasted space)

6

My calculations were a little off
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (1%0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (1% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

If anyone is still interested, I have completely rewritten the rectpack2D library so that it is way more efficient.

It works by keeping a std::vector of empty spaces in the atlas, beginning with some initial maximum size (typically, the maximum allowed texture size on a particular GPU), splitting the first viable empty space and saving the splits back to the vector.

The performance breakthrough came with just using a vector, instead of keeping an entire tree, like it was previously done.

The procedure is described in detail in the README.

The library is under MIT, so I'm happy for you if you find it useful!

Example results:

Arbitrary game sprites + Japanese glyphs: 3264 subjects in total.

Runtime: 4 milliseconds
Wasted pixels: 15538 (0.31% - equivalent of a 125 x 125 square)

Output (2116 x 2382):

3

In color:
(black is wasted space)

4

added 61 characters in body
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31
Loading
deleted 9 characters in body
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31
Loading
added 3 characters in body
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31
Loading
added 121 characters in body
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31
Loading
Source Link
Patryk Czachurski
  • 1.2k
  • 1
  • 13
  • 31
Loading