Flexible vertex formats: d3dfvf_xyzw and d3dfvf_xyzrhw

Source: Internet
Author: User

From the dxsdk documentation
D3dfvf_xyzrhw-vertex format contains des the position of a transformed vertex. This flag cannot be used with the d3dfvf_xyz or d3dfvf_normal flags.
D3dfvf_xyzw-vertex format contains transformed and clipped (X, Y, Z, W) data. processvertices does not invoke the Clipper, instead outputting data in clip coordinates. this constant is designed for, and can only be used with, the programmable vertex pipeline.

That shoshould clarify the difference. Both are transformed coordinates but the latter are also clipped; I. e. One step further down the road to the screen.

 

D3dfvf_xyzrhw: Use That when you need to work in screenspace (in 2D, for example for UIS and stuff like that) the vertex shader/pipeline won't be applied to those vertices. only the pixel shader/pipeline. X and Y contain the X and Y coordinate of the vertex in screenspace, and Z and W contain the depth information (never remember how its stored)

D3dfvf_xyzw: use that only if you're using a vertex shader which needs a float4 as the position input. This fvf code won't work with the fixed pipeline.

 

If no rhw exists in the vertex structure, direct3d performs views, projections, world transformations, and Ray calculations before you can get the objects you have drawn in the window. When rhw exists in the vertex structure, it notifies direct3d that the vertex used is already in the screen coordinate system and does not perform views, projections, world transformations, or Ray calculations, because the d3dfvf_xyzrhw Mark tells it that the vertex has been processed and directly performs the grating operation on the vertex, any conversion using settransform will be invalid. However, the origin point is in the upper left corner of the customer zone, where X is right, Y is downward, and Z has changed to the pixel depth of Z-buffer.

D3dfvf_xyzrhw and d3dfvf_xyz and d3dfvf_normal cannot coexist because the last two marks are in conflict with the previous one. When using this vertex, the system requires that the vertex position has been transformed. That is to say, X and Y must be in the screen coordinate system, and Z must be the pixel depth in Z-buffer. value range: 0.0-1.0, 0.0 closest to the observer, and 1.0 farthest visible within the observed range.

 

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.