BLS: Difference between revisions

From wowdev
Jump to navigation Jump to search
mNo edit summary
(Completely redone. Gogo, shader freaks.)
Line 3: Line 3:
There are two major types of shaders: fragment shaders (also known as pixel shaders) and vertex shaders. Fragment shaders are executed on a per-pixel basis, thus can influence texture fetching and combining operations, whereas vertex shaders are executed on a per-vertex basis. These can change vertex positions to achieve mesh animation, particle systems, and texture animation.
There are two major types of shaders: fragment shaders (also known as pixel shaders) and vertex shaders. Fragment shaders are executed on a per-pixel basis, thus can influence texture fetching and combining operations, whereas vertex shaders are executed on a per-vertex basis. These can change vertex positions to achieve mesh animation, particle systems, and texture animation.


BLS files can be found under Shaders\Pixel\. They are referenced directly from WoW.exe, so there is no client database pointing to them.
BLS files can be found under Shaders\Pixel as well as Shaders\Vertex. They are refernced from [[WFX]] files as well as directly from WoW.exe, so there is no client database pointing to them.


*[[Chunk]]ed filestructure.
There are differnt types of shaders.
 
*Vertex shaders:
== Header ==
**arbvp1
**arbvp1_cg12
**vs_1_1
**vs_2_0
**vs_3_0
*Pixel shaders:
**arbfp1
**nvrc
**nvts
**ps_1_1
**ps_1_4
**ps_2_0
**ps_3_0
They are sorted in folders as of 3.*. Previously, there were no different folders but an additional header in the files defining the type.


==Header==
*Main header (0xC bytes)
*Main header (0xC bytes)
  '''Offset Type Description'''
This header is in all files - pixel and vertex shaders in all profiles.
0x0 char[4] Chunk identifier - in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
struct BLSHeader {
  0x4 uint32 Always 0x10003 - version 1.3 of format
  ''/*0x00*/'' char[4] magix; // in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
0x8 uint32 Permutation count
  ''/*0x04*/'' uint32 version; // Always 0x10003 - version 1.3 of format
 
  ''/*0x08*/'' uint32 permutationCount;
After this is a sub header (0x18 bytes for VS, 0x30 bytes for PS) immediatly after main header. This is a table of offsets, pointing to permutation blocks for up to six (in case of VS) or 12 (in case of PS) shading language profiles.
  ''/*0x0C*/''
 
  };
*Vertex program profiles
  '''ID Description'''
1 vs2_0 (Direct3D)
2 ARBvp1 (OpenGL)
 
*Pixel/fragment program profiles
'''ID Description'''
0 ps1_1 (Direct3D)
1 ps1_2 (Direct3D)
2 ps1_3 (Direct3D)
3 ps1_4 (Direct3D)
4 ps2_0 (Direct3D)
10 ARBfp1 (OpenGL)
 
== Permutation block  ==
 
*16 bytes header
  '''Offset Type Description'''
  0x0 uint32 Generally 0, if > 0 there are (0x90 * the value of this uint32) bytes of extra header after this byte (some parameter name?)
0x4 uint32 Generally 0, if > 0 there are (0x90 * the value of this uint32) bytes of extra header after this byte (some texture name?) (Ive seen this go up to 5)
0x8 uint32 Unknown flag; always 0 or 2
0xC uint32 Block size


After this are blocksize bytes, then starts another similar block. For direct3d these data bytes appear to be a binary representation of the shader, for GL they are ARBVB text.
==Blocks==
There are permutationCount blocks of the following structure. They are padded to 0x*0, 0x*4, 0x*8 and 0x*C.
===Pixel===
struct BLSBlock {
''/*0x00*/'' DWORD flags0; // seen: 0x3FE80 in pixel shaders; 0x1A0F in vertex shaders. there may be more ..
''/*0x04*/'' DWORD flags4; // seen: 0x200 in pixel shaders; 0x3FEC1 in vertex shaders (there may be more ..)
''/*0x08*/'' DWORD unk8; // Never seen anything in here.
''/*0x0C*/'' uint32 size; // Tells you how large the block actually is.
''/*0x10*/'' char data[size];
''/*----*/''
};

Revision as of 01:35, 1 September 2009

BLS specify specific instructions to the video card as to how to render parts of the world and how to do certain effects.

There are two major types of shaders: fragment shaders (also known as pixel shaders) and vertex shaders. Fragment shaders are executed on a per-pixel basis, thus can influence texture fetching and combining operations, whereas vertex shaders are executed on a per-vertex basis. These can change vertex positions to achieve mesh animation, particle systems, and texture animation.

BLS files can be found under Shaders\Pixel as well as Shaders\Vertex. They are refernced from WFX files as well as directly from WoW.exe, so there is no client database pointing to them.

There are differnt types of shaders.

  • Vertex shaders:
    • arbvp1
    • arbvp1_cg12
    • vs_1_1
    • vs_2_0
    • vs_3_0
  • Pixel shaders:
    • arbfp1
    • nvrc
    • nvts
    • ps_1_1
    • ps_1_4
    • ps_2_0
    • ps_3_0

They are sorted in folders as of 3.*. Previously, there were no different folders but an additional header in the files defining the type.

Header

  • Main header (0xC bytes)

This header is in all files - pixel and vertex shaders in all profiles.

struct BLSHeader {
/*0x00*/	char[4] magix;		// in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
/*0x04*/	uint32 version;		// Always 0x10003 - version 1.3 of format
/*0x08*/	uint32 permutationCount;
/*0x0C*/
};

Blocks

There are permutationCount blocks of the following structure. They are padded to 0x*0, 0x*4, 0x*8 and 0x*C.

Pixel

struct BLSBlock {
/*0x00*/	DWORD flags0;		// seen: 0x3FE80 in pixel shaders; 0x1A0F in vertex shaders. there may be more ..
/*0x04*/	DWORD flags4;		// seen: 0x200 in pixel shaders; 0x3FEC1 in vertex shaders (there may be more ..)
/*0x08*/	DWORD unk8;		// Never seen anything in here.
/*0x0C*/	uint32 size;		// Tells you how large the block actually is.
/*0x10*/	char data[size];
/*----*/
};