Questions about (INDEX) vertex Mixing

Source: Internet
Author: User
D3dvbf_1weights

I have been doing ms3d bone animation for the past few days. I have never written any bone animation before, because I don't like Microsoft's X format very much, and it is very ugly to see the n-plus code it writes. The ms3d format is relatively simple. The current situation is that key frames can be read and interpolated. The problem is how to put them in rendering. Of course, it is impossible for glbeign () and glend () Like OpenGL () after multiplying all vertices once, we can only mix them with vertices. This afternoon, we used the index Buffer technology. In fact, the principle is very simple. The vertex contains several weights, contains a DWORD index. DWORD is a four-byte index that is used to package the index values of the four Matrices Into a dword, then use v * matrix1 * weight1 + V * matrix2 * weight2 ....... (I can see V1, v2... in this document. That's right !).

I plan to use a fixed pipeline for rendering, so the trouble is coming. For the sake of simplicity, fvf is used. however, I have never quite understood the meaning of d3dfvf_xyzb1 through d3dfvf_xyzb5, so that after more than three hours, the problem still cannot be solved. Finally, I switched to the debug mode and checked the output.

Stream 0 stride and vertex size, computed from the current vertex declaration or fvf, are different, which might not work with pre-DX8 drivers and

(Error): The number of blend weights in the fvf shocould match what is set in d3drs_vertexblend for indexed vertex blending

It seems that the vertex definition is incorrect.

Typedef struct ms3d_vert_def
{
D3dxvector3 m_verts; // Vertex
Float m_weight;
DWORD m_index;
D3dxvector3 m_normal; // normal
} Ms3d_vert;

# Define ms3d_vert_fvf (d3dfvf_xyzb1 | d3dfvf_lastbeta_ubyte4 | d3dfvf_normal) Error !!!!!!!!!!!!!!!!!

This is the initial method. In fact, the problem is that d3dfvf_xyzb2 indicates that there are two weight values, because the weight is the same as 1.0f.

At first, I thought I only wanted to use a matrix without mixing. I deleted float m_weight; and changed d3dfvf_xyzb1 to d3dfvf_xyz. However, this is still an error. Why? Doesn't d3dfvf_xyzb1 make any sense ??? Otherwise, if you use d3dfvf_lastbeta_ubyte4, you must use d3dfvf_xyzb1 (d3dfvf_xyzb1 and d3dfvf_xyz) to indicate similar meanings. Here, the weight is 1.0f.

There is also the dev-> setrenderstate (d3drs_vertexblend, d3dvbf_1weights); d3dvbf_1weights actually indicates that two weight uses the last and next last bits of DWORD respectively. A problem in any of the above areas will lead to a mix failure, which is also the reason why I hate fixed pipelines. It takes a lot of time to use optical functions.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.