Colour Cube: Difference between revisions
m
Changed ^3 to ³ to avoid confusion with bitwise XOR.
Smilingfrog (talk | contribs) No edit summary |
m (Changed ^3 to ³ to avoid confusion with bitwise XOR.) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 1:
{{ParadiseResourceTypeInfobox
ColourCube resources are used by both the [[EnvironmentSettings]] and [[PostFX]] to change the colour and tone of the world.▼
| name = ColourCube
| othernames = RwColourCube
| example = [[File:Paradise_ColourCubes.png|
| id = 0x2B
| category = Generic
| memdist = Main Memory only
| importedby = [[Environment Keyframe]]
}}
▲ColourCube resources are used by both the [[EnvironmentSettings]] and [[PostFX]] to change the colour and tone of the world.
▲[[File:Paradise_ColourCubes.png|thumb|200px|ColourCubes used in Burnout Paradise.]]
A ColourCube is a set of
Some time after the [[
In the 1.4 update to ''Burnout Paradise'', the ColourCubes were changed to a standard CLUT, possibly due to the extended time cycle conflicting with the ColourCube's art style. In the 1.6 update, these were again updated to use a default RGB CLUT.
=
=== rw::graphics::postfx::ColourCube ===
==== 32-bit ====
{| class="wikitable"
|-▼
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || m_size ||
|-
| 0x4 || 0x4 || uint8_t* || m_pixels || Pointer to the texture data. ||
|}
==== 64-bit ====
{| class="wikitable"
|-▼
! Offset !! Length !! Type !! Name !! Description !! Comments
|-
| 0x0 || 0x4 || uint32_t || m_size ||
▲|-
| 0x4 || 0x4 || || Padding || ||
|-
| 0x8 || 0x8 || uint8_t* || m_pixels || Pointer to the texture data. ||
Line 30 ⟶ 40:
= Data =
In ''Burnout Paradise: The Ultimate Box'' on PC and ''Burnout Paradise Remastered'' on PC and PS4, data is in a standard RGB24 format (that is, each pixel takes up 3 bytes, one for each color). Textures in the PS3, Xbox 360, and Switch versions of the game are also RGB24, but swizzled. There is a functional implementation of an Xbox 360 to PC texture converter [https://github.com/burninrubber0/ColourCube_Converter on GitHub].
== Xbox 360 Swizzle Algorithm ==
The following algorithm assumes that the data is stored
{| class="wikitable"
! x !! y !! z !! offset (m_size = 16)▼
▲! x !! y !! z !! offset
|- style="vertical-align:top;"
| <pre>xxxx
3210</pre> || <pre>yyyy
3210</pre> || <pre>zzzz
o1=x1
o2=y0
o3=x2
o4=x3
o5=y1
o6=y2
o7=z0
o8=y3^z2
o9=z1
o10=z2
o11=z3</pre>
{| class="wikitable"
! x !! y !! z !! offset (m_size = 32)
|- style="vertical-align:top;"
| <pre>xxxxx
43210</pre> || <pre>yyyyy
43210</pre> || <pre>zzzzz
43210</pre> || <pre>o0=x0
o1=x1
o2=y0
Line 58 ⟶ 87:
o12=z2
o13=z3
o14=z4</
|}
Line 72 ⟶ 101:
# calculate offset, in pixels, of where to find the (x,y,z) pixel in the Xbox 360 data
# pixel offset in PC file is m_size * m_size * z + m_size * y + x
def calc_offset(m_size, x, y, z)
case m_size
when 16
calc_offset16(x, y, z)
when 32
calc_offset32(x, y, z)
else
raise "Unsupported m_size: #{m_size}"
end
end
def calc_offset16(x, y, z)
x0 = (x >> 0) & 0b1
x1 = (x >> 1) & 0b1
x2 = (x >> 2) & 0b1
x3 = (x >> 3) & 0b1
y0 = (y >> 0) & 0b1
y1 = (y >> 1) & 0b1
y2 = (y >> 2) & 0b1
y3 = (y >> 3) & 0b1
z0 = (z >> 0) & 0b1
z1 = (z >> 1) & 0b1
z2 = (z >> 2) & 0b1
z3 = (z >> 3) & 0b1
o=(z3<<11)|
(z2<<10)|
(z1<<9)|
((y3<<8)^(z2<<8))|
(z0<<7)|
(y2<<6)|
(y1<<5)|
(x3<<4)|
(x2<<3)|
(y0<<2)|
(x1<<1)|
(x0<<0)
end
def calc_offset32(x, y, z)
x0 = (x >> 0) & 0b1
x1 = (x >> 1) & 0b1
Line 121 ⟶ 189:
end
# write "converted to PC" data to file
# ...
</syntaxhighlight>
|