[Bug 41383] New: normal computation with vertex blending looks wrong

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Sep 23 13:46:39 CDT 2016


https://bugs.winehq.org/show_bug.cgi?id=41383

            Bug ID: 41383
           Summary: normal computation with vertex blending looks wrong
           Product: Wine
           Version: unspecified
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: directx-d3d
          Assignee: wine-bugs at winehq.org
          Reporter: davyaxel at free.fr
      Distribution: ---

Hi,

In wined3d/glsl_shader.c, in shader_glsl_generate_ffp_vertex_shader, one can
find:

if (settings->normal)
{
    if (!settings->vertexblends)
    {
        shader_addline(buffer, "normal = ffp_normal_matrix *
ffp_attrib_normal;\n");
    }
    else
    {
        for (i = 0; i < settings->vertexblends + 1; ++i)
            shader_addline(buffer, "normal += ffp_attrib_blendweight[%u] *
(mat3(ffp_modelview_matrix[%u]) * ffp_attrib_normal);\n", i, i);
    }

    if (settings->normalize)
        shader_addline(buffer, "normal = normalize(normal);\n");
}

There seems to be a mistake: in the non vertexblends case, ffp_normal_matrix is
set to the transpose of the inverse of the modelview matrix. That is in
accordance to the spec.
However in the vertexblends case, the modelview matrices are used non-inversed.

I guess they should be inversed and transposed (which explains why msdn says
half the number of blend matrices are available when normals are used: because
you need to store the inverses).

This non-msdn documentation
https://user.xmission.com/~legalize/book/download/06-Vertex%20Transformations.pdf
(see page 14) also says the matrices should be inversed.

-- 
Do not reply to this email, post in Bugzilla using the
above URL to reply.
You are receiving this mail because:
You are watching all bug changes.



More information about the wine-bugs mailing list