Broken character models in dx8/9 games in wined3d

Jason Green jave27 at gmail.com
Tue Jul 25 07:48:17 CDT 2006


On 7/25/06, Stefan Dösinger <stefandoesinger at gmx.at> wrote:
> Can we flip around the y axis in the shader?

It's not quite so easy.  At the moment in the case w/o shaders, we
multiply the WORLDVIEW and/or PROJECTION matrices by a matrix that
flips the y axis on the whole matrix, like so:

1 1 1 1     1  0  0  0
2 2 2 2     0 -1  0  0
3 3 3 3  *  0  0  1  0
4 4 4 4     0  0  0  1

=

1 -1  1  1
2 -2  2  2
3 -3  3  3
4 -4  4  4

However, when you use a shader, you don't use those matrices at all,
you pass your own vec4 (4 component float vector) constants into the
shader program, and you don't just have 4 of them to use as a matrix,
you have as many as the hardware allows (typically 96 or 256 with
current hardware).  So, we don't know which ones the shader will use
as it's MV/P matrix, so we can't perform any type of y-flip at that
spot because we might mess up the other constants that the shader
needs to perform its calculations.  Plus, the same shader can be used
for multiple render targets - some upside-down and some not.

Flipping the y position in the shader based on the current MVP matrix
fixes the issue in some cases, but only when the shader's "effective
MVP matrix" is the identity matrix.  If the constants that the app
passes to the shader differ from the identity matrix, then our y-flip
isn't taking any of the other rows y-flip into account, so the
calculations are wrong and hence the models are broken.



More information about the wine-devel mailing list