3
\$\begingroup\$

Usually, this is how a shape in clip space is defined:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 1.0]
[0.75, 0.25, 0.0, 1.0]

After perspective division to NDC space the result looks following:

enter image description here

However, when setting the w-component of the 2 rightmost vertices to 0:

[0.25, 0.25, 0.0, 1.0]
[0.25, 0.75, 0.0, 1.0]
[0.75, 0.75, 0.0, 0.0] // <-- Note that w=0 here
[0.75, 0.25, 0.0, 0.0] // <--

After perspective division (division of xyz components by w component), I'd expect both vertices to be "projected" to [+infinity,+infinity], since this is how it's described on MSDN:

Divide by 0 produces +/- INF, except 0/0 which results in NaN.

However, the result doesn't indicate that. In fact, the vertices seem to be "projected" to completely different positions:

enter image description here


Any ideas of what's happening there? How would I get a hold of vertex data after perspective divide (stepping through the HLSL disassembly only gets me to the values in clip space)?

The reason I'm asking this is because I have actually seen this method of setting w-component to 0 used for projecting vertices away.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.