Difference between revisions of "BLS"

From wowdev
Jump to navigation Jump to search
Line 11: Line 11:
 
== Header ==
 
== Header ==
  
Main header (0xC bytes)
+
*Main header (0xC bytes)
 
  '''Offset Type Description'''
 
  '''Offset Type Description'''
 
  0x0 char[4] Chunk identifier - in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
 
  0x0 char[4] Chunk identifier - in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
Line 19: Line 19:
 
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.
 
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.
  
Vertex program profiles
+
*Vertex program profiles
 
  '''ID Description'''
 
  '''ID Description'''
 
  1 vs2_0 (Direct3D)
 
  1 vs2_0 (Direct3D)
 
  2 ARBvp1 (OpenGL)
 
  2 ARBvp1 (OpenGL)
  
Pixel/fragment program profiles
+
*Pixel/fragment program profiles
 
  '''ID Description'''
 
  '''ID Description'''
 
  0 ps1_1 (Direct3D)
 
  0 ps1_1 (Direct3D)
Line 32: Line 32:
 
  4 ps2_0 (Direct3D)
 
  4 ps2_0 (Direct3D)
 
  10 ARBfp1 (OpenGL)
 
  10 ARBfp1 (OpenGL)
+
 
 
== Permutation block  ==
 
== Permutation block  ==
  

Revision as of 14:00, 3 August 2007

BLS Files

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\. They are referenced directly from WoW.exe, so there is no client database pointing to them.

Header

  • Main header (0xC bytes)
Offset 	Type 	Description
0x0 	char[4] 	Chunk identifier - in reverse character order: "SVXG" in case of a vertex shader, "SPXG" in case of a fragment shader
0x4 	uint32 	Always 0x10003 - version 1.3 of format
0x8 	uint32 	Permutation count

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.

  • 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.