In DX8.1 after vertex shader clipping is performed.
Am i right that clipping rules is:
-w <= x/w <= w
-w <= y/w <= w
0 <= z <= w
instead of:
-w <= x/w <= w
-w <= y/w <= w
0 <= z/w <= w
//r0 - View space vertex
//c4 - projection constants ( (2*fNear)/fWidth , (2*fNear)/fHeight , 1/(fFar - fNear) , -(fNear/(fFar - fNear)) )
//Pojection transformation------------------------------------------
1 : mov r1, c4
2 : mul r2.x, r0.x, r1.x
3 : mul r2.y, r0.y, r1.y
4 : mad r2.z, r0.z, r1.z, r1.w
//5 : mul r2.z, r2.z, r0.z
6 : mov r2.w, r0.z
7: mov oPos, r2
This fragment of VS code i use for custom projection so Z value are regularly distribute in depth range. If row 5 is enabled when i project shadow volumes
extrudet edges on connection faces are rotating around extrusion axis relate to camera's position. If row 5 is disabled everything is OK.
How can I explain myself this situation ?
Am i right that clipping rules is:
-w <= x/w <= w
-w <= y/w <= w
0 <= z <= w
instead of:
-w <= x/w <= w
-w <= y/w <= w
0 <= z/w <= w
//r0 - View space vertex
//c4 - projection constants ( (2*fNear)/fWidth , (2*fNear)/fHeight , 1/(fFar - fNear) , -(fNear/(fFar - fNear)) )
//Pojection transformation------------------------------------------
1 : mov r1, c4
2 : mul r2.x, r0.x, r1.x
3 : mul r2.y, r0.y, r1.y
4 : mad r2.z, r0.z, r1.z, r1.w
//5 : mul r2.z, r2.z, r0.z
6 : mov r2.w, r0.z
7: mov oPos, r2
This fragment of VS code i use for custom projection so Z value are regularly distribute in depth range. If row 5 is enabled when i project shadow volumes
extrudet edges on connection faces are rotating around extrusion axis relate to camera's position. If row 5 is disabled everything is OK.
How can I explain myself this situation ?