Click here to Skip to main content
16,016,925 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a working graphics pipeline with perspective projection. i wanted to get the transformed vertices on the CPU, now the only way to achieve that was to multiply the vector with my transformation matrices using DirectX::XMVector4Transform. I expected the resulting vectors to be normalized between -1 to 1 while all the vertices are inside screen. But most of the vectors are more than 1 or less than -1. using the same transformation matrices i transform the verts in the gpu and it works perfectly. using the same matrices i expect the vectors to be between -1 and 1 as long as the veerts are being renderd in on the screen (i.e they between -1 to 1).

What I have tried:

i am skeptikal about XMVector4Transform() function

lang="c++">
projectedVectors[i].verts[j] = XMVector4Transform(XMVector4Transform(XMVector4Transform(v1, mWorld), *mView), *mProj);
Posted
Comments
[no name] 1-Jul-19 7:01am    
I don't see a reason why XMVector4Transform should normalize the result. But anyway you can normalize the result of XMVector4Transform by XMVector4Normalize.
Member 14131869 1-Jul-19 12:11pm    
Actually i don't expect XMVector4Tranform to normalize the verts, but isn't the projection matrix supposed to?? i am generating the perspective projection matrix with the DX function. or am i not getting something here?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900