Difference between revisions of "Azurik: Rise of Perathia"

From xboxdevwiki
Jump to: navigation, search
(Temporary hack)
 
Line 3: Line 3:
 
==== Skinning code / Shader rounding mode ====
 
==== Skinning code / Shader rounding mode ====
  
This game suffers from issues with non-exact rounding in the shaders which do the skinning / skeletal animation.
+
This game depends on correct GPU rounding. If an emulator suffers from issues with non-exact rounding in the shaders which do the skinning / skeletal animation the character models will be very broken.
  
 
[[File:http://i.imgur.com/tpmLpjP.png]]
 
[[File:http://i.imgur.com/tpmLpjP.png]]
Line 22: Line 22:
 
  A0 = 765 * raw/255 = 3*raw.
 
  A0 = 765 * raw/255 = 3*raw.
  
This should all be working, but it's not. NV2A expects round-to-zero, GLSL and other modern graphic APIs have it undefined..
+
This should all be working, but it's not. [[NV2A/Vertex Shader]] does round-to-zero. Behaviour for GLSL and other modern graphic APIs is undefined..
It works with A0 += 1.0/255.0 as a temporary hack
+
To work around this rounding issue <code>A0 += 1.0/255.0</code> can be used as a temporary hack

Revision as of 13:37, 29 March 2017

Known tricky behaviour

Skinning code / Shader rounding mode

This game depends on correct GPU rounding. If an emulator suffers from issues with non-exact rounding in the shaders which do the skinning / skeletal animation the character models will be very broken.

File:Http://i.imgur.com/tpmLpjP.png

IIRC Code is like:

A0 = c[113].x + c[113].z = 18
*do stuff with c[96+A0] to c[98+A0]*

A0 = c[113].x + c[113].z = 21
*do stuff with c[96+A0] to c[98+A0]* 

A0 = c[113].y * v2
*do stuff with c[96+A0] to c[98+A0]*

c[113] is vec4(15, 765, 3, 0). 765 = 3*255.
v2 is GL_UNSIGNED_BYTE, normalized => v2 = raw/255.
A0 = 765 * raw/255 = 3*raw.

This should all be working, but it's not. NV2A/Vertex Shader does round-to-zero. Behaviour for GLSL and other modern graphic APIs is undefined.. To work around this rounding issue A0 += 1.0/255.0 can be used as a temporary hack